Skip to contentSkip to conversation

NUMA: no need for asm/numa.h when !NUMA

PATCH In review Jan Beulich 4 participants 5 messages Jan 8, 2024 – Jan 25, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 NUMA: no need for asm/numa.h when !NUMA

There's no point in every architecture carrying the same stubs for the case when NUMA isn't enabled (or even supported). Move all of that to xen/numa.h; replace explicit uses of asm/numa.h in common code. Make inclusion of asm/numa.h dependent upon NUMA=y.

Drop the no longer applicable "implement NUMA support" comments - in a !NUMA section this simply makes no sense.

---
v2: Split off first_valid_mfn specific change. Re-base.

xen/arch/arm/include/asm/numa.h deleted +0 -31
@@ -1,31 +0,0 @@
-#ifndef __ARCH_ARM_NUMA_H
-#define __ARCH_ARM_NUMA_H
-
-#include <xen/mm.h>
-
-typedef u8 nodeid_t;
-
-#ifndef CONFIG_NUMA
-
-/* Fake one node for now. See also node_online_map. */
-#define cpu_to_node(cpu) 0
-#define node_to_cpumask(node)   (cpu_online_map)
-
-/* XXX: implement NUMA support */
-#define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
-#define node_start_pfn(nid) (mfn_x(first_valid_mfn))
-#define __node_distance(a, b) (20)
-
-#endif
-
-#define arch_want_default_dmazone() (false)
-
-#endif /* __ARCH_ARM_NUMA_H */
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
xen/arch/arm/smpboot.c +1 -1
@@ -42,7 +42,7 @@ integer_param("maxcpus", max_cpus);
 /* CPU logical map: map xen cpuid to an MPIDR */
 register_t __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = MPIDR_INVALID };
 
-/* Fake one node for now. See also asm/numa.h */
+/* Fake one node for now. See also xen/numa.h */
 nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
 
 /* Xen stack for bringing up the first CPU. */
xen/arch/ppc/include/asm/numa.h deleted +0 -20
@@ -1,20 +0,0 @@
-#ifndef __ASM_PPC_NUMA_H__
-#define __ASM_PPC_NUMA_H__
-
-#include <xen/types.h>
-#include <xen/mm.h>
-
-typedef uint8_t nodeid_t;
-
-/* Fake one node for now. See also node_online_map. */
-#define cpu_to_node(cpu) 0
-#define node_to_cpumask(node)   (cpu_online_map)
-
-/* XXX: implement NUMA support */
-#define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
-#define node_start_pfn(nid) (mfn_x(first_valid_mfn))
-#define __node_distance(a, b) (20)
-
-#define arch_want_default_dmazone() (false)
-
-#endif /* __ASM_PPC_NUMA_H__ */
xen/common/page_alloc.c +0 -1
@@ -138,7 +138,6 @@
 #include <xen/spinlock.h>
 
 #include <asm/flushtlb.h>
-#include <asm/numa.h>
 #include <asm/page.h>
 
 #include <public/sysctl.h>
xen/common/sysctl.c +1 -1
@@ -22,8 +22,8 @@
 #include <asm/current.h>
 #include <xen/hypercall.h>
 #include <public/sysctl.h>
-#include <asm/numa.h>
 #include <xen/nodemask.h>
+#include <xen/numa.h>
 #include <xsm/xsm.h>
 #include <xen/pmstat.h>
 #include <xen/livepatch.h>
xen/include/xen/domain.h +1 -1
@@ -2,6 +2,7 @@
 #ifndef __XEN_DOMAIN_H__
 #define __XEN_DOMAIN_H__
 
+#include <xen/numa.h>
 #include <xen/types.h>
 
 #include <public/xen.h>
@@ -12,7 +13,6 @@ struct guest_area {
 };
 
 #include <asm/domain.h>
-#include <asm/numa.h>
 
 typedef union {
     struct vcpu_guest_context *nat;
xen/include/xen/numa.h +16 -0
@@ -2,7 +2,13 @@
 #define _XEN_NUMA_H
 
 #include <xen/mm-frame.h>
+
+#ifdef CONFIG_NUMA
+#include <xen/pdx.h>
 #include <asm/numa.h>
+#else
+typedef uint8_t nodeid_t;
+#endif
 
 #define NUMA_NO_NODE     0xFF
 #define NUMA_NO_DISTANCE 0xFF
@@ -108,8 +114,18 @@ extern void numa_set_processor_nodes_par
 
 #else
 
+/* Fake one node for now. See also node_online_map. */
+#define cpu_to_node(cpu) 0
+#define node_to_cpumask(node)   cpu_online_map
+
+#define arch_want_default_dmazone() false
+
 extern mfn_t first_valid_mfn;
 
+#define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
+#define node_start_pfn(nid) mfn_x(first_valid_mfn)
+#define __node_distance(a, b) 20
+
 static inline nodeid_t mfn_to_nid(mfn_t mfn)
 {
     return 0;
xen/include/xen/pci.h +1 -1
@@ -11,10 +11,10 @@
 #include <xen/list.h>
 #include <xen/spinlock.h>
 #include <xen/irq.h>
+#include <xen/numa.h>
 #include <xen/pci_regs.h>
 #include <xen/pfn.h>
 #include <asm/device.h>
-#include <asm/numa.h>
 
 /*
  * The PCI interface treats multi-function devices as independent
Acked-by on v2 1/1
#1 lore raw

Hi Jan,

Quoted 9 lines · Jan Beulich

There's no point in every architecture carrying the same stubs for the case when NUMA isn't enabled (or even supported). Move all of that to xen/numa.h; replace explicit uses of asm/numa.h in common code. Make inclusion of asm/numa.h dependent upon NUMA=y.

Drop the no longer applicable "implement NUMA support" comments - in a !NUMA section this simply makes no sense.

Thanks,
Shawn

Acked-by on v2 1/1
#2 lore raw
In reply to Jan Beulich

Looks good to me.

Best regards,
Oleksii

Quoted 172 lines · Jan Beulich

There's no point in every architecture carrying the same stubs for the
case when NUMA isn't enabled (or even supported). Move all of that to xen/numa.h; replace explicit uses of asm/numa.h in common code. Make inclusion of asm/numa.h dependent upon NUMA=y.

Drop the no longer applicable "implement NUMA support" comments - in a
!NUMA section this simply makes no sense.

---
v2: Split off first_valid_mfn specific change. Re-base.

xen/arch/arm/include/asm/numa.h deleted +0 -31
@@ -1,31 +0,0 @@
-#ifndef __ARCH_ARM_NUMA_H
-#define __ARCH_ARM_NUMA_H
-
-#include <xen/mm.h>
-
-typedef u8 nodeid_t;
-
-#ifndef CONFIG_NUMA
-
-/* Fake one node for now. See also node_online_map. */
-#define cpu_to_node(cpu) 0
-#define node_to_cpumask(node)   (cpu_online_map)
-
-/* XXX: implement NUMA support */
-#define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
-#define node_start_pfn(nid) (mfn_x(first_valid_mfn))
-#define __node_distance(a, b) (20)
-
-#endif
-
-#define arch_want_default_dmazone() (false)
-
-#endif /* __ARCH_ARM_NUMA_H */
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
xen/arch/arm/smpboot.c +0 -0
@@ -42,7 +42,7 @@ integer_param("maxcpus", max_cpus);
  /* CPU logical map: map xen cpuid to an MPIDR */

 register_t __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = MPIDR_INVALID };

xen/arch/arm/smpboot.c +1 -1
-/* Fake one node for now. See also asm/numa.h */
+/* Fake one node for now. See also xen/numa.h */

 nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
 /* Xen stack for bringing up the first CPU. */

xen/arch/ppc/include/asm/numa.h deleted +0 -20
@@ -1,20 +0,0 @@
-#ifndef __ASM_PPC_NUMA_H__
-#define __ASM_PPC_NUMA_H__
-
-#include <xen/types.h>
-#include <xen/mm.h>
-
-typedef uint8_t nodeid_t;
-
-/* Fake one node for now. See also node_online_map. */
-#define cpu_to_node(cpu) 0
-#define node_to_cpumask(node)   (cpu_online_map)
-
-/* XXX: implement NUMA support */
-#define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
-#define node_start_pfn(nid) (mfn_x(first_valid_mfn))
-#define __node_distance(a, b) (20)
-
-#define arch_want_default_dmazone() (false)
-
-#endif /* __ASM_PPC_NUMA_H__ */
xen/common/page_alloc.c +0 -0
@@ -138,7 +138,6 @@
  #include <xen/spinlock.h>


 #include <asm/flushtlb.h>
-#include <asm/numa.h>
 #include <asm/page.h>

 #include <public/sysctl.h>

xen/common/sysctl.c +1 -1
@@ -22,8 +22,8 @@
  #include <asm/current.h>
  #include <xen/hypercall.h>
  #include <public/sysctl.h>
-#include <asm/numa.h>
  #include <xen/nodemask.h>
+#include <xen/numa.h>
  #include <xsm/xsm.h>
  #include <xen/pmstat.h>
  #include <xen/livepatch.h>
xen/include/xen/domain.h +0 -0
@@ -2,6 +2,7 @@
  #ifndef __XEN_DOMAIN_H__
  #define __XEN_DOMAIN_H__


+#include <xen/numa.h>
 #include <xen/types.h>

 #include <public/xen.h>

xen/include/xen/domain.h +0 -0
@@ -12,7 +13,6 @@ struct guest_area {
  };


 #include <asm/domain.h>
-#include <asm/numa.h>

 typedef union {
     struct vcpu_guest_context *nat;

xen/include/xen/numa.h +0 -0
@@ -2,7 +2,13 @@
  #define _XEN_NUMA_H


 #include <xen/mm-frame.h>

xen/include/xen/numa.h +3 -0
+
+#ifdef CONFIG_NUMA
+#include <xen/pdx.h>

 #include <asm/numa.h>

xen/include/xen/numa.h +3 -0
+#else
+typedef uint8_t nodeid_t;
+#endif


 #define NUMA_NO_NODE     0xFF
 #define NUMA_NO_DISTANCE 0xFF

xen/include/xen/numa.h +0 -0
@@ -108,8 +114,18 @@ extern void numa_set_processor_nodes_par


 #else

xen/include/xen/numa.h +6 -0
+/* Fake one node for now. See also node_online_map. */
+#define cpu_to_node(cpu) 0
+#define node_to_cpumask(node)   cpu_online_map
+
+#define arch_want_default_dmazone() false
+

 extern mfn_t first_valid_mfn;

xen/include/xen/numa.h +4 -0
+#define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
+#define node_start_pfn(nid) mfn_x(first_valid_mfn)
+#define __node_distance(a, b) 20
+

 static inline nodeid_t mfn_to_nid(mfn_t mfn)
 {
     return 0;

xen/include/xen/pci.h +1 -1
@@ -11,10 +11,10 @@
  #include <xen/list.h>
  #include <xen/spinlock.h>
  #include <xen/irq.h>
+#include <xen/numa.h>
  #include <xen/pci_regs.h>
  #include <xen/pfn.h>
  #include <asm/device.h>
-#include <asm/numa.h>


 /*
  * The PCI interface treats multi-function devices as independent

#3 lore raw

Ping: [PATCH v2] NUMA: no need for asm/numa.h when !NUMA

In reply to Jan Beulich
Quoted 9 lines · Jan Beulich

There's no point in every architecture carrying the same stubs for the case when NUMA isn't enabled (or even supported). Move all of that to xen/numa.h; replace explicit uses of asm/numa.h in common code. Make inclusion of asm/numa.h dependent upon NUMA=y.

Drop the no longer applicable "implement NUMA support" comments - in a !NUMA section this simply makes no sense.

May I please ask for an Arm ack (or otherwise) here?

Thanks, Jan

Quoted 157 lines
xen/arch/arm/include/asm/numa.h deleted +0 -31
@@ -1,31 +0,0 @@
-#ifndef __ARCH_ARM_NUMA_H
-#define __ARCH_ARM_NUMA_H
-
-#include <xen/mm.h>
-
-typedef u8 nodeid_t;
-
-#ifndef CONFIG_NUMA
-
-/* Fake one node for now. See also node_online_map. */
-#define cpu_to_node(cpu) 0
-#define node_to_cpumask(node)   (cpu_online_map)
-
-/* XXX: implement NUMA support */
-#define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
-#define node_start_pfn(nid) (mfn_x(first_valid_mfn))
-#define __node_distance(a, b) (20)
-
-#endif
-
-#define arch_want_default_dmazone() (false)
-
-#endif /* __ARCH_ARM_NUMA_H */
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
xen/arch/arm/smpboot.c +1 -1
@@ -42,7 +42,7 @@ integer_param("maxcpus", max_cpus);
 /* CPU logical map: map xen cpuid to an MPIDR */
 register_t __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = MPIDR_INVALID };
 
-/* Fake one node for now. See also asm/numa.h */
+/* Fake one node for now. See also xen/numa.h */
 nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
 
 /* Xen stack for bringing up the first CPU. */
xen/arch/ppc/include/asm/numa.h deleted +0 -20
@@ -1,20 +0,0 @@
-#ifndef __ASM_PPC_NUMA_H__
-#define __ASM_PPC_NUMA_H__
-
-#include <xen/types.h>
-#include <xen/mm.h>
-
-typedef uint8_t nodeid_t;
-
-/* Fake one node for now. See also node_online_map. */
-#define cpu_to_node(cpu) 0
-#define node_to_cpumask(node)   (cpu_online_map)
-
-/* XXX: implement NUMA support */
-#define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
-#define node_start_pfn(nid) (mfn_x(first_valid_mfn))
-#define __node_distance(a, b) (20)
-
-#define arch_want_default_dmazone() (false)
-
-#endif /* __ASM_PPC_NUMA_H__ */
xen/common/page_alloc.c +0 -1
@@ -138,7 +138,6 @@
 #include <xen/spinlock.h>
 
 #include <asm/flushtlb.h>
-#include <asm/numa.h>
 #include <asm/page.h>
 
 #include <public/sysctl.h>
xen/common/sysctl.c +1 -1
@@ -22,8 +22,8 @@
 #include <asm/current.h>
 #include <xen/hypercall.h>
 #include <public/sysctl.h>
-#include <asm/numa.h>
 #include <xen/nodemask.h>
+#include <xen/numa.h>
 #include <xsm/xsm.h>
 #include <xen/pmstat.h>
 #include <xen/livepatch.h>
xen/include/xen/domain.h +1 -1
@@ -2,6 +2,7 @@
 #ifndef __XEN_DOMAIN_H__
 #define __XEN_DOMAIN_H__
 
+#include <xen/numa.h>
 #include <xen/types.h>
 
 #include <public/xen.h>
@@ -12,7 +13,6 @@ struct guest_area {
 };
 
 #include <asm/domain.h>
-#include <asm/numa.h>
 
 typedef union {
     struct vcpu_guest_context *nat;
xen/include/xen/numa.h +16 -0
@@ -2,7 +2,13 @@
 #define _XEN_NUMA_H
 
 #include <xen/mm-frame.h>
+
+#ifdef CONFIG_NUMA
+#include <xen/pdx.h>
 #include <asm/numa.h>
+#else
+typedef uint8_t nodeid_t;
+#endif
 
 #define NUMA_NO_NODE     0xFF
 #define NUMA_NO_DISTANCE 0xFF
@@ -108,8 +114,18 @@ extern void numa_set_processor_nodes_par
 
 #else
 
+/* Fake one node for now. See also node_online_map. */
+#define cpu_to_node(cpu) 0
+#define node_to_cpumask(node)   cpu_online_map
+
+#define arch_want_default_dmazone() false
+
 extern mfn_t first_valid_mfn;
 
+#define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
+#define node_start_pfn(nid) mfn_x(first_valid_mfn)
+#define __node_distance(a, b) 20
+
 static inline nodeid_t mfn_to_nid(mfn_t mfn)
 {
     return 0;
xen/include/xen/pci.h +1 -1
@@ -11,10 +11,10 @@
 #include <xen/list.h>
 #include <xen/spinlock.h>
 #include <xen/irq.h>
+#include <xen/numa.h>
 #include <xen/pci_regs.h>
 #include <xen/pfn.h>
 #include <asm/device.h>
-#include <asm/numa.h>
 
 /*
  * The PCI interface treats multi-function devices as independent
Acked-by
#4 lore raw

Re: Ping: [PATCH v2] NUMA: no need for asm/numa.h when !NUMA

Hi Jan,

Quoted 6 lines · Jan Beulich
Quoted 5 lines · Jan Beulich

There's no point in every architecture carrying the same stubs for the case when NUMA isn't enabled (or even supported). Move all of that to xen/numa.h; replace explicit uses of asm/numa.h in common code. Make inclusion of asm/numa.h dependent upon NUMA=y.

Quoted 6 lines
Quoted 4 lines

Drop the no longer applicable "implement NUMA support" comments - in a !NUMA section this simply makes no sense.

May I please ask for an Arm ack (or otherwise) here?

Thanks for the reminder.

Cheers,

Signature · 1 line
Julien Grall