diff mbox series

[v3,02/17] xen/arm: implement helpers to get and update NUMA status

Message ID 20230420112521.3272732-3-Henry.Wang@arm.com (mailing list archive)
State Superseded
Headers show
Series Device tree based NUMA support for Arm - Part#3 | expand

Commit Message

Henry Wang April 20, 2023, 11:25 a.m. UTC
From: Wei Chen <wei.chen@arm.com>

NUMA has one global and one implementation specific switches. For
ACPI NUMA implementation, Xen has acpi_numa, so we introduce
device_tree_numa for device tree NUMA implementation. And use
enumerations to indicate init, off and on status.

arch_numa_disabled will get device_tree_numa status, but for
arch_numa_setup we have not provided boot arguments to setup
device_tree_numa. So we just return -EINVAL in this patch.

Signed-off-by: Wei Chen <wei.chen@arm.com>
Signed-off-by: Henry Wang <Henry.Wang@arm.com>
---
v2 -> v3:
1. Rename the first entry of enum dt_numa_status as DT_NUMA_DEFAULT.
2. Make enum dt_numa_status device_tree_numa as __ro_after_init and
   assign it explicitly to DT_NUMA_DEFAULT.
3. Update the year in copyright to 2023.
4. Don't move the x86 numa_disabled() and make Arm's numa_disabled()
   a static inline function for !CONFIG_NUMA.
v1 -> v2:
1. Use arch_numa_disabled to replace numa_enable_with_firmware.
2. Introduce enumerations for device tree numa status.
3. Use common numa_disabled, drop Arm version numa_disabled.
4. Introduce arch_numa_setup for Arm.
5. Rename bad_srat to numa_bad.
6. Add numa_enable_with_firmware helper.
7. Add numa_disabled helper.
8. Refine commit message.
---
 xen/arch/arm/include/asm/numa.h | 17 +++++++++++
 xen/arch/arm/numa.c             | 50 +++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 xen/arch/arm/numa.c

Comments

Jan Beulich April 20, 2023, 12:41 p.m. UTC | #1
On 20.04.2023 13:25, Henry Wang wrote:
> From: Wei Chen <wei.chen@arm.com>
> 
> NUMA has one global and one implementation specific switches. For
> ACPI NUMA implementation, Xen has acpi_numa, so we introduce
> device_tree_numa for device tree NUMA implementation. And use
> enumerations to indicate init, off and on status.
> 
> arch_numa_disabled will get device_tree_numa status, but for
> arch_numa_setup we have not provided boot arguments to setup
> device_tree_numa. So we just return -EINVAL in this patch.
> 
> Signed-off-by: Wei Chen <wei.chen@arm.com>
> Signed-off-by: Henry Wang <Henry.Wang@arm.com>
> ---
> v2 -> v3:
> 1. Rename the first entry of enum dt_numa_status as DT_NUMA_DEFAULT.
> 2. Make enum dt_numa_status device_tree_numa as __ro_after_init and
>    assign it explicitly to DT_NUMA_DEFAULT.
> 3. Update the year in copyright to 2023.
> 4. Don't move the x86 numa_disabled() and make Arm's numa_disabled()
>    a static inline function for !CONFIG_NUMA.
> v1 -> v2:
> 1. Use arch_numa_disabled to replace numa_enable_with_firmware.
> 2. Introduce enumerations for device tree numa status.
> 3. Use common numa_disabled, drop Arm version numa_disabled.
> 4. Introduce arch_numa_setup for Arm.
> 5. Rename bad_srat to numa_bad.
> 6. Add numa_enable_with_firmware helper.
> 7. Add numa_disabled helper.
> 8. Refine commit message.
> ---
>  xen/arch/arm/include/asm/numa.h | 17 +++++++++++
>  xen/arch/arm/numa.c             | 50 +++++++++++++++++++++++++++++++++
>  2 files changed, 67 insertions(+)
>  create mode 100644 xen/arch/arm/numa.c

While I was Cc-ed on this one, neither the diffstat nor any possible remarks
make clear whether anything is expected of me here.

Jan
Henry Wang April 20, 2023, 12:48 p.m. UTC | #2
Hi Jan,

> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Subject: Re: [PATCH v3 02/17] xen/arm: implement helpers to get and update
> NUMA status
> > ---
> > v2 -> v3:
> > 1. Rename the first entry of enum dt_numa_status as DT_NUMA_DEFAULT.
> > 2. Make enum dt_numa_status device_tree_numa as __ro_after_init and
> >    assign it explicitly to DT_NUMA_DEFAULT.
> > 3. Update the year in copyright to 2023.
> > 4. Don't move the x86 numa_disabled() and make Arm's numa_disabled()
> >    a static inline function for !CONFIG_NUMA.
> > v1 -> v2:
> > 1. Use arch_numa_disabled to replace numa_enable_with_firmware.
> > 2. Introduce enumerations for device tree numa status.
> > 3. Use common numa_disabled, drop Arm version numa_disabled.
> > 4. Introduce arch_numa_setup for Arm.
> > 5. Rename bad_srat to numa_bad.
> > 6. Add numa_enable_with_firmware helper.
> > 7. Add numa_disabled helper.
> > 8. Refine commit message.
> > ---
> >  xen/arch/arm/include/asm/numa.h | 17 +++++++++++
> >  xen/arch/arm/numa.c             | 50 +++++++++++++++++++++++++++++++++
> >  2 files changed, 67 insertions(+)
> >  create mode 100644 xen/arch/arm/numa.c
> 
> While I was Cc-ed on this one, neither the diffstat nor any possible remarks
> make clear whether anything is expected of me here.

Sorry for the confusion. I also thought of this when sending the email but
eventually decided to add you in the Cc as you made some correct and helpful
comments in v2 [1], so I think it is a good manner to add you so that you would
know all your (correct) remarks are addressed.

Thanks for reviewing the series.

[1] https://patchwork.kernel.org/project/xen-devel/patch/20230110084930.1095203-3-wei.chen@arm.com/

Kind regards,
Henry

> 
> Jan
diff mbox series

Patch

diff --git a/xen/arch/arm/include/asm/numa.h b/xen/arch/arm/include/asm/numa.h
index 7d6ae36a19..83f60ad05b 100644
--- a/xen/arch/arm/include/asm/numa.h
+++ b/xen/arch/arm/include/asm/numa.h
@@ -22,6 +22,8 @@  typedef u8 nodeid_t;
  */
 #define NR_NODE_MEMBLKS NR_MEM_BANKS
 
+extern bool numa_disabled(void);
+
 #else
 
 /* Fake one node for now. See also node_online_map. */
@@ -39,6 +41,21 @@  extern mfn_t first_valid_mfn;
 #define node_start_pfn(nid) (mfn_x(first_valid_mfn))
 #define __node_distance(a, b) (20)
 
+static inline bool numa_disabled(void)
+{
+    return true;
+}
+
+static inline bool arch_numa_unavailable(void)
+{
+    return true;
+}
+
+static inline bool arch_numa_broken(void)
+{
+    return true;
+}
+
 #endif
 
 #define arch_want_default_dmazone() (false)
diff --git a/xen/arch/arm/numa.c b/xen/arch/arm/numa.c
new file mode 100644
index 0000000000..eb5d0632cb
--- /dev/null
+++ b/xen/arch/arm/numa.c
@@ -0,0 +1,50 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Arm Architecture support layer for NUMA.
+ *
+ * Copyright (C) 2023 Arm Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#include <xen/init.h>
+#include <xen/numa.h>
+
+enum dt_numa_status {
+    DT_NUMA_DEFAULT,
+    DT_NUMA_ON,
+    DT_NUMA_OFF,
+};
+
+static enum dt_numa_status __ro_after_init device_tree_numa = DT_NUMA_DEFAULT;
+
+void __init numa_fw_bad(void)
+{
+    printk(KERN_ERR "NUMA: device tree numa info table not used.\n");
+    device_tree_numa = DT_NUMA_OFF;
+}
+
+bool __init arch_numa_unavailable(void)
+{
+    return device_tree_numa != DT_NUMA_ON;
+}
+
+bool arch_numa_disabled(void)
+{
+    return device_tree_numa == DT_NUMA_OFF;
+}
+
+int __init arch_numa_setup(const char *opt)
+{
+    return -EINVAL;
+}