From nobody Sun May 5 15:27:25 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1616179010; cv=none; d=zohomail.com; s=zohoarc; b=B+Yy+0bzKvjnUKnHi8SkYhbM5c88ZE/1JioNBinu7Xr9KLVxgu5qlcUXhZMV282sUXuNaT5HzmRvf7av/gW1peheAhHbuKpCkZFS7Qcbg0RjMAw/LDOS0z+dwpc+mZlHnGv/7KzdLWjfS7HlA7a/zaV2vZuHy05b3uZB5jLxCrY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616179010; 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=sotOSsWnAz4To0zpBnLwPpV7rZV2rpBOr+pDhZjHwAc=; b=NUqMiDF4/JxAOlv76At6HnLB5FcnbxPqkvC0vq/ziW2Qy4tDi9jiyRBXyC3cYDGa/F16bzrLwD3Liz3EbqlVgDsAP4fm5pLJMT7J0B7ggDIQboFU21t5uh9uUXIWEgX5jKvnZEuHFfTkBMU0HHnMOnfOLRLJSUbBl7oNgE4FMPU= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1616179010354719.3911855251699; Fri, 19 Mar 2021 11:36:50 -0700 (PDT) Received: from localhost ([::1]:39668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lNJzM-0008Hy-Ts for importer@patchew.org; Fri, 19 Mar 2021 14:36:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNJxt-00074k-Ld; Fri, 19 Mar 2021 14:35:18 -0400 Received: from mail-qk1-x730.google.com ([2607:f8b0:4864:20::730]:40808) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lNJxo-0006aA-Lv; Fri, 19 Mar 2021 14:35:17 -0400 Received: by mail-qk1-x730.google.com with SMTP id 7so3956517qka.7; Fri, 19 Mar 2021 11:35:11 -0700 (PDT) Received: from localhost.localdomain ([2804:431:c7c7:cc80:21a:fa87:b9b8:5376]) by smtp.gmail.com with ESMTPSA id r35sm2660225qtd.95.2021.03.19.11.35.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 11:35:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sotOSsWnAz4To0zpBnLwPpV7rZV2rpBOr+pDhZjHwAc=; b=kuM8w6S4DeEyLAb2fPzyeKLASQY+6nSUnUu/FCLhkqOvgJBRhs2r+lMy/tPJ68BPxB mMybCdjikEFLW6v0CqEjrJ9cbfxP85zvaPbsfyL5rd/lSqQvvWolZG11ceH9YEN6BT+1 r1P1g6DxdXBYh0sta8oBsaDKewxUDiGI+H/0my6YBMahyyH8KoWGlz7pqe+sswgxCLcT LWDTDaFaI88EIarv4hXdscPG13gAI7Kul93zsyZAgSpzJ+xTSFyh1M9YTAUDpSqb+xZF Lf1qRH6rX1rar4y1gxK70vs8OrhwTSWLKDmtK3PAR3kdqMhekGZwTShsvhoYrsiYAS6R 3G5g== 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=sotOSsWnAz4To0zpBnLwPpV7rZV2rpBOr+pDhZjHwAc=; b=GEIU/qXaCWWDYqeqcGfqI+/7hfbrUxVnZwSaPnhODzZLKqhnjHNniIMHVI2XuyM2PE myBHvD35q3xTKz9HuWeT3/Vq83L1c89yP6Bht1WahpiB51iVj112fJuABvPIldfn3LOR k78SixIYhCFUgEsFsarSraRIrd83I/INw7Ee9bagGIxXJgctBYO1YyCHGCWUBeTnzBjB xwygegvYlhQVN6Zb4R2EA2Herur47wcghJndtVkUacMUnqREvpw0KcGAuE1X4pOMlmSe zjoCtMQq83GSE+x90J5NXM/ChXrvafTCsAE2zb0LyYMZ9xz6RGQW9ilQlk1fOZtiegFu 2zCg== X-Gm-Message-State: AOAM530lH4MI3YTvscsYbDYdui0LzRcTKDjGRb4LsbQuBzl9suUDuct0 GhPz275W13Le2AVqitdb0qJZA4n9f4Q= X-Google-Smtp-Source: ABdhPJwOtsvfKAYQhAXnK3uI/DcqxFz3TeUS1Y0XPK7VFNiYtvmM5gvn8hOGbinhGIEzgpIZJly7AA== X-Received: by 2002:a37:a715:: with SMTP id q21mr10487728qke.309.1616178910884; Fri, 19 Mar 2021 11:35:10 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 1/2] spapr: number of SMP sockets must be equal to NUMA nodes Date: Fri, 19 Mar 2021 15:34:52 -0300 Message-Id: <20210319183453.4466-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210319183453.4466-1-danielhb413@gmail.com> References: <20210319183453.4466-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2607:f8b0:4864:20::730; envelope-from=danielhb413@gmail.com; helo=mail-qk1-x730.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , Srikar Dronamraju , Daniel Henrique Barboza , groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, Igor Mammedov , david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Kernel commit 4bce545903fa ("powerpc/topology: Update topology_core_cpumask") cause a regression in the pseries machine when defining certain SMP topologies [1]. The reasoning behind the change is explained in kernel commit 4ca234a9cbd7 ("powerpc/smp: Stop updating cpu_core_mask"). In short, cpu_core_mask logic was causing troubles with large VMs with lots of CPUs and was changed by cpu_cpu_mask because, as far as the kernel understanding of SMP topologies goes, both masks are equivalent. Further discussions in the kernel mailing list [2] shown that the powerpc kernel always considered that the number of sockets were equal to the number of NUMA nodes. The claim is that it doesn't make sense, for Power hardware at least, 2+ sockets being in the same NUMA node. The immediate conclusion is that all SMP topologies the pseries machine were supplying to the kernel, with more than one socket in the same NUMA node as in [1], happened to be correctly represented in the kernel by accident during all these years. There's a case to be made for virtual topologies being detached from hardware constraints, allowing maximum flexibility to users. At the same time, this freedom can't result in unrealistic hardware representations being emulated. If the real hardware and the pseries kernel don't support multiple chips/sockets in the same NUMA node, neither should we. Starting in 6.0.0, all sockets must match an unique NUMA node in the pseries machine. qtest changes were made to adapt to this new condition. [1] https://bugzilla.redhat.com/1934421 [2] https://lore.kernel.org/linuxppc-dev/daa5d05f-dbd0-05ad-7395-5d5a3d364f= c6@gmail.com/ CC: Srikar Dronamraju CC: C=C3=A9dric Le Goater CC: Igor Mammedov CC: Laurent Vivier CC: Thomas Huth Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr.c | 3 ++ hw/ppc/spapr_numa.c | 7 +++++ include/hw/ppc/spapr.h | 1 + tests/qtest/cpu-plug-test.c | 4 +-- tests/qtest/device-plug-test.c | 9 +++++- tests/qtest/numa-test.c | 52 ++++++++++++++++++++++++++++------ 6 files changed, 64 insertions(+), 12 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index d56418ca29..745f71c243 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4611,8 +4611,11 @@ DEFINE_SPAPR_MACHINE(6_0, "6.0", true); */ static void spapr_machine_5_2_class_options(MachineClass *mc) { + SpaprMachineClass *smc =3D SPAPR_MACHINE_CLASS(mc); + spapr_machine_6_0_class_options(mc); compat_props_add(mc->compat_props, hw_compat_5_2, hw_compat_5_2_len); + smc->pre_6_0_smp_topology =3D true; } =20 DEFINE_SPAPR_MACHINE(5_2, "5.2", false); diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index 779f18b994..0ade43dd79 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -163,6 +163,13 @@ void spapr_numa_associativity_init(SpaprMachineState *= spapr, int i, j, max_nodes_with_gpus; bool using_legacy_numa =3D spapr_machine_using_legacy_numa(spapr); =20 + if (!smc->pre_6_0_smp_topology && + nb_numa_nodes !=3D machine->smp.sockets) { + error_report("Number of CPU sockets must be equal to the number " + "of NUMA nodes"); + exit(EXIT_FAILURE); + } + /* * For all associativity arrays: first position is the size, * position MAX_DISTANCE_REF_POINTS is always the numa_id, diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 47cebaf3ac..98dc5d198a 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -142,6 +142,7 @@ struct SpaprMachineClass { hwaddr rma_limit; /* clamp the RMA to this size */ bool pre_5_1_assoc_refpoints; bool pre_5_2_numa_associativity; + bool pre_6_0_smp_topology; =20 bool (*phb_placement)(SpaprMachineState *spapr, uint32_t index, uint64_t *buid, hwaddr *pio, diff --git a/tests/qtest/cpu-plug-test.c b/tests/qtest/cpu-plug-test.c index a1c689414b..946b9129ea 100644 --- a/tests/qtest/cpu-plug-test.c +++ b/tests/qtest/cpu-plug-test.c @@ -118,8 +118,8 @@ static void add_pseries_test_case(const char *mname) data->machine =3D g_strdup(mname); data->cpu_model =3D "power8_v2.0"; data->device_model =3D g_strdup("power8_v2.0-spapr-cpu-core"); - data->sockets =3D 2; - data->cores =3D 3; + data->sockets =3D 1; + data->cores =3D 6; data->threads =3D 1; data->maxcpus =3D data->sockets * data->cores * data->threads; =20 diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c index 559d47727a..dd7d8268d2 100644 --- a/tests/qtest/device-plug-test.c +++ b/tests/qtest/device-plug-test.c @@ -91,7 +91,14 @@ static void test_spapr_cpu_unplug_request(void) { QTestState *qtest; =20 - qtest =3D qtest_initf("-cpu power9_v2.0 -smp 1,maxcpus=3D2 " + /* + * Default smp settings will prioritize sockets over cores and + * threads, so '-smp 2,maxcpus=3D2' will add 2 sockets. However, + * the pseries machine requires a NUMA node for each socket + * (since 6.0.0). Specify sockets=3D1 to make life easier. + */ + qtest =3D qtest_initf("-cpu power9_v2.0 " + "-smp 1,maxcpus=3D2,threads=3D1,cores=3D2,sockets= =3D1 " "-device power9_v2.0-spapr-cpu-core,core-id=3D1,id= =3Ddev0"); =20 /* similar to test_pci_unplug_request */ diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c index dc0ec571ca..bb13f7131b 100644 --- a/tests/qtest/numa-test.c +++ b/tests/qtest/numa-test.c @@ -24,9 +24,17 @@ static void test_mon_explicit(const void *data) QTestState *qts; g_autofree char *s =3D NULL; g_autofree char *cli =3D NULL; + const char *arch =3D qtest_get_arch(); + + if (g_str_equal(arch, "ppc64")) { + cli =3D make_cli(data, "-smp 8,threads=3D1,cores=3D4,sockets=3D2 " + "-numa node,nodeid=3D0,memdev=3Dram,cpus=3D0-= 3 " + "-numa node,nodeid=3D1,cpus=3D4-7"); + } else { + cli =3D make_cli(data, "-smp 8 -numa node,nodeid=3D0,memdev=3Dram,= cpus=3D0-3 " + "-numa node,nodeid=3D1,cpus=3D4-7"); + } =20 - cli =3D make_cli(data, "-smp 8 -numa node,nodeid=3D0,memdev=3Dram,cpus= =3D0-3 " - "-numa node,nodeid=3D1,cpus=3D4-7"); qts =3D qtest_init(cli); =20 s =3D qtest_hmp(qts, "info numa"); @@ -57,10 +65,18 @@ static void test_mon_partial(const void *data) QTestState *qts; g_autofree char *s =3D NULL; g_autofree char *cli =3D NULL; + const char *arch =3D qtest_get_arch(); + + if (g_str_equal(arch, "ppc64")) { + cli =3D make_cli(data, "-smp 8,threads=3D1,cores=3D4,sockets=3D2 " + "-numa node,nodeid=3D0,memdev=3Dram,cpus=3D0-= 1 " + "-numa node,nodeid=3D1,cpus=3D4-5 "); + } else { + cli =3D make_cli(data, "-smp 8 " + "-numa node,nodeid=3D0,memdev=3Dram,cpus=3D0-= 1 " + "-numa node,nodeid=3D1,cpus=3D4-5 "); + } =20 - cli =3D make_cli(data, "-smp 8 " - "-numa node,nodeid=3D0,memdev=3Dram,cpus=3D0-1 " - "-numa node,nodeid=3D1,cpus=3D4-5 "); qts =3D qtest_init(cli); =20 s =3D qtest_hmp(qts, "info numa"); @@ -85,9 +101,17 @@ static void test_query_cpus(const void *data) QObject *e; QTestState *qts; g_autofree char *cli =3D NULL; + const char *arch =3D qtest_get_arch(); + + if (g_str_equal(arch, "ppc64")) { + cli =3D make_cli(data, "-smp 8,threads=3D1,cores=3D4,sockets=3D2 " + "-numa node,memdev=3Dram,cpus=3D0-3 " + "-numa node,cpus=3D4-7"); + } else { + cli =3D make_cli(data, "-smp 8 -numa node,memdev=3Dram,cpus=3D0-3 " + "-numa node,cpus=3D4-7"); + } =20 - cli =3D make_cli(data, "-smp 8 -numa node,memdev=3Dram,cpus=3D0-3 " - "-numa node,cpus=3D4-7"); qts =3D qtest_init(cli); cpus =3D get_cpus(qts, &resp); g_assert(cpus); @@ -177,7 +201,7 @@ static void spapr_numa_cpu(const void *data) QTestState *qts; g_autofree char *cli =3D NULL; =20 - cli =3D make_cli(data, "-smp 4,cores=3D4 " + cli =3D make_cli(data, "-smp 4,threads=3D1,cores=3D2,sockets=3D2 " "-numa node,nodeid=3D0,memdev=3Dram -numa node,nodeid=3D1 " "-numa cpu,node-id=3D0,core-id=3D0 " "-numa cpu,node-id=3D0,core-id=3D1 " @@ -554,7 +578,17 @@ int main(int argc, char **argv) =20 g_test_init(&argc, &argv, NULL); =20 - qtest_add_data_func("/numa/mon/cpus/default", args, test_def_cpu_split= ); + /* + * Starting on 6.0.0, for the pseries machine, '-smp 8' will only work + * if we have 8 NUMA nodes. If we specify 'smp 8,sockets=3D2' to match + * 2 NUMA nodes, the CPUs will be split as 0123/4567 instead of + * 0246/1357 that test_def_cpu_split expects. In short, this test is + * no longer valid for ppc64 in 6.0.0. + */ + if (!g_str_equal(arch, "ppc64")) { + qtest_add_data_func("/numa/mon/cpus/default", args, test_def_cpu_s= plit); + } + qtest_add_data_func("/numa/mon/cpus/explicit", args, test_mon_explicit= ); qtest_add_data_func("/numa/mon/cpus/partial", args, test_mon_partial); qtest_add_data_func("/numa/qmp/cpus/query-cpus", args, test_query_cpus= ); --=20 2.29.2 From nobody Sun May 5 15:27:25 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1616179155; cv=none; d=zohomail.com; s=zohoarc; b=jhGJI4yUVKSqGAFfIWLB8foF3VKaeJ6+5a4pS+grG/LMyrdK60oVk8XSYaCrS99kvXcXWILrpSwvwkEp38ykvlabF50IACoxREQZh4hcRoi5dg3ZHXMVPOF/cNeDnlR439yZvmPrQ9LWP1/5JHMxCo/U251rEFU2i+Mi1roN5Uw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616179155; 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=TXhvhsAsjTPYbXGvNxr2c2Ly+MOvhfbMfUVP+cDgOWo=; b=A3G65LTkk+aNFjUExcaYM1kWnphOIdWnjiRXsB+YFbWG8Tc021UqjCUieHvlN5hcaFK9kEssFdsUNCz4D5z9ewrldbzHm2tJDxdcTnr/waM3gWmymZp6nLZ8YOZo+dfGDPY+rxxc94kX/2xUyEeqdXrrNTQX7cJRz2aSXnJTQTo= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1616179155973690.3055871837072; Fri, 19 Mar 2021 11:39:15 -0700 (PDT) Received: from localhost ([::1]:43150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lNK1i-0001NY-Td for importer@patchew.org; Fri, 19 Mar 2021 14:39:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNJxz-00076q-8i; Fri, 19 Mar 2021 14:35:23 -0400 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]:42695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lNJxr-0006b6-PJ; Fri, 19 Mar 2021 14:35:22 -0400 Received: by mail-qt1-x82c.google.com with SMTP id l13so7485693qtu.9; Fri, 19 Mar 2021 11:35:15 -0700 (PDT) Received: from localhost.localdomain ([2804:431:c7c7:cc80:21a:fa87:b9b8:5376]) by smtp.gmail.com with ESMTPSA id r35sm2660225qtd.95.2021.03.19.11.35.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 11:35:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TXhvhsAsjTPYbXGvNxr2c2Ly+MOvhfbMfUVP+cDgOWo=; b=jGKXfdt/gEeoKuh25uwqAGyVa6g1oLH+Wa5oO2AZbbyr4RhuBngNbeRz/r5wfI95bE cgGRZWmDsARKxp5nt2qVB8KBLu6s7iArkpqMZIQ6OFL6P1BEWZx4IqLrNCZHM21MGdsV s67bxZXUVYnmQxK6tk6a6zcjRUwc3ySrIpTlPMnN8fsExFHXYHRylqLjPrfpU68l2vre dZ04rQ2oPPfp6fkJ0QtO+me3fkWoRlJKs184B+FPdL61Mzdzr3PLsaf4PaU7G0/wSjRI XI+d6oElb0w/T3/4X+fWflyC3iScZ0bBxq/7mky7YLRPqCdkDnC0JPtOEV2B2OUl9Y5w 1j9Q== 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=TXhvhsAsjTPYbXGvNxr2c2Ly+MOvhfbMfUVP+cDgOWo=; b=GXL3Sr5UL2nbZKDNxSmrgJRJFf5AytwPnPGGLdcWl9BvYGjh5O1o/0rdCW7YgVJlVq HFTD489fX4FvxHNSpMqSw5mPagVRwp807ATvXrL6BXUXfN3z70Cx+fVjU3rwNv8L5IIk 3ogkhPoDwswz00KYZxA8V5VmjuZxLgGDJ4Fm4MmAmrBROYNoL1qyYJP0OVUmbflMqrnL 4lhwxrIzOh7oAT7Xf12q07KsUKGJc3GiymPyajmolRZ0krnAS0xTnW9A7FwbsMU9UwdP 0K4/W4C9BS78pvoloULT7ibFW2SPX62i5/HhXDvI1VrurXHoMChc4MN1Xi+DHpmZHha7 SIHA== X-Gm-Message-State: AOAM532nxC/MQ30Aq5gNdsj1MITgPi3j7YTFI1MEaAq5BKEH8ygBSayl rTjKHvQ4QAV5BPnpYTYhRzrugewb6Bg= X-Google-Smtp-Source: ABdhPJyz8IHpMZObBdxDsFCWikEF2a1I+0FYyYpqKyqmwO2qG82VEEtsWtAjSkLMlCdvi2RjJOdYLA== X-Received: by 2002:aed:20cd:: with SMTP id 71mr9717421qtb.346.1616178914320; Fri, 19 Mar 2021 11:35:14 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 2/2] spapr.c: remove 'ibm,chip-id' from DT Date: Fri, 19 Mar 2021 15:34:53 -0300 Message-Id: <20210319183453.4466-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210319183453.4466-1-danielhb413@gmail.com> References: <20210319183453.4466-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2607:f8b0:4864:20::82c; envelope-from=danielhb413@gmail.com; helo=mail-qt1-x82c.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexey Kardashevskiy , Daniel Henrique Barboza , groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The attribute 'ibm,chip-id' does not exist in PAPR. This alone would be enough reason to remove it from the spapr DT, but before doing that, let's give a brief context on how and why it was introduced. 'ibm,chip-id' was added in the spapr DT by commit 10582ff83279. This commit references kernel commit 256f2d4b463d ("powerpc: Use ibm,chip-id property to compute cpu_core_mask if available"). In this kernel commit, the 'ibm,chip-id' DT attribute is being used to calculate the cpu_core_mask in traverse_siblings_chip_id(). This function still need to consider 'ibm,chip-id' not being available as well to avoid breaking older guests. Later on, kernel commit df52f6714071 ("powerpc/smp: Rework CPU topology construction") removed traverse_siblings_chip_id() and its callers, making the CPU topology calculation independent of the 'ibm,chip-id' attribute. Last, but perhaps most relevant, kernel commit 4ca234a9cbd7 ("powerpc/smp: Stop updating cpu_core_mask") changed the way the kernel calculates the cpu_core_mask, removing the use of 'ibm,chip-id' in the calculation altogether, with consequences already discussed in the previous patch. All that said, since it's not in PAPR and the pseries kernel does not rely on it, let's remove ibm,chip-id from the DT for the default machine type. This removal is related to the previous SMP change, so re-use the same smc->pre_6_0_smp_topology flag. CC: Alexey Kardashevskiy Suggested-by: C=C3=A9dric Le Goater Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 745f71c243..58efb51ac7 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -649,6 +649,7 @@ static void spapr_dt_cpu(CPUState *cs, void *fdt, int o= ffset, PowerPCCPU *cpu =3D POWERPC_CPU(cs); CPUPPCState *env =3D &cpu->env; PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cs); + SpaprMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(ms); int index =3D spapr_get_vcpu_id(cpu); uint32_t segs[] =3D {cpu_to_be32(28), cpu_to_be32(40), 0xffffffff, 0xffffffff}; @@ -745,8 +746,10 @@ static void spapr_dt_cpu(CPUState *cs, void *fdt, int = offset, =20 spapr_dt_pa_features(spapr, cpu, fdt, offset); =20 - _FDT((fdt_setprop_cell(fdt, offset, "ibm,chip-id", - cs->cpu_index / vcpus_per_socket))); + if (smc->pre_6_0_smp_topology) { + _FDT((fdt_setprop_cell(fdt, offset, "ibm,chip-id", + cs->cpu_index / vcpus_per_socket))); + } =20 _FDT((fdt_setprop(fdt, offset, "ibm,pft-size", pft_size_prop, sizeof(pft_size_prop)))); --=20 2.29.2