From nobody Sun Feb 8 14:51:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1575933380; cv=none; d=zohomail.com; s=zohoarc; b=C8Zztu3I6hFIwMF9eXaMDEo7zNFNumbKrlgT+9Q7lEzAZrWZit57aSw2jEMZZ6ejb65feFfgVzajwGDRgsfU/1sZhuxdTOKS3vWaBSuqqs+3ODLfIZT+Wmx//xJf+iPa5dG1MyvGJqRvJCIgvhivpi4tHkhPAErZMVidMBAHx+k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575933380; h=Content-Type:Content-Transfer-Encoding:Cc: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=2s1ieugD7cM8u/eFF0HVZzaUDLqJGuDjRSh9xN7xG8s=; b=bbjhX3rE9jKau5LCGUCyEjqu/N7DeS4jwIW+aC93PZoKwRkpInBod9V5dFkUcXettFsZ/ztHbBZoUCUvdfM1t91D7ux10CfJmjDAt6xUeNjvhW7i4Z20MHvcUqzu4TGNkSw9EFd/2x0Are1/JUJpBzh/oGlnhu8rKCpJ0mX350A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1575933380164148.44703750070562; Mon, 9 Dec 2019 15:16:20 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-95-SjZm9wscPVW0zXVCt7fddg-1; Mon, 09 Dec 2019 18:16:15 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6899D800EB7; Mon, 9 Dec 2019 23:16:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F4F95D6B7; Mon, 9 Dec 2019 23:16:08 +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 EF07A8355C; Mon, 9 Dec 2019 23:16:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB9NG1oo008400 for ; Mon, 9 Dec 2019 18:16:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id 016982063FE6; Mon, 9 Dec 2019 23:16:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F0E6B2063FEA for ; Mon, 9 Dec 2019 23:15:58 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 97DF790017F for ; Mon, 9 Dec 2019 23:15:58 +0000 (UTC) Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-227-GmmluQ64PZC4L6jZFebamg-1; Mon, 09 Dec 2019 18:15:53 -0500 Received: by mail-qk1-f169.google.com with SMTP id c16so6374225qko.6; Mon, 09 Dec 2019 15:15:53 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:fe5:8243:c780:f073:3beb]) by smtp.gmail.com with ESMTPSA id e130sm352436qkb.72.2019.12.09.15.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 15:15:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575933377; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=2s1ieugD7cM8u/eFF0HVZzaUDLqJGuDjRSh9xN7xG8s=; b=EjLNuG0i001wx0JW7qHxvidH0ZpKgf4DvWuURnWhiEu6pd+jV3WlkgPhYRnycum/6616O/ whcvBVpstEM+74T8TsssANdDnkGxIAHww0IuHt7EKwzu/Z8nzOZLn8GKhquXItBSvuQOys qQBbAwr1V4lqQXjzWGTsJEw3BMNUCAs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/OO7F1onoWJuZ72SYq4+Sg5YTrhw3CeCrDIzma5V9Cs=; b=YCSYbvGDq89UhwT+vCdZTPKT0rUMuqtUnSW8yHuDtXCBDOCzyJ1f0IZTzitpeKjMAu aBk2VLZJsCk/UEZUtqQkJdPSN9sOPecW5b2iZFHEXB8dSncD/S9Xj1QGJSxCSVneW8T+ OF+i2IODS6DXytx4hCosqiYV9nfybmyx7M+QVhereFwQyr5K/3r4xBaoYDDs5nvwrkJj zQ7QR2xkG3f8YuPXGE2l8qwHLhh7gcpzmMFgMNT1o6n2mQ8DrTYyFUjx+lQAfQOezVfN ffJ7FCRay2srsTSSsWzZ+cAXSedQsXrQlthmYbwgRqThP3am7YJji766rm7i5Cpzne+T yjlQ== X-Gm-Message-State: APjAAAU2e1Al53fFVtfmh3Pzg5bIEW67WEJL4X/rt2DfssODMW8WWxNJ 0ydj8ull4xsXebzKkfUKCWLRWS7J80s= X-Google-Smtp-Source: APXvYqx5UuN9JQ1eo//83iNcbv6dS+iLkaiYWAbbKIvkvzElGzrkyAqqA4OjkfRKS1XAvRF0MrSnjQ== X-Received: by 2002:a37:4141:: with SMTP id o62mr1403856qka.282.1575933353041; Mon, 09 Dec 2019 15:15:53 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Mon, 9 Dec 2019 20:15:11 -0300 Message-Id: <20191209231531.2423222-7-danielhb413@gmail.com> In-Reply-To: <20191209231531.2423222-1-danielhb413@gmail.com> References: <20191209231531.2423222-1-danielhb413@gmail.com> MIME-Version: 1.0 X-MC-Unique: GmmluQ64PZC4L6jZFebamg-1 X-MC-Unique: SjZm9wscPVW0zXVCt7fddg-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xB9NG1oo008400 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v1 06/26] numa_conf: add virDomainNumaNodesDistancesAreBeingSet() helper 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Next patch will validate QEMU_CAPS_NUMA_DIST in a new qemu_domain.c function. The code to verify if a NUMA node distance is being set will still be needed in qemuBuildNumaArgStr() though. To avoid code repetition, let's put this logic in a helper to be used in qemuBuildNumaArgStr() and in the new function. Signed-off-by: Daniel Henrique Barboza --- src/conf/numa_conf.c | 19 +++++++++++++++++++ src/conf/numa_conf.h | 2 ++ src/libvirt_private.syms | 1 + src/qemu/qemu_command.c | 15 +-------------- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 4bc22ec7d9..6f1257fd8e 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -1188,6 +1188,25 @@ virDomainNumaNodeDistanceIsUsingDefaults(virDomainNu= maPtr numa, } =20 =20 +bool +virDomainNumaNodesDistancesAreBeingSet(virDomainNumaPtr numa) +{ + size_t ncells =3D virDomainNumaGetNodeCount(numa); + size_t i, j; + + for (i =3D 0; i < ncells; i++) { + for (j =3D 0; j < ncells; j++) { + if (virDomainNumaNodeDistanceIsUsingDefaults(numa, i, j)) + continue; + + return true; + } + } + + return false; +} + + size_t virDomainNumaGetNodeDistance(virDomainNumaPtr numa, size_t node, diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h index e76a09c20c..b1b8e3274d 100644 --- a/src/conf/numa_conf.h +++ b/src/conf/numa_conf.h @@ -89,6 +89,8 @@ bool virDomainNumaNodeDistanceIsUsingDefaults(virDomainNu= maPtr numa, size_t node, size_t sibling) ATTRIBUTE_NONNULL(1); +bool virDomainNumaNodesDistancesAreBeingSet(virDomainNumaPtr numa) + ATTRIBUTE_NONNULL(1); size_t virDomainNumaGetNodeDistance(virDomainNumaPtr numa, size_t node, size_t sibling) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 5da5307fa3..df41eb3d16 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -812,6 +812,7 @@ virDomainNumaGetNodeMemoryAccessMode; virDomainNumaGetNodeMemorySize; virDomainNumaNew; virDomainNumaNodeDistanceIsUsingDefaults; +virDomainNumaNodesDistancesAreBeingSet; virDomainNumaSetNodeCount; virDomainNumaSetNodeCpumask; virDomainNumaSetNodeDistance; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 37339d6f0d..7849607b16 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7443,7 +7443,6 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, int ret =3D -1; size_t ncells =3D virDomainNumaGetNodeCount(def->numa); const long system_page_size =3D virGetSystemPageSizeKB(); - bool numa_distances =3D false; =20 if (virDomainNumatuneHasPerNodeBinding(def->numa) && !(virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) || @@ -7537,19 +7536,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, /* If NUMA node distance is specified for at least one pair * of nodes, we have to specify all the distances. Even * though they might be the default ones. */ - for (i =3D 0; i < ncells; i++) { - for (j =3D 0; j < ncells; j++) { - if (virDomainNumaNodeDistanceIsUsingDefaults(def->numa, i, j)) - continue; - - numa_distances =3D true; - break; - } - if (numa_distances) - break; - } - - if (numa_distances) { + if (virDomainNumaNodesDistancesAreBeingSet(def->numa)) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA_DIST)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("setting NUMA distances is not " --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list