From nobody Fri Dec 19 06:33:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1678274239; cv=none; d=zohomail.com; s=zohoarc; b=GiGtcBYsFgmETs53cUKbP23mTXRQHfX9rfWovjtGrjFHV+lPBsLguKnakCW1uTHh3RO9zcwvBUrLClW+c1kaR9fjVK3MZt1MuFCxdbJq/of5I80XKgGKbvnEbH6n+fbwoa1yWGRTZfU/1l8IvhHQ9M8sYH8MdISTBD9koI625Co= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678274239; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JerotWkck3IKpevrsAFMCtG1rhwArJXf394p2/X8YXk=; b=ApuMVnLDsv4OFwjHsgog1yuuLe5+PL6psPBQc5q/JyYNwnEbKiOP4r80sg+MbT/2gultHdVu+FPwZwDHccwqlaCy4x/l3qrryahFmBgbRvquB/6r3uGDqhT20S5w2tnUVYuoqPPxix7GnnY4p8vKbu8qhRrnMCcXxQUKQf6uS9M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1678274239946121.75420839309129; Wed, 8 Mar 2023 03:17:19 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-472-7Bh15lmJPqWz3RuMwotAuw-1; Wed, 08 Mar 2023 06:17:13 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 745FE293248F; Wed, 8 Mar 2023 11:17:11 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D5611121314; Wed, 8 Mar 2023 11:17:11 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3793419465B2; Wed, 8 Mar 2023 11:17:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 52F491946A43 for ; Wed, 8 Mar 2023 11:14:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 472B91121331; Wed, 8 Mar 2023 11:14:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD62E1121314 for ; Wed, 8 Mar 2023 11:14:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678274238; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=JerotWkck3IKpevrsAFMCtG1rhwArJXf394p2/X8YXk=; b=Di+M05WtXeqzNUFeL+LBMrnm00mrmzROcp2h62/Z+KFk24XB8s+gxRe5Xd1+jKhvmsUneB DNJsnX0Oapw7KAURoTAqtTk3MLLwd4XBl4ItsYBThWoaPvXAhpe4Au12F1uLea9NW0LLrW 6wYcM5yMXswBIsnwFS53OYx8YD6mhUM= X-MC-Unique: 7Bh15lmJPqWz3RuMwotAuw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 11/14] qemu: Add @nodemask argument to qemuBuildThreadContextProps() Date: Wed, 8 Mar 2023 12:14:38 +0100 Message-Id: <091da4d966a73092c9ea9931d508206d48214e10.1678274036.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1678274240792100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When building a thread-context object (inside of qemuBuildThreadContextProps()) we look at given memory-backend-* object and look for .host-nodes attribute. This works, as long as we need to just copy the attribute value into another thread-context attribute. But soon we will need to adjust it. That's the point where having the value in virBitmap comes handy. Utilize the previous commit, which made qemuBuildMemoryBackendProps() set the argument and pass it into qemuBuildThreadContextProps(). Signed-off-by: Michal Privoznik Reviewed-by: Andrea Bolognani --- src/qemu/qemu_command.c | 38 +++++++++++++++++++++----------------- src/qemu/qemu_command.h | 3 ++- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1b58171287..b274ab6ff8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3496,7 +3496,8 @@ qemuBuildMemoryCellBackendProps(virDomainDef *def, virQEMUDriverConfig *cfg, size_t cell, qemuDomainObjPrivate *priv, - virJSONValue **props) + virJSONValue **props, + virBitmap **nodemask) { g_autofree char *alias =3D NULL; virDomainMemoryDef mem =3D { 0 }; @@ -3509,8 +3510,8 @@ qemuBuildMemoryCellBackendProps(virDomainDef *def, mem.targetNode =3D cell; mem.info.alias =3D alias; =20 - return qemuBuildMemoryBackendProps(props, alias, cfg, priv, - def, &mem, false, false, NULL); + return qemuBuildMemoryBackendProps(props, alias, cfg, priv, def, + &mem, false, false, nodemask); } =20 =20 @@ -3523,6 +3524,7 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd, { g_autoptr(virJSONValue) props =3D NULL; g_autoptr(virJSONValue) tcProps =3D NULL; + virBitmap *nodemask =3D NULL; g_autofree char *alias =3D NULL; =20 if (!mem->info.alias) { @@ -3533,11 +3535,11 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd, =20 alias =3D g_strdup_printf("mem%s", mem->info.alias); =20 - if (qemuBuildMemoryBackendProps(&props, alias, cfg, - priv, def, mem, true, false, NULL) < 0) + if (qemuBuildMemoryBackendProps(&props, alias, cfg, priv, + def, mem, true, false, &nodemask) < 0) return -1; =20 - if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0) + if (qemuBuildThreadContextProps(&tcProps, &props, priv, nodemask) < 0) return -1; =20 if (tcProps && @@ -3634,11 +3636,10 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg, int qemuBuildThreadContextProps(virJSONValue **tcProps, virJSONValue **memProps, - qemuDomainObjPrivate *priv) + qemuDomainObjPrivate *priv, + virBitmap *nodemask) { g_autoptr(virJSONValue) props =3D NULL; - virJSONValue *nodemask =3D NULL; - g_autoptr(virJSONValue) nodemaskCopy =3D NULL; g_autofree char *tcAlias =3D NULL; const char *memalias =3D NULL; bool prealloc =3D false; @@ -3648,7 +3649,6 @@ qemuBuildThreadContextProps(virJSONValue **tcProps, if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_THREAD_CONTEXT)) return 0; =20 - nodemask =3D virJSONValueObjectGetArray(*memProps, "host-nodes"); if (!nodemask) return 0; =20 @@ -3664,12 +3664,11 @@ qemuBuildThreadContextProps(virJSONValue **tcProps, } =20 tcAlias =3D g_strdup_printf("tc-%s", memalias); - nodemaskCopy =3D virJSONValueCopy(nodemask); =20 if (virJSONValueObjectAdd(&props, "s:qom-type", "thread-context", "s:id", tcAlias, - "a:node-affinity", &nodemaskCopy, + "m:node-affinity", nodemask, NULL) < 0) return -1; =20 @@ -7151,17 +7150,18 @@ qemuBuildMemCommandLineMemoryDefaultBackend(virComm= and *cmd, g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(priv->dr= iver); g_autoptr(virJSONValue) props =3D NULL; g_autoptr(virJSONValue) tcProps =3D NULL; + virBitmap *nodemask =3D NULL; virDomainMemoryDef mem =3D { 0 }; =20 mem.size =3D virDomainDefGetMemoryInitial(def); mem.targetNode =3D -1; mem.info.alias =3D (char *) defaultRAMid; =20 - if (qemuBuildMemoryBackendProps(&props, defaultRAMid, cfg, - priv, def, &mem, false, true, NULL) < = 0) + if (qemuBuildMemoryBackendProps(&props, defaultRAMid, cfg, priv, + def, &mem, false, true, &nodemask) < 0) return -1; =20 - if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0) + if (qemuBuildThreadContextProps(&tcProps, &props, priv, nodemask) < 0) return -1; =20 if (tcProps && @@ -7432,6 +7432,7 @@ qemuBuildNumaCommandLine(virQEMUDriverConfig *cfg, virQEMUCaps *qemuCaps =3D priv->qemuCaps; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; virJSONValue **nodeBackends =3D NULL; + g_autofree virBitmap **nodemask =3D NULL; bool needBackend =3D false; bool hmat =3D false; int ret =3D -1; @@ -7453,10 +7454,12 @@ qemuBuildNumaCommandLine(virQEMUDriverConfig *cfg, } =20 nodeBackends =3D g_new0(virJSONValue *, ncells); + nodemask =3D g_new0(virBitmap *, ncells); =20 for (i =3D 0; i < ncells; i++) { if ((rc =3D qemuBuildMemoryCellBackendProps(def, cfg, i, priv, - &nodeBackends[i])) < 0) + &nodeBackends[i], + &nodemask[i])) < 0) goto cleanup; =20 if (rc =3D=3D 0) @@ -7486,7 +7489,8 @@ qemuBuildNumaCommandLine(virQEMUDriverConfig *cfg, if (needBackend) { g_autoptr(virJSONValue) tcProps =3D NULL; =20 - if (qemuBuildThreadContextProps(&tcProps, &nodeBackends[i], pr= iv) < 0) + if (qemuBuildThreadContextProps(&tcProps, &nodeBackends[i], + priv, nodemask[i]) < 0) goto cleanup; =20 if (tcProps && diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 9074822bc5..17f326d13b 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -153,7 +153,8 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg, int qemuBuildThreadContextProps(virJSONValue **tcProps, virJSONValue **memProps, - qemuDomainObjPrivate *priv); + qemuDomainObjPrivate *priv, + virBitmap *nodemask); =20 /* Current, best practice */ virJSONValue * --=20 2.39.2