Skip to content

Commit 2dd57d3

Browse files
djbwtorvalds
authored andcommitted
x86/numa: cleanup configuration dependent command-line options
Patch series "device-dax: Support sub-dividing soft-reserved ranges", v5. The device-dax facility allows an address range to be directly mapped through a chardev, or optionally hotplugged to the core kernel page allocator as System-RAM. It is the mechanism for converting persistent memory (pmem) to be used as another volatile memory pool i.e. the current Memory Tiering hot topic on linux-mm. In the case of pmem the nvdimm-namespace-label mechanism can sub-divide it, but that labeling mechanism is not available / applicable to soft-reserved ("EFI specific purpose") memory [3]. This series provides a sysfs-mechanism for the daxctl utility to enable provisioning of volatile-soft-reserved memory ranges. The motivations for this facility are: 1/ Allow performance differentiated memory ranges to be split between kernel-managed and directly-accessed use cases. 2/ Allow physical memory to be provisioned along performance relevant address boundaries. For example, divide a memory-side cache [4] along cache-color boundaries. 3/ Parcel out soft-reserved memory to VMs using device-dax as a security / permissions boundary [5]. Specifically I have seen people (ab)using memmap=nn!ss (mark System-RAM as Persistent Memory) just to get the device-dax interface on custom address ranges. A follow-on for the VM use case is to teach device-dax to dynamically allocate 'struct page' at runtime to reduce the duplication of 'struct page' space in both the guest and the host kernel for the same physical pages. [2]: http://lore.kernel.org/r/[email protected] [3]: http://lore.kernel.org/r/157309097008.1579826.12818463304589384434.stgit@dwillia2-desk3.amr.corp.intel.com [4]: http://lore.kernel.org/r/154899811738.3165233.12325692939590944259.stgit@dwillia2-desk3.amr.corp.intel.com [5]: http://lore.kernel.org/r/[email protected] This patch (of 23): In preparation for adding a new numa= option clean up the existing ones to avoid ifdefs in numa_setup(), and provide feedback when the option is numa=fake= option is invalid due to kernel config. The same does not need to be done for numa=noacpi, since the capability is already hard disabled at compile-time. Suggested-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Dan Williams <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Ben Skeggs <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brice Goglin <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Dave Jiang <[email protected]> Cc: David Airlie <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Ira Weiny <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Jeff Moyer <[email protected]> Cc: Jia He <[email protected]> Cc: Joao Martins <[email protected]> Cc: Jonathan Cameron <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Pavel Tatashin <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rafael J. Wysocki <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Tom Lendacky <[email protected]> Cc: Vishal Verma <[email protected]> Cc: Wei Yang <[email protected]> Cc: Will Deacon <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: Hulk Robot <[email protected]> Cc: Jason Yan <[email protected]> Cc: "Jérôme Glisse" <[email protected]> Cc: Juergen Gross <[email protected]> Cc: kernel test robot <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Stefano Stabellini <[email protected]> Cc: Vivek Goyal <[email protected]> Link: https://lkml.kernel.org/r/160106109960.30709.7379926726669669398.stgit@dwillia2-desk3.amr.corp.intel.com Link: https://lkml.kernel.org/r/159643094279.4062302.17779410714418721328.stgit@dwillia2-desk3.amr.corp.intel.com Link: https://lkml.kernel.org/r/159643094925.4062302.14979872973043772305.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Linus Torvalds <[email protected]>
1 parent 1abbef4 commit 2dd57d3

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed

arch/x86/include/asm/numa.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define _ASM_X86_NUMA_H
44

55
#include <linux/nodemask.h>
6+
#include <linux/errno.h>
67

78
#include <asm/topology.h>
89
#include <asm/apicdef.h>
@@ -77,7 +78,12 @@ void debug_cpumask_set_cpu(int cpu, int node, bool enable);
7778
#ifdef CONFIG_NUMA_EMU
7879
#define FAKE_NODE_MIN_SIZE ((u64)32 << 20)
7980
#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
80-
void numa_emu_cmdline(char *);
81+
int numa_emu_cmdline(char *str);
82+
#else /* CONFIG_NUMA_EMU */
83+
static inline int numa_emu_cmdline(char *str)
84+
{
85+
return -EINVAL;
86+
}
8187
#endif /* CONFIG_NUMA_EMU */
8288

8389
#endif /* _ASM_X86_NUMA_H */

arch/x86/mm/numa.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,10 @@ static __init int numa_setup(char *opt)
3737
return -EINVAL;
3838
if (!strncmp(opt, "off", 3))
3939
numa_off = 1;
40-
#ifdef CONFIG_NUMA_EMU
4140
if (!strncmp(opt, "fake=", 5))
42-
numa_emu_cmdline(opt + 5);
43-
#endif
44-
#ifdef CONFIG_ACPI_NUMA
41+
return numa_emu_cmdline(opt + 5);
4542
if (!strncmp(opt, "noacpi", 6))
46-
acpi_numa = -1;
47-
#endif
43+
disable_srat();
4844
return 0;
4945
}
5046
early_param("numa", numa_setup);

arch/x86/mm/numa_emulation.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
static int emu_nid_to_phys[MAX_NUMNODES];
1414
static char *emu_cmdline __initdata;
1515

16-
void __init numa_emu_cmdline(char *str)
16+
int __init numa_emu_cmdline(char *str)
1717
{
1818
emu_cmdline = str;
19+
return 0;
1920
}
2021

2122
static int __init emu_find_memblk_by_nid(int nid, const struct numa_meminfo *mi)

arch/x86/xen/enlighten_pv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
13001300
* any NUMA information the kernel tries to get from ACPI will
13011301
* be meaningless. Prevent it from trying.
13021302
*/
1303-
acpi_numa = -1;
1303+
disable_srat();
13041304
#endif
13051305
WARN_ON(xen_cpuhp_setup(xen_cpu_up_prepare_pv, xen_cpu_dead_pv));
13061306

drivers/acpi/numa/srat.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ static int node_to_pxm_map[MAX_NUMNODES]
2727
= { [0 ... MAX_NUMNODES - 1] = PXM_INVAL };
2828

2929
unsigned char acpi_srat_revision __initdata;
30-
int acpi_numa __initdata;
30+
static int acpi_numa __initdata;
31+
32+
void __init disable_srat(void)
33+
{
34+
acpi_numa = -1;
35+
}
3136

3237
int pxm_to_node(int pxm)
3338
{
@@ -163,7 +168,7 @@ static int __init slit_valid(struct acpi_table_slit *slit)
163168
void __init bad_srat(void)
164169
{
165170
pr_err("SRAT: SRAT not used.\n");
166-
acpi_numa = -1;
171+
disable_srat();
167172
}
168173

169174
int __init srat_disabled(void)

include/acpi/acpi_numa.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ extern int pxm_to_node(int);
1717
extern int node_to_pxm(int);
1818
extern int acpi_map_pxm_to_node(int);
1919
extern unsigned char acpi_srat_revision;
20-
extern int acpi_numa __initdata;
20+
extern void disable_srat(void);
2121

2222
extern void bad_srat(void);
2323
extern int srat_disabled(void);
2424

25+
#else /* CONFIG_ACPI_NUMA */
26+
static inline void disable_srat(void)
27+
{
28+
}
2529
#endif /* CONFIG_ACPI_NUMA */
2630
#endif /* __ACP_NUMA_H */

0 commit comments

Comments
 (0)