From nobody Sat Jul 12 06:14:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1499867086926504.03242868319876; Wed, 12 Jul 2017 06:44:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2782381243; Wed, 12 Jul 2017 13:44:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E8FFB4D745; Wed, 12 Jul 2017 13:44:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 80FFD1853E33; Wed, 12 Jul 2017 13:44:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6CDiE1u032569 for ; Wed, 12 Jul 2017 09:44:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id BC6CB5DA60; Wed, 12 Jul 2017 13:44:14 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8D6C6DB6A; Wed, 12 Jul 2017 13:44:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2782381243 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2782381243 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 12 Jul 2017 15:44:05 +0200 Message-Id: <99280395408b305b26e999938abe9ccd3dfcf220.1499866398.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Nitesh Konkar Subject: [libvirt] [PATCH 4/5] qemu: process: Extract gathering of 'numad' placement into a function X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 12 Jul 2017 13:44:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Remove the code from qemuProcessPrepareDomain so that it won't get even more bloated. Reviewed-by: Andrea Bolognani --- src/qemu/qemu_process.c | 61 ++++++++++++++++++++++++++++++++-------------= ---- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e6522a294..01fe33c92 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5410,6 +5410,44 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def, } +static int +qemuProcessPrepareDomainNUMAPlacement(virDomainObjPtr vm, + virCapsPtr caps) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + char *nodesetstr =3D NULL; + int ret =3D -1; + + /* Get the advisory nodeset from numad if 'placement' of + * either or is 'auto'. + */ + if (!virDomainDefNeedsPlacementAdvice(vm->def)) + return 0; + + nodesetstr =3D virNumaGetAutoPlacementAdvice(virDomainDefGetVcpus(vm->= def), + virDomainDefGetMemoryTotal(= vm->def)); + + if (!nodesetstr) + goto cleanup; + + VIR_DEBUG("Nodeset returned from numad: %s", nodesetstr); + + if (virBitmapParse(nodesetstr, &priv->autoNodeset, + VIR_DOMAIN_CPUMASK_LEN) < 0) + goto cleanup; + + if (!(priv->autoCpuset =3D virCapabilitiesGetCpusForNodemask(caps, + priv->autoN= odeset))) + goto cleanup; + + ret =3D 0; + + cleanup: + VIR_FREE(nodesetstr); + return ret; +} + + /** * qemuProcessPrepareDomain * @@ -5430,7 +5468,6 @@ qemuProcessPrepareDomain(virConnectPtr conn, { int ret =3D -1; size_t i; - char *nodeset =3D NULL; qemuDomainObjPrivatePtr priv =3D vm->privateData; virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); virCapsPtr caps; @@ -5448,25 +5485,8 @@ qemuProcessPrepareDomain(virConnectPtr conn, } virDomainAuditSecurityLabel(vm, true); - /* Get the advisory nodeset from numad if 'placement' of - * either or is 'auto'. - */ - if (virDomainDefNeedsPlacementAdvice(vm->def)) { - nodeset =3D virNumaGetAutoPlacementAdvice(virDomainDefGetVcpus= (vm->def), - virDomainDefGetMemoryT= otal(vm->def)); - if (!nodeset) - goto cleanup; - - VIR_DEBUG("Nodeset returned from numad: %s", nodeset); - - if (virBitmapParse(nodeset, &priv->autoNodeset, - VIR_DOMAIN_CPUMASK_LEN) < 0) - goto cleanup; - - if (!(priv->autoCpuset =3D virCapabilitiesGetCpusForNodemask(c= aps, - pri= v->autoNodeset))) - goto cleanup; - } + if (qemuProcessPrepareDomainNUMAPlacement(vm, caps) < 0) + goto cleanup; } /* Whether we should use virtlogd as stdio handler for character @@ -5537,7 +5557,6 @@ qemuProcessPrepareDomain(virConnectPtr conn, ret =3D 0; cleanup: - VIR_FREE(nodeset); virObjectUnref(caps); virObjectUnref(cfg); return ret; --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list