From nobody Sun Feb 8 06:55:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530176496126485.65683907657103; Thu, 28 Jun 2018 02:01:36 -0700 (PDT) Received: from localhost ([::1]:35144 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYSnt-0001NZ-QO for importer@patchew.org; Thu, 28 Jun 2018 05:01:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42110) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYSmq-00011b-0o for qemu-devel@nongnu.org; Thu, 28 Jun 2018 05:00:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYSml-0008IM-1b for qemu-devel@nongnu.org; Thu, 28 Jun 2018 05:00:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55698 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fYSmk-0008Ho-RY for qemu-devel@nongnu.org; Thu, 28 Jun 2018 05:00:14 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 855A28A9EF; Thu, 28 Jun 2018 09:00:13 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-166.ams2.redhat.com [10.36.116.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1F4521565E1; Thu, 28 Jun 2018 09:00:11 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 28 Jun 2018 11:00:11 +0200 Message-Id: <20180628090011.14879-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 28 Jun 2018 09:00:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 28 Jun 2018 09:00:13 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'david@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2] numa: report all DIMM/NVDIMMs as plugged in "info numa" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eugene Crosser , Vadim Galitsyn , David Hildenbrand , Markus Armbruster , "Dr . David Alan Gilbert" , Igor Mammedov , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Right now, there is some inconsistency between hotplugged and coldplugged memory. DIMMs added via "-device" result in different stats than DIMMs added using "device_add". E.g. with the following QEMU cmdline: [...] -numa node,nodeid=3D0,cpus=3D0-1 -numa node,nodeid=3D1,cpus=3D2-3 \ -m 4G,maxmem=3D20G,slots=3D2 \ -object memory-backend-ram,id=3Dmem0,size=3D8G \ -device pc-dimm,id=3Ddimm0,memdev=3Dmem0 \ -object memory-backend-ram,id=3Dmem1,size=3D8G \ -device nvdimm,id=3Ddimm1,memdev=3Dmem1,node=3D1 "info memory_size_summary" will correctly report: (qemu) info memory_size_summary info memory_size_summary base memory: 4294967296 plugged memory: 17179869184 While "info numa" will not report DIMM/NVDIMMs as (cold)plugged memory. (qemu) info numa info numa 2 nodes node 0 cpus: 0 1 node 0 size: 10240 MB node 0 plugged: 0 MB node 1 cpus: 2 3 node 1 size: 10240 MB node 1 plugged: 0 MB Make this consistent by reporting all hot and coldplugged memory a.k.a. DIMM and NVDIMM as "plugged". With this change, the output of "info numa" is now: (qemu) info numa info numa 2 nodes node 0 cpus: 0 1 node 0 size: 10240 MB node 0 plugged: 8192 MB node 1 cpus: 2 3 node 1 size: 10240 MB node 1 plugged: 8192 MB Fixes: 31959e82fb0 ("hmp: extend "info numa" with hotplugged memory informa= tion") Signed-off-by: David Hildenbrand Reviewed-by: Igor Mammedov --- v1 -> v2: - Tweaked patch description/sibject as requested by Igor. numa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/numa.c b/numa.c index 94f758c757..5f6367b989 100644 --- a/numa.c +++ b/numa.c @@ -566,10 +566,8 @@ static void numa_stat_memory_devices(NumaNodeMem node_= mem[]) =20 if (pcdimm_info) { node_mem[pcdimm_info->node].node_mem +=3D pcdimm_info->siz= e; - if (pcdimm_info->hotpluggable && pcdimm_info->hotplugged) { - node_mem[pcdimm_info->node].node_plugged_mem +=3D - pcdimm_info->size; - } + node_mem[pcdimm_info->node].node_plugged_mem +=3D + pcdimm_info->size; } } } --=20 2.17.1