From nobody Tue Feb 10 01:32:58 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 ARC-Seal: i=1; a=rsa-sha256; t=1612938405; cv=none; d=zohomail.com; s=zohoarc; b=NuFsivVyJ1FPIPkTBXdjM6OmDd8/D+kqvpY2oP1ny0y/1yMIoUYViL2Z5IsJIy+uYWF+ueYX4NsXvJFvffV0MBTem8wH+dQChEawQ1M4rVRRUTxgKu1UBMR7riexl1H6jacE4kz4774kSaTjXIPiu9bwltKS1mEKs/SNWGcJOgI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612938405; 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=/PYUbzaR7Zb3mwSlbM7kvOZIFAbqEo23Ffro3cMdiaA=; b=KzhEPjvHF65N0w9273bJwecEfjz49L15w7pNAySVLfnXcfrlT33c2xtsHtCxjkwSW91pKJh4/dnmO70cCPxAzD+u2H5GySGvXhE0f1zvAOwsMzhAvWF5i6hq/Ray7k4bSLBGPl9u+c7MgikLx26Bua9iaRjWP/dAj+VlGZQhXwY= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612938405573638.6206803599389; Tue, 9 Feb 2021 22:26:45 -0800 (PST) Received: from localhost ([::1]:32868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9ixY-0003Pu-Cz for importer@patchew.org; Wed, 10 Feb 2021 01:26:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9ip9-0001ip-FJ; Wed, 10 Feb 2021 01:18:03 -0500 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:42049 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9ip7-0000Qq-LG; Wed, 10 Feb 2021 01:18:03 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4Db8gp17qLz9sWF; Wed, 10 Feb 2021 17:17:41 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1612937862; bh=8ThZC5jw5bRucRV+ryJsGdKqx6SgBpNqDr6183suprk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UwGP5T9Mn7fzPFMF5uWkklYdEUiVDWiWWPvKi8+Ejsya33jp2vgjDNLtrC0zVEDmg YiBxFQjl0kVAJIqRK2zk2WY/na9QHM4hEXeZR+zfZqzyk/wED2DHrE5BZhl3mciTDb mkNpPzVIjcm3vuhyivG4IBhcGphLDWaPB2DIKh0Q= From: David Gibson To: peter.maydell@linaro.org, groug@kaod.org Subject: [PULL 14/19] spapr_numa.c: fix ibm, max-associativity-domains calculation Date: Wed, 10 Feb 2021 17:17:30 +1100 Message-Id: <20210210061735.304384-15-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210210061735.304384-1-david@gibson.dropbear.id.au> References: <20210210061735.304384-1-david@gibson.dropbear.id.au> 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=2401:3900:2:1::2; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org 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, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: Daniel Henrique Barboza , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Daniel Henrique Barboza The current logic for calculating 'maxdomain' making it a sum of numa_state->num_nodes with spapr->gpu_numa_id. spapr->gpu_numa_id is used as a index to determine the next available NUMA id that a given NVGPU can use. The problem is that the initial value of gpu_numa_id, for any topology that has more than one NUMA node, is equal to numa_state->num_nodes. This means that our maxdomain will always be, at least, twice the amount of existing NUMA nodes. This means that a guest with 4 NUMA nodes will end up with the following max-associativity-domains: rtas/ibm,max-associativity-domains 00000004 00000008 00000008 00000008 00000008 This overtuning of maxdomains doesn't go unnoticed in the guest, being detected in SLUB during boot: dmesg | grep SLUB [ 0.000000] SLUB: HWalign=3D128, Order=3D0-3, MinObjects=3D0, CPUs=3D4, = Nodes=3D8 SLUB is detecting 8 total nodes, with 4 nodes being online. This patch fixes ibm,max-associativity-domains by considering the amount of NVGPUs NUMA nodes presented in the guest, instead of just spapr->gpu_numa_id. Reported-by: C=C3=A9dric Le Goater Tested-by: C=C3=A9dric Le Goater Signed-off-by: Daniel Henrique Barboza Message-Id: <20210128174213.1349181-4-danielhb413@gmail.com> Reviewed-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr_numa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index a757dd88b8..779f18b994 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -311,6 +311,8 @@ void spapr_numa_write_rtas_dt(SpaprMachineState *spapr,= void *fdt, int rtas) { MachineState *ms =3D MACHINE(spapr); SpaprMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(spapr); + uint32_t number_nvgpus_nodes =3D spapr->gpu_numa_id - + spapr_numa_initial_nvgpu_numa_id(ms); uint32_t refpoints[] =3D { cpu_to_be32(0x4), cpu_to_be32(0x3), @@ -318,7 +320,7 @@ void spapr_numa_write_rtas_dt(SpaprMachineState *spapr,= void *fdt, int rtas) cpu_to_be32(0x1), }; uint32_t nr_refpoints =3D ARRAY_SIZE(refpoints); - uint32_t maxdomain =3D ms->numa_state->num_nodes + spapr->gpu_numa_id; + uint32_t maxdomain =3D ms->numa_state->num_nodes + number_nvgpus_nodes; uint32_t maxdomains[] =3D { cpu_to_be32(4), cpu_to_be32(maxdomain), --=20 2.29.2