From nobody Wed Nov 5 07:04:28 2025 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533321340304941.0200735800294; Fri, 3 Aug 2018 11:35:40 -0700 (PDT) Received: from localhost ([::1]:52689 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1flevI-0002W6-AR for importer@patchew.org; Fri, 03 Aug 2018 14:35:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1flesO-0000Tp-14 for qemu-devel@nongnu.org; Fri, 03 Aug 2018 14:32:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1flesL-00059G-AO for qemu-devel@nongnu.org; Fri, 03 Aug 2018 14:32:36 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43296 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 1flesL-00058y-3j for qemu-devel@nongnu.org; Fri, 03 Aug 2018 14:32:33 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id 9F2FB7A7EF; Fri, 3 Aug 2018 18:32:32 +0000 (UTC) Received: from redhat.com (ovpn-117-153.ams2.redhat.com [10.36.117.153]) by smtp.corp.redhat.com (Postfix) with SMTP id D716910F1BEC; Fri, 3 Aug 2018 18:32:30 +0000 (UTC) Date: Fri, 3 Aug 2018 21:32:30 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <20180803182100.874220-2-mst@redhat.com> References: <20180803182100.874220-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180803182100.874220-1-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 03 Aug 2018 18:32:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 03 Aug 2018 18:32:32 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@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] [PULL alternative 1/2] pc: acpi: fix memory hotplug regression by reducing stub SRAT entry size 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: Peter Maydell , Eduardo Habkost , Igor Mammedov , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Commit 848a1cc1e (hw/acpi-build: build SRAT memory affinity structures for = DIMM devices) broke the first dimm hotplug in following cases: 1: there is no coldplugged dimm in the last numa node but there is a coldplugged dimm in another node -m 4096,slots=3D4,maxmem=3D32G \ -object memory-backend-ram,id=3Dm0,size=3D2G \ -device pc-dimm,memdev=3Dm0,node=3D0 \ -numa node,nodeid=3D0 \ -numa node,nodeid=3D1 2: if order of dimms on CLI is: 1st plugged dimm in node1 2nd plugged dimm in node0 -m 4096,slots=3D4,maxmem=3D32G \ -object memory-backend-ram,size=3D2G,id=3Dm0 \ -device pc-dimm,memdev=3Dm0,node=3D1 \ -object memory-backend-ram,id=3Dm1,size=3D2G \ -device pc-dimm,memdev=3Dm1,node=3D0 \ -numa node,nodeid=3D0 \ -numa node,nodeid=3D1 (qemu) object_add memory-backend-ram,id=3Dm2,size=3D1G (qemu) device_add pc-dimm,memdev=3Dm2,node=3D0 the first DIMM hotplug to any node except the last one fails (Windows is unable to online it). Length reduction of stub hotplug memory SRAT entry, fixes issue for some reason. RHBZ: 1609234 Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 9e8350c55d..b52fdb205c 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2269,7 +2269,16 @@ static void build_srat_hotpluggable_memory(GArray *t= able_data, uint64_t base, numamem =3D acpi_data_push(table_data, sizeof *numamem); =20 if (!info) { - build_srat_memory(numamem, cur, end - cur, default_node, + /* + * Entry is required for Windows to enable memory hotplug in OS + * and for Linux to enable SWIOTLB when booted with less than + * 4G of RAM. Windows works better if the entry sets proximity + * to the highest NUMA node in the machine at the end of the + * reserved space. + * Memory devices may override proximity set by this entry, + * providing _PXM method if necessary. + */ + build_srat_memory(numamem, end - 1, 1, default_node, MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENA= BLED); break; } @@ -2402,14 +2411,6 @@ build_srat(GArray *table_data, BIOSLinker *linker, M= achineState *machine) build_srat_memory(numamem, 0, 0, 0, MEM_AFFINITY_NOFLAGS); } =20 - /* - * Entry is required for Windows to enable memory hotplug in OS - * and for Linux to enable SWIOTLB when booted with less than - * 4G of RAM. Windows works better if the entry sets proximity - * to the highest NUMA node in the machine. - * Memory devices may override proximity set by this entry, - * providing _PXM method if necessary. - */ if (hotplugabble_address_space_size) { build_srat_hotpluggable_memory(table_data, machine->device_memory-= >base, hotplugabble_address_space_size, --=20 MST