From nobody Tue Feb 10 13:17:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=cl.cam.ac.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1658224418143383.1007340042422; Tue, 19 Jul 2022 02:53:38 -0700 (PDT) Received: from localhost ([::1]:33036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDjv7-0007wm-3P for importer@patchew.org; Tue, 19 Jul 2022 05:53:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDjsB-0003Zs-Nr; Tue, 19 Jul 2022 05:50:35 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:37642) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDjs8-0003ZU-NO; Tue, 19 Jul 2022 05:50:35 -0400 Received: by mail-wm1-x329.google.com with SMTP id c187-20020a1c35c4000000b003a30d88fe8eso7440574wma.2; Tue, 19 Jul 2022 02:50:31 -0700 (PDT) Received: from localhost.localdomain ([86.188.218.117]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c3b9e00b003a2ed2a40e4sm21343573wms.17.2022.07.19.02.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 02:50:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j1h9zPDvkG8il+pIfLNS6XUWKh8jK8dtTd9R/r27J0c=; b=Fz8n6Shd+zp3KXKXIYxQ3OEjhZcVykCcH1d2VoLy20T9upTB1wKejNpgn2Wvc1ns0B vAl6v2BJoWTDA5KvSopvmiS4JcJCjMS2wYqGtF0+WMEEMlLXqa877BBAqgCYinrNvnPv 6f1SY65eHs6fn3UwDmML7UbhBPe2mkMemBHvBLxLVVm/HhEaJv3RF2ZxT90+PzSyJiF9 enYVBCcVAe43kzhLU2/dzwlrE4vRzggJGbyMCg5TMBnDE+bpLgjJBG6wS4IKjzapzeCZ swMa334noonPNl8o1a/7gLGhwyqvWcfDPJuo2dxFeQUmhjuHw4r4irPEiipQSpdvHr5b 70tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=j1h9zPDvkG8il+pIfLNS6XUWKh8jK8dtTd9R/r27J0c=; b=uL2SK0O4GvVoCeajIbkloY7K6m4kYlNFI0/CD5TrhfY28GC3VQ+g1wcg9cKeDn+nAc Lun/57tQgX+ff5/a213NJ81RymsjI+MtkhiObMTz+fJmw6NMBiwKjiBktux6ANfFWgLo 29UoH5kPpMOKsa6RzrYFzOqI+7S5UpJWKWg9AMG6WGLz3EDSxdDYjhOKsEOjv0ioz1rR CEc1Rc/DZ6ygR3buV3SYRZaiEcy4hcXObCZKjeDoCbsW0KxyAjPbgV7oQjQnMdEbxmXB K9P9I1NqZmG5upP6rGgjq0/yh8VvM8ysvimLw4ICmRCX1D60ARUuH5pIUrWtMytsEUPv r0pA== X-Gm-Message-State: AJIora+LD3dR8FOfweT/sJzisR1gifx6Wyc0oEqDhW595j9GrKY/EkIP +Eu1fWgbIRQgZmnz/5iecw8= X-Google-Smtp-Source: AGRyM1tBix3tDOfyHwn2mPHkMzYatPoGP+8hBID3L9v+Sebt4cq/1v55giTnVGTtctnTaky82jlfYw== X-Received: by 2002:a05:600c:17d0:b0:3a3:1b2d:ca44 with SMTP id y16-20020a05600c17d000b003a31b2dca44mr8093142wmo.100.1658224230952; Tue, 19 Jul 2022 02:50:30 -0700 (PDT) From: Hesham Almatary X-Google-Original-From: Hesham Almatary To: jonathan.cameron@huawei.com, qemu-devel@nongnu.org Cc: yangyicong@huawei.com, chenxiang66@hisilicon.com, linuxarm@huawei.com, qemu-arm@nongnu.org, peter.maydell@linaro.org, imammedo@redhat.com, wangyanan55@huawei.com, marcel.apfelbaum@gmail.com, eduardo@habkost.net, Brice.Goglin@inria.fr, mst@redhat.com, jingqi.liu@intel.com Subject: [PATCH v2 1/8] hmat acpi: Don't require initiator value in -numa Date: Tue, 19 Jul 2022 10:49:43 +0100 Message-Id: <20220719094950.1049516-2-hesham.almatary@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220719094950.1049516-1-hesham.almatary@huawei.com> References: <20220719094950.1049516-1-hesham.almatary@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=heshamelmatary@gmail.com; helo=mail-wm1-x329.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1658224419184100001 Content-Type: text/plain; charset="utf-8" From: Brice Goglin The "Memory Proximity Domain Attributes" structure of the ACPI HMAT has a "Processor Proximity Domain Valid" flag that is currently always set because Qemu -numa requires an initiator=3DX value when hmat=3Don. Unsetting this flag allows to create more complex memory topologies by having multiple best initiators for a single memory target. This patch allows -numa without initiator=3DX when hmat=3Don by keeping the default value MAX_NODES in numa_state->nodes[i].initiator. All places reading numa_state->nodes[i].initiator already check whether it's different from MAX_NODES before using it. Tested with qemu-system-x86_64 -accel kvm \ -machine pc,hmat=3Don \ -drive if=3Dpflash,format=3Draw,file=3D./OVMF.fd \ -drive media=3Ddisk,format=3Dqcow2,file=3Defi.qcow2 \ -smp 4 \ -m 3G \ -object memory-backend-ram,size=3D1G,id=3Dram0 \ -object memory-backend-ram,size=3D1G,id=3Dram1 \ -object memory-backend-ram,size=3D1G,id=3Dram2 \ -numa node,nodeid=3D0,memdev=3Dram0,cpus=3D0-1 \ -numa node,nodeid=3D1,memdev=3Dram1,cpus=3D2-3 \ -numa node,nodeid=3D2,memdev=3Dram2 \ -numa hmat-lb,initiator=3D0,target=3D0,hierarchy=3Dmemory,data-type=3Dacce= ss-latency,latency=3D10 \ -numa hmat-lb,initiator=3D0,target=3D0,hierarchy=3Dmemory,data-type=3Dacce= ss-bandwidth,bandwidth=3D10485760 \ -numa hmat-lb,initiator=3D0,target=3D1,hierarchy=3Dmemory,data-type=3Dacce= ss-latency,latency=3D20 \ -numa hmat-lb,initiator=3D0,target=3D1,hierarchy=3Dmemory,data-type=3Dacce= ss-bandwidth,bandwidth=3D5242880 \ -numa hmat-lb,initiator=3D0,target=3D2,hierarchy=3Dmemory,data-type=3Dacce= ss-latency,latency=3D30 \ -numa hmat-lb,initiator=3D0,target=3D2,hierarchy=3Dmemory,data-type=3Dacce= ss-bandwidth,bandwidth=3D1048576 \ -numa hmat-lb,initiator=3D1,target=3D0,hierarchy=3Dmemory,data-type=3Dacce= ss-latency,latency=3D20 \ -numa hmat-lb,initiator=3D1,target=3D0,hierarchy=3Dmemory,data-type=3Dacce= ss-bandwidth,bandwidth=3D5242880 \ -numa hmat-lb,initiator=3D1,target=3D1,hierarchy=3Dmemory,data-type=3Dacce= ss-latency,latency=3D10 \ -numa hmat-lb,initiator=3D1,target=3D1,hierarchy=3Dmemory,data-type=3Dacce= ss-bandwidth,bandwidth=3D10485760 \ -numa hmat-lb,initiator=3D1,target=3D2,hierarchy=3Dmemory,data-type=3Dacce= ss-latency,latency=3D30 \ -numa hmat-lb,initiator=3D1,target=3D2,hierarchy=3Dmemory,data-type=3Dacce= ss-bandwidth,bandwidth=3D1048576 which reports NUMA node2 at same distance from both node0 and node1 as seen= in lstopo: Machine (2966MB total) + Package P#0 NUMANode P#2 (979MB) Group0 NUMANode P#0 (980MB) Core P#0 + PU P#0 Core P#1 + PU P#1 Group0 NUMANode P#1 (1007MB) Core P#2 + PU P#2 Core P#3 + PU P#3 Before this patch, we had to add ",initiator=3DX" to "-numa node,nodeid=3D2= ,memdev=3Dram2". The lstopo output difference between initiator=3D1 and no initiator is: @@ -1,10 +1,10 @@ Machine (2966MB total) + Package P#0 + NUMANode P#2 (979MB) Group0 NUMANode P#0 (980MB) Core P#0 + PU P#0 Core P#1 + PU P#1 Group0 NUMANode P#1 (1007MB) - NUMANode P#2 (979MB) Core P#2 + PU P#2 Core P#3 + PU P#3 Corresponding changes in the HMAT MPDA structure: @@ -49,10 +49,10 @@ [078h 0120 2] Structure Type : 0000 [Memory Proximity Doma= in Attributes] [07Ah 0122 2] Reserved : 0000 [07Ch 0124 4] Length : 00000028 -[080h 0128 2] Flags (decoded below) : 0001 - Processor Proximity Domain Valid : 1 +[080h 0128 2] Flags (decoded below) : 0000 + Processor Proximity Domain Valid : 0 [082h 0130 2] Reserved1 : 0000 -[084h 0132 4] Attached Initiator Proximity Domain : 00000001 +[084h 0132 4] Attached Initiator Proximity Domain : 00000080 [088h 0136 4] Memory Proximity Domain : 00000002 [08Ch 0140 4] Reserved2 : 00000000 [090h 0144 8] Reserved3 : 0000000000000000 Final HMAT SLLB structures: [0A0h 0160 2] Structure Type : 0001 [System Locality Latenc= y and Bandwidth Information] [0A2h 0162 2] Reserved : 0000 [0A4h 0164 4] Length : 00000040 [0A8h 0168 1] Flags (decoded below) : 00 Memory Hierarchy : 0 [0A9h 0169 1] Data Type : 00 [0AAh 0170 2] Reserved1 : 0000 [0ACh 0172 4] Initiator Proximity Domains # : 00000002 [0B0h 0176 4] Target Proximity Domains # : 00000003 [0B4h 0180 4] Reserved2 : 00000000 [0B8h 0184 8] Entry Base Unit : 0000000000002710 [0C0h 0192 4] Initiator Proximity Domain List : 00000000 [0C4h 0196 4] Initiator Proximity Domain List : 00000001 [0C8h 0200 4] Target Proximity Domain List : 00000000 [0CCh 0204 4] Target Proximity Domain List : 00000001 [0D0h 0208 4] Target Proximity Domain List : 00000002 [0D4h 0212 2] Entry : 0001 [0D6h 0214 2] Entry : 0002 [0D8h 0216 2] Entry : 0003 [0DAh 0218 2] Entry : 0002 [0DCh 0220 2] Entry : 0001 [0DEh 0222 2] Entry : 0003 [0E0h 0224 2] Structure Type : 0001 [System Locality Latenc= y and Bandwidth Information] [0E2h 0226 2] Reserved : 0000 [0E4h 0228 4] Length : 00000040 [0E8h 0232 1] Flags (decoded below) : 00 Memory Hierarchy : 0 [0E9h 0233 1] Data Type : 03 [0EAh 0234 2] Reserved1 : 0000 [0ECh 0236 4] Initiator Proximity Domains # : 00000002 [0F0h 0240 4] Target Proximity Domains # : 00000003 [0F4h 0244 4] Reserved2 : 00000000 [0F8h 0248 8] Entry Base Unit : 0000000000000001 [100h 0256 4] Initiator Proximity Domain List : 00000000 [104h 0260 4] Initiator Proximity Domain List : 00000001 [108h 0264 4] Target Proximity Domain List : 00000000 [10Ch 0268 4] Target Proximity Domain List : 00000001 [110h 0272 4] Target Proximity Domain List : 00000002 [114h 0276 2] Entry : 000A [116h 0278 2] Entry : 0005 [118h 0280 2] Entry : 0001 [11Ah 0282 2] Entry : 0005 [11Ch 0284 2] Entry : 000A [11Eh 0286 2] Entry : 0001 Signed-off-by: Brice Goglin Signed-off-by: Hesham Almatary Reviewed-by: Jingqi Liu --- hw/core/machine.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index a673302cce..d4d7e77401 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1173,9 +1173,7 @@ static void numa_validate_initiator(NumaState *numa_s= tate) =20 for (i =3D 0; i < numa_state->num_nodes; i++) { if (numa_info[i].initiator =3D=3D MAX_NODES) { - error_report("The initiator of NUMA node %d is missing, use " - "'-numa node,initiator' option to declare it", i); - exit(1); + continue; } =20 if (!numa_info[numa_info[i].initiator].present) { --=20 2.25.1