From nobody Wed Nov 12 03:42:18 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1567546125; cv=none; d=zoho.com; s=zohoarc; b=aNDdfzFczT+go5Zel3dm9MHl1zizdyb/vXNtmbNRFQvjMWoGEc63VPaaioViXiwwT/civfURUN5yp8zUJrBLRbAtAkoZX0rHkgkS/51MkNLkyoFa4YwRF5qCehn/c/8xuSnSWmuq4LXAymALDbA17Jfgm2Wg7Xi+X+V7srTtTv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567546125; h=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:ARC-Authentication-Results; bh=/GGxrY+Oy/OraK06Shrse8ou3hTHfcFSLzT6gUMoM34=; b=buXQcw5rlfrTLwzf+pCcdTW0Mmo3f74nYrlsQoXoqeEPUKsWTtCIofWtJ1W2WC5yVPc3aAbDhdXloF5osKpvyeN9bDlcyBEeghi3ZWYQTbUqZVhI1r0H+gf2KAwmpkG1B+OFyPYIDWWCBTMreekDaADvhLo85GNzfeCxxBWAVI4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.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 1567546125696511.0768702345471; Tue, 3 Sep 2019 14:28:45 -0700 (PDT) Received: from localhost ([::1]:51762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5GLx-0001Vq-C1 for importer@patchew.org; Tue, 03 Sep 2019 17:28:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56874) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5FwT-0004HK-Bf for qemu-devel@nongnu.org; Tue, 03 Sep 2019 17:02:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5FwQ-0001Fj-7O for qemu-devel@nongnu.org; Tue, 03 Sep 2019 17:02:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53752) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5FwP-0001B7-EU for qemu-devel@nongnu.org; Tue, 03 Sep 2019 17:02:17 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DD9F23082128; Tue, 3 Sep 2019 21:02:11 +0000 (UTC) Received: from localhost (ovpn-116-55.gru2.redhat.com [10.97.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7136060BE2; Tue, 3 Sep 2019 21:02:11 +0000 (UTC) From: Eduardo Habkost To: Paolo Bonzini , Igor Mammedov , Peter Maydell , Richard Henderson , Marcel Apfelbaum , qemu-devel@nongnu.org Date: Tue, 3 Sep 2019 18:01:52 -0300 Message-Id: <20190903210201.14627-5-ehabkost@redhat.com> In-Reply-To: <20190903210201.14627-1-ehabkost@redhat.com> References: <20190903210201.14627-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 03 Sep 2019 21:02:11 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL v2 04/13] numa: move numa global variable have_numa_distance into MachineState 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: Liu Jingqi , Tao Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Tao Xu Move existing numa global have_numa_distance into NumaState. Reviewed-by: Igor Mammedov Reviewed-by: Liu Jingqi Suggested-by: Igor Mammedov Suggested-by: Eduardo Habkost Signed-off-by: Tao Xu Message-Id: <20190809065731.9097-4-tao3.xu@intel.com> Signed-off-by: Eduardo Habkost --- include/sysemu/numa.h | 4 ++-- hw/arm/sbsa-ref.c | 2 +- hw/arm/virt-acpi-build.c | 2 +- hw/arm/virt.c | 2 +- hw/core/numa.c | 5 ++--- hw/i386/acpi-build.c | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index 1786e861d0..bfe04b514c 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -14,8 +14,6 @@ struct CPUArchId; #define NUMA_DISTANCE_MAX 254 #define NUMA_DISTANCE_UNREACHABLE 255 =20 -extern bool have_numa_distance; - struct NodeInfo { uint64_t node_mem; struct HostMemoryBackend *node_memdev; @@ -34,6 +32,8 @@ struct NumaState { /* Number of NUMA nodes */ int num_nodes; =20 + /* Allow setting NUMA distance for different NUMA nodes */ + bool have_numa_distance; }; typedef struct NumaState NumaState; =20 diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index d15e5aebbd..7d7bb9fd96 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -160,7 +160,7 @@ static void create_fdt(SBSAMachineState *sms) qemu_fdt_setprop_cell(fdt, "/", "#address-cells", 0x2); qemu_fdt_setprop_cell(fdt, "/", "#size-cells", 0x2); =20 - if (have_numa_distance) { + if (ms->numa_state->have_numa_distance) { int size =3D nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t); uint32_t *matrix =3D g_malloc0(size); int idx, i, j; diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 9e6cfe65b5..b1deb76a53 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -798,7 +798,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTa= bles *tables) if (ms->numa_state->num_nodes > 0) { acpi_add_table(table_offsets, tables_blob); build_srat(tables_blob, tables->linker, vms); - if (have_numa_distance) { + if (ms->numa_state->have_numa_distance) { acpi_add_table(table_offsets, tables_blob); build_slit(tables_blob, tables->linker, ms); } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 8d36b37f8e..414f7ecd02 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -236,7 +236,7 @@ static void create_fdt(VirtMachineState *vms) "clk24mhz"); qemu_fdt_setprop_cell(fdt, "/apb-pclk", "phandle", vms->clock_phandle); =20 - if (have_numa_distance) { + if (nb_numa_nodes > 0 && ms->numa_state->have_numa_distance) { int size =3D nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t); uint32_t *matrix =3D g_malloc0(size); int idx, i, j; diff --git a/hw/core/numa.c b/hw/core/numa.c index 2712c78adb..4a7adc9b98 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -55,7 +55,6 @@ static int have_mem; static int max_numa_nodeid; /* Highest specified NUMA node ID, plus one. * For all nodes, nodeid < max_numa_nodeid */ -bool have_numa_distance; NodeInfo numa_info[MAX_NODES]; =20 =20 @@ -173,7 +172,7 @@ void parse_numa_distance(MachineState *ms, NumaDistOpti= ons *dist, Error **errp) } =20 numa_info[src].distance[dst] =3D val; - have_numa_distance =3D true; + ms->numa_state->have_numa_distance =3D true; } =20 void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp) @@ -446,7 +445,7 @@ void numa_complete_configuration(MachineState *ms) * asymmetric. In this case, the distances for both directions * of all node pairs are required. */ - if (have_numa_distance) { + if (ms->numa_state->have_numa_distance) { /* Validate enough NUMA distance information was provided. */ validate_numa_distance(ms); =20 diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 3c5868322b..e54e571a75 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2694,7 +2694,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) if (pcms->numa_nodes) { acpi_add_table(table_offsets, tables_blob); build_srat(tables_blob, tables->linker, machine); - if (have_numa_distance) { + if (machine->numa_state->have_numa_distance) { acpi_add_table(table_offsets, tables_blob); build_slit(tables_blob, tables->linker, machine); } --=20 2.21.0