From nobody Mon May 6 12:57:09 2024 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=1591034022; cv=none; d=zohomail.com; s=zohoarc; b=Fzh4818WN60+VQMlnucm2jDItOhHafFcHgdaRPsYXLVB0+2GVW54mOEPOLQrUPd9D4UUV+fCMzYEkpxKxn+0PCJoaXIgwtf0fegr1YsRklqPVVdsd731Mrztb8UDqHQDm/7wVaaUxfQ17XrOoW4o7HFZG31mz4DBmTIti68ah3Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591034022; 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=n6JD0ayJnyPAxchQ040iyseMmBUNa6IblKupc6M8+Ag=; b=gt4hNQqNuW6hKaOMkDTM7/cijPKvuThxKkbPWBbja78NXtDVzbyeabLCz+Acm3yDCvbDs/n0G8XHXd65SZH7t5G+vyRFzoFrm993a0uRkT+0mF9sFuaPupovoE+9XkGY+kmvXAteRvaJsEL9qR9R9Sy73SU8k69XEzz1lRdxn0Q= 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 1591034022075307.5762004644632; Mon, 1 Jun 2020 10:53:42 -0700 (PDT) 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-19-H0Hg7iIRP6u8ZSyEeRanAw-1; Mon, 01 Jun 2020 13:53:37 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F7868018A5; Mon, 1 Jun 2020 17:53:32 +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 801365D9DD; Mon, 1 Jun 2020 17:53:32 +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 2B7A61809543; Mon, 1 Jun 2020 17:53:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 051Hp1kV009394 for ; Mon, 1 Jun 2020 13:51:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 950732156A49; Mon, 1 Jun 2020 17:51:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 86A092156A3A for ; Mon, 1 Jun 2020 17:51:01 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 EC23F1859164 for ; Mon, 1 Jun 2020 17:51:00 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-392-5nqT0GG6NLqjXksZ_qKSbw-1; Mon, 01 Jun 2020 13:50:53 -0400 Received: by mail-qt1-f195.google.com with SMTP id y1so8362601qtv.12; Mon, 01 Jun 2020 10:50:53 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:9da7:da03:b92e:aafb:831c]) by smtp.gmail.com with ESMTPSA id h22sm9519021qtk.63.2020.06.01.10.50.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 10:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591034020; 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=n6JD0ayJnyPAxchQ040iyseMmBUNa6IblKupc6M8+Ag=; b=U2NJUrLV15q6gMpx32G++6KlL9AWJeAH1BAoomwgpE/Q4IlFuz2hbrKw8dcVOZ0siDuB2P zQS6AlmPzMCxmEoHY8HrBzUgLUIdxPpzCrSSygVDqYVcGEsy4q6PkyYAUmOkvF1G4qNe8Z pLfMPGWCufvesPb7MWqB7mm2vDDShEw= X-MC-Unique: H0Hg7iIRP6u8ZSyEeRanAw-1 X-MC-Unique: 5nqT0GG6NLqjXksZ_qKSbw-1 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=n6JD0ayJnyPAxchQ040iyseMmBUNa6IblKupc6M8+Ag=; b=OmoimclwP6BjfCnlpC+jGMO8yH0jmFlbFLvoagbEenY9ytzrwU+ld7zx4LW0dPkhcm OBlyRkww70KvqK3Aqetx41uoJuKxhqZK7gU2i/Z15zoqTUA3o/dVogKqNtr6ql5CC3Ze x4UO8RZ0bRXRVPZuIA/9ynrVys2NR1RjtuQpms6zdCdUyeOfMsjxxTF1jqp0HpVQOJGq 0xdQJo0wbiHP98cfSANxeWBgw0vO09/73RRm0rCE66DRfNab3HxN67bmceCP0u145ntI aocgk4n4I8vVgE0kD7WSxTx1iqlhB/bngiJOn26nB/QcU790l1OYmWg7gcNGYI7Dk9KZ tClw== X-Gm-Message-State: AOAM533p123M7D14/HJNyInlzrWVhPiSgwKLgxERgSufMiZYJFY8qGn3 xR8orLzrZSmwx0FOYAJYNTmGQUzlKA0= X-Google-Smtp-Source: ABdhPJxP26ohHo1F82C1UNWZ+YvyMxxHT2yJdysuGHwiqkByq4uBkOCd7F9C/L4CXpUnzgqYQ9w57Q== X-Received: by 2002:ac8:4b58:: with SMTP id e24mr23346942qts.278.1591033852430; Mon, 01 Jun 2020 10:50:52 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 1/5] numa_conf.c: add helper functions for cpumap operations Date: Mon, 1 Jun 2020 14:50:37 -0300 Message-Id: <20200601175041.1607723-2-danielhb413@gmail.com> In-Reply-To: <20200601175041.1607723-1-danielhb413@gmail.com> References: <20200601175041.1607723-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , pkrempa@redhat.com 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.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" These helpers will be used in an auto-fill feature for incomplete NUMA topologies in the next patch. Signed-off-by: Daniel Henrique Barboza --- src/conf/numa_conf.c | 46 ++++++++++++++++++++++++++++++++++++++++ src/conf/numa_conf.h | 3 +++ src/libvirt_private.syms | 1 + 3 files changed, 50 insertions(+) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 6f1257fd8e..3d766189ba 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -1373,3 +1373,49 @@ virDomainNumaGetMemorySize(virDomainNumaPtr numa) =20 return ret; } + + +static int +virDomainNumaRemoveCPUsFromMap(virBitmapPtr result, virBitmapPtr exclude) +{ + size_t i; + + for (i =3D 0; i < virBitmapSize(exclude); i++) { + if (!virBitmapIsBitSet(exclude, i)) + continue; + + if (virBitmapClearBitExpand(result, i) < 0) + return -1; + } + + return 0; +} + + +int +virDomainNumaFillCPUsInNode(virDomainNumaPtr numa, size_t node, + unsigned int maxCpus) +{ + g_autoptr(virBitmap) maxCPUsBitmap =3D virBitmapNew(maxCpus); + size_t i; + + if (node >=3D virDomainNumaGetNodeCount(numa)) + return -1; + + virBitmapSetAll(maxCPUsBitmap); + + for (i =3D 0; i < numa->nmem_nodes; i++) { + virBitmapPtr nodeCpus =3D virDomainNumaGetNodeCpumask(numa, i); + + if (i =3D=3D node) + continue; + + if (virDomainNumaRemoveCPUsFromMap(maxCPUsBitmap, nodeCpus) < 0) + return -1; + } + + virBitmapFree(numa->mem_nodes[node].cpumask); + numa->mem_nodes[node].cpumask =3D g_steal_pointer(&maxCPUsBitmap); + + return 0; +} diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h index ae3599bb8b..cdf87a87e8 100644 --- a/src/conf/numa_conf.h +++ b/src/conf/numa_conf.h @@ -185,3 +185,6 @@ int virDomainNumaDefCPUParseXML(virDomainNumaPtr def, x= mlXPathContextPtr ctxt); int virDomainNumaDefCPUFormatXML(virBufferPtr buf, virDomainNumaPtr def); =20 unsigned int virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa); + +int virDomainNumaFillCPUsInNode(virDomainNumaPtr numa, size_t node, + unsigned int maxCpus); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a6af44fe1c..788e08045a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -834,6 +834,7 @@ virDomainMemoryAccessTypeFromString; virDomainMemoryAccessTypeToString; virDomainNumaCheckABIStability; virDomainNumaEquals; +virDomainNumaFillCPUsInNode; virDomainNumaFree; virDomainNumaGetCPUCountTotal; virDomainNumaGetMaxCPUID; --=20 2.26.2 From nobody Mon May 6 12:57:09 2024 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=1591033875; cv=none; d=zohomail.com; s=zohoarc; b=dsx5ucBJYQS/O9a2mGSic+/s0mhvpQ+Bq4Abw0X3/NrdKDTIEyQmTwO0jX2O9jRu5xjYAQEG63++fQsC4W0u4BTizbHs6KjzuMZsua3nFiF/4K/0l1kO28JI4DUt1qQG2kg7oK2TJxBc7Eovzn0zendS247xdpj2JkPOvIT1M2I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591033875; 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=RIolC+iH9R6ampV8D/SN6MmrVjo6v4jwailiug8vXRk=; b=jIv15vBSzo2J+OpKi4mVl74RYMXJ4qy6nsSp6OL+NbeFh2sWenrtB3Lshnl7E7+f3iYX7gANaSgmt0rY41VwLLlxrSfE3pU0O0/Q4vAZF+YbTWOd50WiHyiDfjBABU4pUYp4oPuyd0WMySBo20DhcRI8QLmCq+Dm4EEzRFAYsIc= 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 1591033875741519.1360205448377; Mon, 1 Jun 2020 10:51:15 -0700 (PDT) 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-421-9guTtURPNYGHD4Cmm7suzg-1; Mon, 01 Jun 2020 13:51:12 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6DA7B800053; Mon, 1 Jun 2020 17:51:06 +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 819BCD01E1; Mon, 1 Jun 2020 17:51:05 +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 C7B9E9338A; Mon, 1 Jun 2020 17:51:01 +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 051Hox1D009379 for ; Mon, 1 Jun 2020 13:50:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8F1F52028DCC; Mon, 1 Jun 2020 17:50:59 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 87A802026FFE for ; Mon, 1 Jun 2020 17:50:57 +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 379CF800FFE for ; Mon, 1 Jun 2020 17:50:57 +0000 (UTC) Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-7Hgx9iMTMhWXPnSXdM1jeA-1; Mon, 01 Jun 2020 13:50:55 -0400 Received: by mail-qv1-f53.google.com with SMTP id g7so416382qvx.11; Mon, 01 Jun 2020 10:50:54 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:9da7:da03:b92e:aafb:831c]) by smtp.gmail.com with ESMTPSA id h22sm9519021qtk.63.2020.06.01.10.50.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 10:50:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591033874; 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=RIolC+iH9R6ampV8D/SN6MmrVjo6v4jwailiug8vXRk=; b=KLwFCpLTsK43liW2/jj9UyZuOJEsoX2VhKW4j3aeg6pEFPWTQ1tOa39n9F1oP8rJ9/WQnD styYOvU4IoBS/4EB6mOgjVci2sHliqJi2NfbNIElBrVIH3TJF/WEM2ijEXDoqgxLcBvBYe 7htcBwji9qFUnE4TQY9vTCDH2K45V7o= X-MC-Unique: 9guTtURPNYGHD4Cmm7suzg-1 X-MC-Unique: 7Hgx9iMTMhWXPnSXdM1jeA-1 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=RIolC+iH9R6ampV8D/SN6MmrVjo6v4jwailiug8vXRk=; b=C/tMjcci+MDGtQUEopt18U9Oh+VIIG9+LZib8O7wEYA7i5dXepQp2gCyjj1lqqwK4d TqQG5U22M1glQbLGYPOgNc9Oy4Hd7hmZwZ5leMZffzWAhzx+8ZxEa5W6CD//1W237Rjd Vuv8TUVnFvmyAWjyQoEjqZPziMCoC/wZ4cKpDAcGk558u7awFoAZ+Pkx46Pxy+mIhBmh 6PrCMeJZkOcTYrQ1jdh1nxa9YWbUDQn8dkYYnptJLAzqU22JlucP4p80RhmI2tSMiPLb vVI+LY+GKZ1aR4Fs6x6zkManyjFkR0kRRMw2Mz62yV4UIlIYM/Ac4iPDFR0IkDsheZkM gqQQ== X-Gm-Message-State: AOAM533nc7tzD5v3UtvaUbJPiy3W8Y029euailXOSUtNZcfaK+VMtVdw SaELyjgWgt4pQTV5YpfjC86mne5KR9w= X-Google-Smtp-Source: ABdhPJwL0U3W7MGauF9qqfe67MuIne9RyrY/qabFG0XnW3u+pp0W79Hv4jBSyii0DuOBsHVrr5MZ5g== X-Received: by 2002:ad4:5608:: with SMTP id ca8mr2645651qvb.221.1591033854143; Mon, 01 Jun 2020 10:50:54 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 2/5] qemu_domain.c: NUMA CPUs auto-fill for incomplete topologies Date: Mon, 1 Jun 2020 14:50:38 -0300 Message-Id: <20200601175041.1607723-3-danielhb413@gmail.com> In-Reply-To: <20200601175041.1607723-1-danielhb413@gmail.com> References: <20200601175041.1607723-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , pkrempa@redhat.com 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.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Libvirt allows the user to define an incomplete NUMA topology, where the sum of all CPUs in each cell is less than the total of VCPUs. What ends up happening is that QEMU allocates the non-enumerated CPUs in the first NUMA node. This behavior is being flagged as 'to be deprecated' at least since QEMU commit ec78f8114bc4 ("numa: use possible_cpus for not mapped CPUs check"). In [1], Maxiwell suggested that we forbid the user to define such topologies. In his review [2], Peter Krempa pointed out that we can't break existing guests, and suggested that Libvirt should emulate the QEMU behavior of putting the remaining vCPUs in the first NUMA node in these cases. This patch implements Peter Krempa's suggestion. Since we're going to most likely end up with disjointed NUMA configuration in node 0 after the auto-fill, we're making auto-fill dependent on QEMU_CAPS_NUMA. A following patch will update the documentation not just to inform about the auto-fill mechanic with incomplete NUMA topologies, but also to discourage the user to create such topologies in the future. This approach also makes Libvirt independent of whether QEMU changes its current behavior since we're either auto-filling the CPUs in node 0 or the user (hopefully) is aware that incomplete topologies, although supported in Libvirt, are to be avoided. [1] https://www.redhat.com/archives/libvir-list/2019-June/msg00224.html [2] https://www.redhat.com/archives/libvir-list/2019-June/msg00263.html Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_domain.c | 47 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 4 ++++ src/qemu/qemu_driver.c | 9 ++++++++ 3 files changed, 60 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d5e3d1a3cc..8034b6a219 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4953,6 +4953,50 @@ qemuDomainDefTsegPostParse(virDomainDefPtr def, } =20 =20 +/** + * qemuDomainDefNumaCPUsRectify: + * @numa: pointer to numa definition + * @maxCpus: number of CPUs this numa is supposed to have + * + * This function emulates the (to be deprecated) behavior of filling + * up in node0 with the remaining CPUs, in case of an incomplete NUMA + * setup, up to getVcpusMax. + * + * Returns: 0 on success, -1 on error + */ +int +qemuDomainDefNumaCPUsRectify(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) +{ + unsigned int vcpusMax, numacpus; + + /* QEMU_CAPS_NUMA tells us if QEMU is able to handle disjointed + * NUMA CPU ranges. The filling process will create a disjointed + * setup in node0 most of the time. Do not proceed if QEMU + * can't handle it.*/ + if (virDomainNumaGetNodeCount(def->numa) =3D=3D 0 || + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA)) + return 0; + + vcpusMax =3D virDomainDefGetVcpusMax(def); + numacpus =3D virDomainNumaGetCPUCountTotal(def->numa); + + if (numacpus < vcpusMax) { + if (virDomainNumaFillCPUsInNode(def->numa, 0, vcpusMax) < 0) + return -1; + } + + return 0; +} + + +static int +qemuDomainDefNumaCPUsPostParse(virDomainDefPtr def, + virQEMUCapsPtr qemuCaps) +{ + return qemuDomainDefNumaCPUsRectify(def, qemuCaps); +} + + static int qemuDomainDefPostParseBasic(virDomainDefPtr def, void *opaque G_GNUC_UNUSED) @@ -5039,6 +5083,9 @@ qemuDomainDefPostParse(virDomainDefPtr def, if (qemuDomainDefTsegPostParse(def, qemuCaps) < 0) return -1; =20 + if (qemuDomainDefNumaCPUsPostParse(def, qemuCaps) < 0) + return -1; + return 0; } =20 diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 41d3f1561d..e78a2b935d 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1297,3 +1297,7 @@ qemuDomainInitializePflashStorageSource(virDomainObjP= tr vm); bool qemuDomainDiskBlockJobIsSupported(virDomainObjPtr vm, virDomainDiskDefPtr disk); + +int +qemuDomainDefNumaCPUsRectify(virDomainDefPtr def, + virQEMUCapsPtr qemuCaps); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index dd9ae30bb5..9f4f11f15c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4999,6 +4999,7 @@ qemuDomainSetVcpusMax(virQEMUDriverPtr driver, unsigned int nvcpus) { g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUCaps) qemuCaps =3D NULL; unsigned int topologycpus; =20 if (def) { @@ -5029,6 +5030,14 @@ qemuDomainSetVcpusMax(virQEMUDriverPtr driver, if (virDomainDefSetVcpusMax(persistentDef, nvcpus, driver->xmlopt) < 0) return -1; =20 + /* re-adjust NUMA nodes if needed */ + if (!(qemuCaps =3D virQEMUCapsCacheLookup(driver->qemuCapsCache, + persistentDef->emulator))) + return -1; + + if (qemuDomainDefNumaCPUsRectify(persistentDef, qemuCaps) < 0) + return -1; + if (virDomainDefSave(persistentDef, driver->xmlopt, cfg->configDir) < = 0) return -1; =20 --=20 2.26.2 From nobody Mon May 6 12:57:09 2024 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=1591033903; cv=none; d=zohomail.com; s=zohoarc; b=RPMwS5WgJITlVoMQDot3H5+tCEUdYWGnBgZ5TJdB0WPgKemmMnnMhi8ikoarl9dHE9UsphAe64HXvv2uHGkQDCi2fWLrlYtI6K9jOdO2ho7GIORimYZ9BprYH1AifTi8niON1kvtCvztZLnbqmkHDPzxP2yuXacOu/E95N2m9eA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591033903; 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=dQu0hXwoK158/nC+VHHu8v6OJBUx51WtlVVhKMj/UXY=; b=SSWIkTheFLA2Xr62ifgjKI/S5Lj3/9VTJi2+WwIQS5Uz3o1r4gnYGWBD+Ffxr7ZXs3RsV1iRUC+TAsuZ8PF9V41CQL/SExcWL7JcduqBmJUNWnAKaw31bf0uMQDBLUVJuEX3VLz/EgaO847eQ/sDpNhb8dkiFy3L5alwtA7L228= 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 1591033903357319.3208261328907; Mon, 1 Jun 2020 10:51:43 -0700 (PDT) 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-421-MKV7mC5NO9iCsa3lr-5nYg-1; Mon, 01 Jun 2020 13:51:40 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0026D873092; Mon, 1 Jun 2020 17:51:35 +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 D61D67E7FA; Mon, 1 Jun 2020 17:51:34 +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 A67EF1809554; Mon, 1 Jun 2020 17:51:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 051Hp3iv009416 for ; Mon, 1 Jun 2020 13:51:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id BA35F2156A2D; Mon, 1 Jun 2020 17:51:03 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B65292166B28 for ; Mon, 1 Jun 2020 17:51:03 +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 9B5E51859175 for ; Mon, 1 Jun 2020 17:51:03 +0000 (UTC) Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-483-SQzqOCuIPvCl1OBl63W3gw-1; Mon, 01 Jun 2020 13:50:57 -0400 Received: by mail-qk1-f193.google.com with SMTP id c12so9856307qkk.13; Mon, 01 Jun 2020 10:50:56 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:9da7:da03:b92e:aafb:831c]) by smtp.gmail.com with ESMTPSA id h22sm9519021qtk.63.2020.06.01.10.50.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 10:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591033902; 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=dQu0hXwoK158/nC+VHHu8v6OJBUx51WtlVVhKMj/UXY=; b=cYdOeLc5HK6Sj2nZEoTOEOP3oGKP0Ji43kWmIYm8HaKezT8uTs+WwskTxIjU/yPK0uCwg/ r9vYY4QS04AVXm1PPoM7qeJvUOboVCZNEAMsoRwiJ7QdAmMwMFcSvjcT3047F9YiUo5xgY uZiuL4Daj/NBcr+92PvZ0kOMsZw2euY= X-MC-Unique: MKV7mC5NO9iCsa3lr-5nYg-1 X-MC-Unique: SQzqOCuIPvCl1OBl63W3gw-1 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=dQu0hXwoK158/nC+VHHu8v6OJBUx51WtlVVhKMj/UXY=; b=SORUTEy/fiXu9VeXAlBRbtCrq5bUjuEorvF3lgdl/nbxVlyo6ubuuT4bTRLfljNdGV PA/E5fSVmpPwsvySW8G8w3PrQE3VCb6Woseaj3LUx1r6CvdVtjKvihW9DcaSxBLsdEVi K4v2/yPWMhr8PWn9wPjkchVIZ2kfbwxnixKIZmxXnG8idKdKMpeywqVMkOpR0RUyWbIS XK+ZjjeiynEl9720G/B5y0K1E9sdu+ZjrD80q1mwIJMppDsiUJpjzBxB/iW6P3tOfbvf 82QYStNzwbu1xb+ha78Gz67fBRyZ9twTCZMjBTrLrJ707Vsl6vc4UXhiEYNKgLjKP2RH VxYw== X-Gm-Message-State: AOAM533/tz392BoH02Q2HxExtR0TfIE/EHRJ0DUViiIQtuhwDzc+rkG1 /Y/1rhQtSh6vt8wed3AOwL5MQigkq0c= X-Google-Smtp-Source: ABdhPJyTvssfZx4lXHCf2NL2XnZ17+fWhAxDcRx1xMDowbkoan2qCCM8gmfV6W392lgDQIiIzi7TIQ== X-Received: by 2002:a37:a981:: with SMTP id s123mr20951348qke.106.1591033856042; Mon, 01 Jun 2020 10:50:56 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 3/5] qemuxml2xmltest.c: add NUMA vcpus auto fill tests Date: Mon, 1 Jun 2020 14:50:39 -0300 Message-Id: <20200601175041.1607723-4-danielhb413@gmail.com> In-Reply-To: <20200601175041.1607723-1-danielhb413@gmail.com> References: <20200601175041.1607723-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , pkrempa@redhat.com 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.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add a unit test to verify the NUMA vcpus autocomplete implemented in the previous patch. Signed-off-by: Daniel Henrique Barboza --- .../numavcpus-topology-mismatch.xml | 37 ++++++++++++++++++ ...avcpus-topology-mismatch.x86_64-latest.xml | 38 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 3 files changed, 76 insertions(+) create mode 100644 tests/qemuxml2argvdata/numavcpus-topology-mismatch.xml create mode 100644 tests/qemuxml2xmloutdata/numavcpus-topology-mismatch.x8= 6_64-latest.xml diff --git a/tests/qemuxml2argvdata/numavcpus-topology-mismatch.xml b/tests= /qemuxml2argvdata/numavcpus-topology-mismatch.xml new file mode 100644 index 0000000000..d3b2c1297e --- /dev/null +++ b/tests/qemuxml2argvdata/numavcpus-topology-mismatch.xml @@ -0,0 +1,37 @@ + + dummy + 4d92ec27-9ebf-400b-ae91-20c71c647c19 + 16777216 + 7864320 + 3906240 + 12 + + + + + hvm + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + +
+ + + + + +
+ + + diff --git a/tests/qemuxml2xmloutdata/numavcpus-topology-mismatch.x86_64-la= test.xml b/tests/qemuxml2xmloutdata/numavcpus-topology-mismatch.x86_64-late= st.xml new file mode 100644 index 0000000000..2d2245b10c --- /dev/null +++ b/tests/qemuxml2xmloutdata/numavcpus-topology-mismatch.x86_64-latest.xml @@ -0,0 +1,38 @@ + + dummy + 4d92ec27-9ebf-400b-ae91-20c71c647c19 + 16777216 + 7864320 + 3906240 + 12 + + + + + hvm + + + + qemu64 + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + +
+ + + + + +
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index dcc7b29ded..3e434a6cbe 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -553,6 +553,7 @@ mymain(void) DO_TEST("vcpu-placement-static", QEMU_CAPS_KVM, QEMU_CAPS_OBJECT_IOTHREAD); + DO_TEST_CAPS_LATEST("numavcpus-topology-mismatch"); =20 DO_TEST("smp", NONE); DO_TEST("iothreads", NONE); --=20 2.26.2 From nobody Mon May 6 12:57:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; 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 205.139.110.61 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=1591033892; cv=none; d=zohomail.com; s=zohoarc; b=SF5OGvPuV49bAWiSbXCguUMDvKYoTqNctAVx+wxxolyTwX97KiOlebo/ZleMcZZhbjJMwsGLQKPil7SHM9fVXMCn6acKQ7FMo9zTLOR/4qnStHIL4+WYOuhfp/P8kOGMbqULek1WjYGKbgbv8mhKKy8bnRm+w9O7bS97RQCU7MQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591033892; 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=oyoweYgjxl6ow5ptUiOOp7W4ibUGB3UfMixo26dLKx8=; b=mX3BULjm3amm5/U/X3J0oixwuyDV270GUkO3e6oW9jtQruaVyadjiouNXHIZbMBbCqVxL2stra3Q9DKygnMe61vIp/23mq062oCrzvrmCfUta2P15A2gR9G2gExKNXRO31LYh52XmTxgB94U46anxpDfCAMxVX7iidoXW1CuFFc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1591033892694882.7509024429326; Mon, 1 Jun 2020 10:51:32 -0700 (PDT) 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-12-V0giwswvPTuFW1-IenEeaw-1; Mon, 01 Jun 2020 13:51:28 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D33D100A8EC; Mon, 1 Jun 2020 17:51:23 +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 3A8E07A8A6; Mon, 1 Jun 2020 17:51:23 +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 E25611809547; Mon, 1 Jun 2020 17:51:21 +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 051Hp1cY009393 for ; Mon, 1 Jun 2020 13:51:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 929D920110C9; Mon, 1 Jun 2020 17:51:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C1342026E1C for ; Mon, 1 Jun 2020 17:51:01 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 E3B4E8007D4 for ; Mon, 1 Jun 2020 17:51:00 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-Ve6YcTqyNAuhLy7h3LFe8Q-1; Mon, 01 Jun 2020 13:50:58 -0400 Received: by mail-qt1-f194.google.com with SMTP id g18so8358600qtu.13; Mon, 01 Jun 2020 10:50:58 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:9da7:da03:b92e:aafb:831c]) by smtp.gmail.com with ESMTPSA id h22sm9519021qtk.63.2020.06.01.10.50.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 10:50:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591033891; 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=oyoweYgjxl6ow5ptUiOOp7W4ibUGB3UfMixo26dLKx8=; b=ZUSkFDlWNlPR+1MuGUz9VuKRL8rhbDiFziZGzYWTTUgJFRHIhWCIxrvyZYZwW8BYlPfvCz xM7Tm7mgcEZUeDoAom3lnRcUvGD7z+6pIVOozc5U8occ8tbqueH6F23kVIuTbnpey+1isa 9lN7BghNqQAW9IbwJGbVreLaRajJOPE= X-MC-Unique: V0giwswvPTuFW1-IenEeaw-1 X-MC-Unique: Ve6YcTqyNAuhLy7h3LFe8Q-1 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=oyoweYgjxl6ow5ptUiOOp7W4ibUGB3UfMixo26dLKx8=; b=iahrruS5EGTOV8rEYGCXvjpWEaayUv70eJA6KSfd2Gz1Tg7oETOuDJ2R49i4h3K+Nl zNwl/Hu1VJGr3SJ1F+nsosmzWAbzhwNDD9KZfiRdvfQtiTCcv/lbGvPaX9AtjC4tPoy1 AAIuTJqN6aa6O4kdrOeo/xes31F4m/HggpFBbx5Z9n51bCqOcLEQaosydNARdn6PeCg5 sv0PjP6Ckm+b8EpN2FCRe7CngKrPF7TfWlTzQD9hjL32BM0YDO5ZO5ragxMfxDyygjRI gKftwNgfc4sza6WKy8uw8zW5yOhDEiCRbCX+4YXk4z55p7RRp5kvRHRRJ6Rg5cXdu9qZ KgEg== X-Gm-Message-State: AOAM5317lxMGssdZ916XSujddsmmbfnqHkHxsgOvsIFoNUCeRYa658Sr LJ+mFTgehJHXUpxOD6Ag5pH3DJb4gG0= X-Google-Smtp-Source: ABdhPJyZYHZnODb9OdRCxjfW+KBPGpnrjn4RxtPaO9HnqiTtXkmJBmGiARhx2Xbg9M3k3hY1l05Gng== X-Received: by 2002:ac8:1381:: with SMTP id h1mr23929262qtj.195.1591033857612; Mon, 01 Jun 2020 10:50:57 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 4/5] formatdomain.html.in: document the NUMA cpus auto fill feature Date: Mon, 1 Jun 2020 14:50:40 -0300 Message-Id: <20200601175041.1607723-5-danielhb413@gmail.com> In-Reply-To: <20200601175041.1607723-1-danielhb413@gmail.com> References: <20200601175041.1607723-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , pkrempa@redhat.com 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.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We're not mentioning that we're replicating QEMU behavior on purpose. First because QEMU will one day, maybe, change the behavior and start to refuse incomplete NUMA setups, and then our documentation is now deprecated. Second, auto filling the CPUs in the first cell will work regardless of QEMU changes in the future. The idea is to encourage the user to provide a complete NUMA CPU topology, not relying on the CPU auto fill mechanic. Signed-off-by: Daniel Henrique Barboza --- docs/formatdomain.html.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 33cec1e6dd..0d1b34d7b2 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1787,7 +1787,16 @@

Each cell element specifies a NUMA cell or a NUMA node. cpus specifies the CPU or range of CPUs that are - part of the node. memory specifies the node memory + part of the node. Since 6.5.0 For the q= emu + driver, if the emulator binary supports disjointed cpus= ranges + in each cell, the sum of all CPUs declared in each cell + will be matched with the maximum number of virtual CPUs declared in = the + vcpu element. This is done by filling any remaining CPUs + into the first NUMA cell. Users are encouraged to suppl= y a + complete NUMA topology, where the sum of the NUMA CPUs matches the m= aximum + virtual CPUs number declared in vcpus, to make the doma= in + consistent across qemu and libvirt versions. + memory specifies the node memory in kibibytes (i.e. blocks of 1024 bytes). Since 1.2.11 one can use an additional = unit attribu= te to --=20 2.26.2 From nobody Mon May 6 12:57:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1591034142; cv=none; d=zohomail.com; s=zohoarc; b=BfLBdXmQj6axirFdg6Miq9nB8rmIp2ZqPYiWvurHEyZfSn2+6n0AgzuunfEr02Er8h0AYTKQDENUps23uSZ5jipYrrO/+GQ+0NDHabtbCafJbfbnQUHDZFE8BAhfRurUSWElJsApwjEQQ6fGE6cZYQ4/yKFaSWo0AVd2BrdTC5o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591034142; 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=JKT59lsVEgpivLUax0U03O5BZl5mbag7uXCJS8dZ66E=; b=SYzoMSLFai1fyunxzzaj69OONs4nN2xHNpmkG3iiDAOw6OmsfgO6oZi3XXe4vLc9SQ5ZNCm+e2CMkaEEmPqSBjSzE5OThlAx0dm20D2+O/w7Dwy0uns/DyuZCuKSOt1MpDlZD4EDbCF1S9MdnDv24V/YiyAAIDlnlus2JR9FAUc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1591034142556210.7931779852587; Mon, 1 Jun 2020 10:55:42 -0700 (PDT) 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-177-7umh1PFNP0m0S7wzuG52HQ-1; Mon, 01 Jun 2020 13:55:39 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E60C100CCC0; Mon, 1 Jun 2020 17:55:34 +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 66B9A5C1B2; Mon, 1 Jun 2020 17:55:33 +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 875CE180954D; Mon, 1 Jun 2020 17:55:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 051Hp2mQ009408 for ; Mon, 1 Jun 2020 13:51:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id BC44D2156A2D; Mon, 1 Jun 2020 17:51:02 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B8AD92157F25 for ; Mon, 1 Jun 2020 17:51:02 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 9F8508007D4 for ; Mon, 1 Jun 2020 17:51:02 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-158-703ZN9S4OeGKRETNxIvTeQ-1; Mon, 01 Jun 2020 13:51:00 -0400 Received: by mail-qt1-f195.google.com with SMTP id b11so8411617qtt.3; Mon, 01 Jun 2020 10:51:00 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:9da7:da03:b92e:aafb:831c]) by smtp.gmail.com with ESMTPSA id h22sm9519021qtk.63.2020.06.01.10.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 10:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591034141; 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=JKT59lsVEgpivLUax0U03O5BZl5mbag7uXCJS8dZ66E=; b=MPFahwfQefRFLfKTlTL+pz/4WkpQZpz3mZNNx9vMPys8n7kVQCBX5fdT8jCCXTMgPN7Ciw CwGMAv7bUg01lQe9bdBW+c4jclrP8EJ9jBY5oamU5ASfK+7Rj41Ki5e7MVfCpPZc2lHi/o 1DwIYFCYlkHPh9ny5l5jtIO7rKsepWA= X-MC-Unique: 7umh1PFNP0m0S7wzuG52HQ-1 X-MC-Unique: 703ZN9S4OeGKRETNxIvTeQ-1 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=JKT59lsVEgpivLUax0U03O5BZl5mbag7uXCJS8dZ66E=; b=GKreThLedhplh95gntSdump2ZHbgdRpczXzOYbJ6LVmOJyJ3Lh32cHhl2BXQLTakyE OlbX3N3wEGEwgBvTMWJRVVRTGfOCepjdSiY3BBf3vkKShQNjc3eAG74FRRWs02FDl5Hs 3KGfrPCAddcT8or5/V1E/yVssnEnJa+3+U/VGCFZRgI00LE6bL0BI5g178hWNVY2tDfE dDGQTFgzeDPXE4cDLhg8NlgUXN0wvSFxtT63hEhDGqp0P8wFSGd4zVnebbXALtQRIlHi hGA6AO32QErYt3cto4ypUw/BjL+7OCqkr/zVFqruzQ+buk7DqQatdgbw84F0ZFVpIrU/ HG/g== X-Gm-Message-State: AOAM533O0krbiq57AP2nzkALarjD+hs9edCp45AdhIbfaqQQS2te42x+ oSe9wZZqiYCYM8lbcnP1N4Dulm/Ats4= X-Google-Smtp-Source: ABdhPJwy8TH1bH2sj+AAqr4b1cWl+NVHLlRtZfzCclR8fIv1gtkKMqHduvZcyd/FM2hSFqEmJhJL2A== X-Received: by 2002:ac8:1416:: with SMTP id k22mr22957914qtj.205.1591033859510; Mon, 01 Jun 2020 10:50:59 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 5/5] qemu_validate.c: revert NUMA CPU range user warning Date: Mon, 1 Jun 2020 14:50:41 -0300 Message-Id: <20200601175041.1607723-6-danielhb413@gmail.com> In-Reply-To: <20200601175041.1607723-1-danielhb413@gmail.com> References: <20200601175041.1607723-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , pkrempa@redhat.com, "Maxiwell S . Garcia" 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.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Now that we have the auto-fill code in place, and with proper documentation to let the user know that (1) we will auto-fill the NUMA cpus up to the number to maximum VCPUs number if QEMU supports it and (2) the user is advised to always supply a complete NUMA topology, this warning is unneeded. This reverts commit 38d2e033686b5cc274f8f55075ce1985b71e329a. CC: Maxiwell S. Garcia Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_validate.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 584d1375b8..14d614934d 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -895,24 +895,15 @@ qemuValidateDomainDef(const virDomainDef *def, if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS)) { unsigned int topologycpus; unsigned int granularity; - unsigned int numacpus; =20 /* Starting from QEMU 2.5, max vCPU count and overall vCPU topology * must agree. We only actually enforce this with QEMU 2.7+, due * to the capability check above */ - if (virDomainDefGetVcpusTopology(def, &topologycpus) =3D=3D 0) { - if (topologycpus !=3D virDomainDefGetVcpusMax(def)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("CPU topology doesn't match maximum vcpu = count")); - return -1; - } - - numacpus =3D virDomainNumaGetCPUCountTotal(def->numa); - if ((numacpus !=3D 0) && (topologycpus !=3D numacpus)) { - VIR_WARN("CPU topology doesn't match numa CPU count; " - "partial NUMA mapping is obsoleted and will " - "be removed in future"); - } + if (virDomainDefGetVcpusTopology(def, &topologycpus) =3D=3D 0 && + topologycpus !=3D virDomainDefGetVcpusMax(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("CPU topology doesn't match maximum vcpu coun= t")); + return -1; } =20 /* vCPU hotplug granularity must be respected */ --=20 2.26.2