From patchwork Thu Jan 28 17:42:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1432941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=l5w/z/zU; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DRSmc6vJnz9sW0 for ; Fri, 29 Jan 2021 04:55:12 +1100 (AEDT) Received: from localhost ([::1]:51956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5BVe-0001PR-Rj for incoming@patchwork.ozlabs.org; Thu, 28 Jan 2021 12:55:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5BJU-00084n-Ov; Thu, 28 Jan 2021 12:42:36 -0500 Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]:46094) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5BJM-00085y-0m; Thu, 28 Jan 2021 12:42:36 -0500 Received: by mail-qt1-x82a.google.com with SMTP id l23so4649771qtq.13; Thu, 28 Jan 2021 09:42:25 -0800 (PST) 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=YTqzweLn4Nj+ousw+UGIhpuXZgoifpb7xTlV7lJFO3k=; b=l5w/z/zUY0+jJ2OpzHmSS2IloOypY/JmC125vyKuxiRJERcNNMXhXIx+Giu2Emv7it gPMpSFQO9QbzbNpS1QpthVkU2LS8kznpOLShreUx+iAH7MHw8ONJenFzU4fXxjZU/by2 SCv7v8lE5ioLlpH0fQMOVkAZqw9eqGQ8yJ3YF4k1zSBfhZJfU5RfI+7pAwxSxfSV6Waq W5t6GXmHnzK3fxXZRWZcS5ru5q75BCJtV1EkW0yc5kKBtmreM+GE3gUs1otB/lVjFXD7 FZ1Yokx1KZrghUGl3cIQu0aOOm2dh5MqeCb1OSJ7ufKStDuTvYOXJjSnFLl4CZcRlSYr 9pDA== 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=YTqzweLn4Nj+ousw+UGIhpuXZgoifpb7xTlV7lJFO3k=; b=k3mZlSqHv7y6ogvxzUSggK5qfOsaP5PNGEsgHJRlmUL+hKWFz+YlZZ8kggz79PGoN7 /tUizfHn0bB47+7JtlvSRKx+V3xmzOTuWg9F6/qmkXZxpR3x8ySaDGswXSiqnt8cSjTj gEswt8QpwPB7W2ITJnsGwPRsH1DlEoOCImwXXWTdjDQhkZ2Kkf5aGQxnMU3RrZf4xo0o Afmw3WpWeOGc9Xv+34kcpSDcorvwLELIGjIRO4xv5tDYknchEwqxv+rj9nAO8LW/21/A p6F77RTytMFsXRAA3265vpNeAY/+eXWq0uP+d5eIE7WMmA2zFL4inJAkA821zTFJUySY Gjhw== X-Gm-Message-State: AOAM532se//snEWnRI1B0BuxAlHYkcwAo5JBHmZa+tLN1s6b7ARkkstp 44hYu1SDzkjXnWoquI1EFD8ROxi7Mb8= X-Google-Smtp-Source: ABdhPJxlRAkVqQTt223efhe48FzjyR9KOc9stiaD8i7Rzd8eUCom5LT70sEBc8PQpGplQiBaZaAuwA== X-Received: by 2002:ac8:710d:: with SMTP id z13mr586024qto.329.1611855745270; Thu, 28 Jan 2021 09:42:25 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:6df1:6267:881f:cc79:a1f7]) by smtp.gmail.com with ESMTPSA id i8sm3804038qtr.84.2021.01.28.09.42.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jan 2021 09:42:24 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v2 1/3] spapr: move spapr_machine_using_legacy_numa() to spapr_numa.c Date: Thu, 28 Jan 2021 14:42:11 -0300 Message-Id: <20210128174213.1349181-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210128174213.1349181-1-danielhb413@gmail.com> References: <20210128174213.1349181-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::82a; envelope-from=danielhb413@gmail.com; helo=mail-qt1-x82a.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: clg@kaod.org, Daniel Henrique Barboza , qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This function is used only in spapr_numa.c. Tested-by: Cédric Le Goater Reviewed-by: Greg Kurz Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr.c | 9 --------- hw/ppc/spapr_numa.c | 9 +++++++++ include/hw/ppc/spapr.h | 1 - 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6c47466fc2..2d60c6f594 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -295,15 +295,6 @@ static hwaddr spapr_node0_size(MachineState *machine) return machine->ram_size; } -bool spapr_machine_using_legacy_numa(SpaprMachineState *spapr) -{ - MachineState *machine = MACHINE(spapr); - SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine); - - return smc->pre_5_2_numa_associativity || - machine->numa_state->num_nodes <= 1; -} - static void add_str(GString *s, const gchar *s1) { g_string_append_len(s, s1, strlen(s1) + 1); diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index b50796bbe3..261810525b 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -19,6 +19,15 @@ /* Moved from hw/ppc/spapr_pci_nvlink2.c */ #define SPAPR_GPU_NUMA_ID (cpu_to_be32(1)) +static bool spapr_machine_using_legacy_numa(SpaprMachineState *spapr) +{ + MachineState *machine = MACHINE(spapr); + SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine); + + return smc->pre_5_2_numa_associativity || + machine->numa_state->num_nodes <= 1; +} + static bool spapr_numa_is_symmetrical(MachineState *ms) { int src, dst; diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index c27c7ce515..ccbeeca1de 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -851,7 +851,6 @@ int spapr_max_server_number(SpaprMachineState *spapr); void spapr_store_hpte(PowerPCCPU *cpu, hwaddr ptex, uint64_t pte0, uint64_t pte1); void spapr_mce_req_event(PowerPCCPU *cpu, bool recovered); -bool spapr_machine_using_legacy_numa(SpaprMachineState *spapr); /* DRC callbacks. */ void spapr_core_release(DeviceState *dev); From patchwork Thu Jan 28 17:42:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1432929 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=XsUaUfwz; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DRSZ46wwhz9sT6 for ; Fri, 29 Jan 2021 04:46:04 +1100 (AEDT) Received: from localhost ([::1]:34636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5BMo-0001HM-TQ for incoming@patchwork.ozlabs.org; Thu, 28 Jan 2021 12:46:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5BJU-00085L-VO; Thu, 28 Jan 2021 12:42:36 -0500 Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]:40589) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5BJQ-00086u-V1; Thu, 28 Jan 2021 12:42:36 -0500 Received: by mail-qk1-x72a.google.com with SMTP id u20so6052346qku.7; Thu, 28 Jan 2021 09:42:28 -0800 (PST) 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=5HfsAKrA1MeJXhkokYuxeDG51ImIm+2RwDEViWvaeFE=; b=XsUaUfwzRePWlTHtjUo++UCQYHcm1l/R8zZ8l5ufAyheOx/3XPzEYaHNQFJAxHP1Xf R/EsnqZ3iP45RYESMiHU4OOxDJRG67obmPYS8yqFQW5W61hv+QyRf+l6+iLdeUHpPslk tPmDvKFHIBxvd1DrZ6By9Z/A5wObby5OimKL3kWDYiU/b7MAcbzLUSidkRAvpDWc6qvA mVHqPoA0HxOC7/y4NIgKeuJuijgCRAajJH79GrCZ9NowtRKqJGzWUfdKBJdmRuqklrxT 8Ukrab/iNRc50KBt6uyMbhNSo7MBou8dBrX8ua4n2+zYuaBru5hIJ5EjFWSGanabq1/r ejSw== 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=5HfsAKrA1MeJXhkokYuxeDG51ImIm+2RwDEViWvaeFE=; b=L89pQl7gzfhe+jFGbqykNeuruSHaKNlG0jkjFwM8IlUxGWzicx+yFo54DaQlLZTT7b w1cAukoGybruLGgD3ue5GB/DlBLJ1hXTzQNys8LRB/zm4vF8udiMVV0VP3WjGmrX9p++ pZkBI/21T4zZEfRMZPzhAOo7juR7MHbiRoGYrUY22qQnpi+WISUe1jH+Z8LKgi6bmSEH 4KvyfllvSDvgOdaTdXjXgzo3OlmATbapoPXdfnzbeZUSNzyyicPurJ+EQDlDtHUtGpQS xWoL+RFkdy6TQ8jZKXqaKWPu+OgrDQV1X/otq2e0duKeunOtlUkJ7FNTpQ46BzgkQXJB Wf1Q== X-Gm-Message-State: AOAM532H21G9lU51sd79a5Y2r6GKp25vz+MgA6sUQM8skaZ9eCDx/Eqc dQ1zgwNM2kygVeReZDGvSDYAZh6b1GI= X-Google-Smtp-Source: ABdhPJz/hmtji2d5PvN8W5rH9/sfO6CZxRkhUUymfJgOXFOLzwpN1rPU/Eg7nV91a3zSKDc1afAaZw== X-Received: by 2002:a37:d01:: with SMTP id 1mr273188qkn.247.1611855747276; Thu, 28 Jan 2021 09:42:27 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:6df1:6267:881f:cc79:a1f7]) by smtp.gmail.com with ESMTPSA id i8sm3804038qtr.84.2021.01.28.09.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jan 2021 09:42:26 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v2 2/3] spapr_numa.c: create spapr_numa_initial_nvgpu_numa_id() helper Date: Thu, 28 Jan 2021 14:42:12 -0300 Message-Id: <20210128174213.1349181-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210128174213.1349181-1-danielhb413@gmail.com> References: <20210128174213.1349181-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72a; envelope-from=danielhb413@gmail.com; helo=mail-qk1-x72a.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: clg@kaod.org, Daniel Henrique Barboza , qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We'll need to check the initial value given to spapr->gpu_numa_id when building the rtas DT, so put it in a helper for easier access and to avoid repetition. Tested-by: Cédric Le Goater Reviewed-by: Greg Kurz Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr.c | 11 +---------- hw/ppc/spapr_numa.c | 14 ++++++++++++++ include/hw/ppc/spapr_numa.h | 1 + 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 2d60c6f594..bc3fa276ff 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2765,16 +2765,7 @@ static void spapr_machine_init(MachineState *machine) } - /* - * NVLink2-connected GPU RAM needs to be placed on a separate NUMA node. - * We assign a new numa ID per GPU in spapr_pci_collect_nvgpu() which is - * called from vPHB reset handler so we initialize the counter here. - * If no NUMA is configured from the QEMU side, we start from 1 as GPU RAM - * must be equally distant from any other node. - * The final value of spapr->gpu_numa_id is going to be written to - * max-associativity-domains in spapr_build_fdt(). - */ - spapr->gpu_numa_id = MAX(1, machine->numa_state->num_nodes); + spapr->gpu_numa_id = spapr_numa_initial_nvgpu_numa_id(machine); /* Init numa_assoc_array */ spapr_numa_associativity_init(spapr, machine); diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index 261810525b..a757dd88b8 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -46,6 +46,20 @@ static bool spapr_numa_is_symmetrical(MachineState *ms) return true; } +/* + * NVLink2-connected GPU RAM needs to be placed on a separate NUMA node. + * We assign a new numa ID per GPU in spapr_pci_collect_nvgpu() which is + * called from vPHB reset handler so we initialize the counter here. + * If no NUMA is configured from the QEMU side, we start from 1 as GPU RAM + * must be equally distant from any other node. + * The final value of spapr->gpu_numa_id is going to be written to + * max-associativity-domains in spapr_build_fdt(). + */ +unsigned int spapr_numa_initial_nvgpu_numa_id(MachineState *machine) +{ + return MAX(1, machine->numa_state->num_nodes); +} + /* * This function will translate the user distances into * what the kernel understand as possible values: 10 diff --git a/include/hw/ppc/spapr_numa.h b/include/hw/ppc/spapr_numa.h index b3fd950634..6f9f02d3de 100644 --- a/include/hw/ppc/spapr_numa.h +++ b/include/hw/ppc/spapr_numa.h @@ -31,5 +31,6 @@ int spapr_numa_fixup_cpu_dt(SpaprMachineState *spapr, void *fdt, int offset, PowerPCCPU *cpu); int spapr_numa_write_assoc_lookup_arrays(SpaprMachineState *spapr, void *fdt, int offset); +unsigned int spapr_numa_initial_nvgpu_numa_id(MachineState *machine); #endif /* HW_SPAPR_NUMA_H */ From patchwork Thu Jan 28 17:42:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1432928 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=VbVomBGE; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DRSWZ61gVz9sT6 for ; Fri, 29 Jan 2021 04:43:54 +1100 (AEDT) Received: from localhost ([::1]:59498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5BKi-0008C8-Pi for incoming@patchwork.ozlabs.org; Thu, 28 Jan 2021 12:43:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5BJX-00089R-B7; Thu, 28 Jan 2021 12:42:39 -0500 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]:38450) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5BJQ-000875-G2; Thu, 28 Jan 2021 12:42:39 -0500 Received: by mail-qk1-x736.google.com with SMTP id d85so6055861qkg.5; Thu, 28 Jan 2021 09:42:29 -0800 (PST) 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=4ATDWYb9nI+2OfgmowSKbjTerqXCLFRWBl7VnqTmmhs=; b=VbVomBGEJw5ZXO6BkEYrCn9/Otzn4F/iWbJlzH5jjrYOThRihj5hAN1rZ/XAiH8r8X SSkmXQNIZ+RIfZpTAxSg2fgB85od296rK+Dfz3RUL6Eqsvj+CwMlPA14muK/eseUDHSd Wt31vlfT4qp+34GGDNIPhgVkL4/v6sRGvGXlwyhd5bD4cwynCcDBvHDQkZ0vp8etTtcJ W3mlY/m0a6xm+vCNQMCPNgv/Nd5YeMrPfBWEmlC/3GWe1nIIZTK9XNAbQk2Hc77YaglC Ll7PZ1AuZaeQ4BCPpXsS1WgwkEOtp7qoYU5uSwxeAinKZRhAde3M1DgdMNsz1XRR/uhQ hMtw== 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=4ATDWYb9nI+2OfgmowSKbjTerqXCLFRWBl7VnqTmmhs=; b=WPuRBg7vYsJtLadxp053RunAoNsMHX+4b+2m9IxUB1+kUf3VvthGBN784RQXpWxiXd M2rluYn2lYs1mSF8KaV+FscD9Zw4/757YDEXOcdZj/HDh3Ra+AZw/KXoJCv8TO7VFZg8 FdJIPRP1MZ28CDZPEz2LimI6ecgOXZyLMWbEuKOJpdqaQXyUlbubcA63+Bo+4qD+mbua hFZTsJoKix5eUxcGt7a5+Vr63WP1fMloZFfbgFzqryi7H8quc+crImMB1BdLNCvdinVz xYaGADEN2PNI5LomIs7K8lNGU/AhNuhBVQ79ZDpEkzrC2IvgWjsPkuQUDwyamgt5Mxcs +L1Q== X-Gm-Message-State: AOAM530lO8i4l4xagHd3k5oTEMmVPhhs5eHCgB0xtMR3HUNpBo9MqpUG OHOceuU1ydPec2kqAfhkhT33crVjOng= X-Google-Smtp-Source: ABdhPJwkZyliCU5gZllgj6BKUv4hCB1zlMlkvY89GzCvXe4oD1QZ/HKw36iEfUx+BBWYnFRay3A5ug== X-Received: by 2002:a37:4c8:: with SMTP id 191mr292650qke.338.1611855749308; Thu, 28 Jan 2021 09:42:29 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:6df1:6267:881f:cc79:a1f7]) by smtp.gmail.com with ESMTPSA id i8sm3804038qtr.84.2021.01.28.09.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jan 2021 09:42:28 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v2 3/3] spapr_numa.c: fix ibm, max-associativity-domains calculation Date: Thu, 28 Jan 2021 14:42:13 -0300 Message-Id: <20210128174213.1349181-4-danielhb413@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210128174213.1349181-1-danielhb413@gmail.com> References: <20210128174213.1349181-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::736; envelope-from=danielhb413@gmail.com; helo=mail-qk1-x736.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: clg@kaod.org, Daniel Henrique Barboza , qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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=128, Order=0-3, MinObjects=0, CPUs=4, Nodes=8 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édric Le Goater Tested-by: Cédric Le Goater Signed-off-by: Daniel Henrique Barboza Reviewed-by: Greg Kurz --- 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 = MACHINE(spapr); SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr); + uint32_t number_nvgpus_nodes = spapr->gpu_numa_id - + spapr_numa_initial_nvgpu_numa_id(ms); uint32_t refpoints[] = { 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 = ARRAY_SIZE(refpoints); - uint32_t maxdomain = ms->numa_state->num_nodes + spapr->gpu_numa_id; + uint32_t maxdomain = ms->numa_state->num_nodes + number_nvgpus_nodes; uint32_t maxdomains[] = { cpu_to_be32(4), cpu_to_be32(maxdomain),