Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp394600ybh; Sun, 12 Jul 2020 09:44:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFG2LcUDhbx1zQgZKZ06UG6IRUy5KoTzy3PGfYfRGV2UG9s/rOC3XC/r6cf8AI4pueh+Eg X-Received: by 2002:a50:f08c:: with SMTP id v12mr85723501edl.119.1594572264972; Sun, 12 Jul 2020 09:44:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594572264; cv=none; d=google.com; s=arc-20160816; b=KqroXYSAjc92aiMyiJtyrv+a9T2cQQ6wnwB8hqufOqVOR8oj/Xotcuy3xohVWd1fy4 A2ztDb61V9yu1iunCO2Taba844zcLDL9DlhvwgIH5wTmcSH9OWzyxfcNw8WotVQYgAMj 4MHWUIhlHieei87oCCKKGnbhI2FC6uNyhcBEqJzrwP7Wbjs3ispR8hBPkN0tZJfPvW1h 2bFikh6t4gbAv/SA+bdLJ09HASec3ZC6sGwETDsh1As10iKRdybOu9uXkJ1cPE4uuwSa 5NrrVNRxVzdW28X9QuJyoPKtDQ3O0ZCLQwbNqgXK63R1D0HmJvLMLbNxHG1yY7ti3jhe ryFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:ironport-sdr:ironport-sdr; bh=vRzcmrx5gKD22Fy5Cl89sOCTMcw7BHfnzMjC7NYmBV8=; b=jXEftxg9tG4HTVHFIQYUnwk1rJIXgSUH+NvgqrFiM9KhVtshSk3M4XOQ2HW1xCyksS N64CaHpsm8FmUljQ7i3ymAvTch+6ey9A0sgmdk6+tsr0d3bfBuR3fYedKK0dvrdu7YO7 Mu5GNscpyoguvNM4yFDduGEC5MEF+GvIUOBBLatA7YiBJGKcZTTZVHwt9O9pBAQbMHlC HXJOEEfnO+XP2nTYYSF/4oFVNrOuZL9HgahDJojfasOp6P0mpdJVibIV6qshPdcCuSL7 g4MYz585bdYyatpo0q4zINruFHx+Xq+urrzLDe4qEBMiv0PZ+DNOn6PoGdi8iy/yPTIV nrYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ci27si7915363ejc.179.2020.07.12.09.44.02; Sun, 12 Jul 2020 09:44:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729103AbgGLQm2 (ORCPT + 99 others); Sun, 12 Jul 2020 12:42:28 -0400 Received: from mga14.intel.com ([192.55.52.115]:51824 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728854AbgGLQm2 (ORCPT ); Sun, 12 Jul 2020 12:42:28 -0400 IronPort-SDR: Ran2BhilUHsS1HbeESkRA7r5vp/6cn783a27uV/8qmddCKH3fDxLOzRsFhiXwqXEdqd6+D6Vid ApSUADMxBhqA== X-IronPort-AV: E=McAfee;i="6000,8403,9680"; a="147629322" X-IronPort-AV: E=Sophos;i="5.75,344,1589266800"; d="scan'208";a="147629322" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2020 09:42:27 -0700 IronPort-SDR: H60s918+CnHnIBnVJTgyutixuOg9lXKjRXuPVavVha1GmCwdLE8Mc23fia6RxC3lKCN2ITXG6f F3hq1PC0tMXg== X-IronPort-AV: E=Sophos;i="5.75,344,1589266800"; d="scan'208";a="315837976" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2020 09:42:27 -0700 Subject: [PATCH v2 01/22] x86/numa: Cleanup configuration dependent command-line options From: Dan Williams To: linux-nvdimm@lists.01.org Cc: "Rafael J. Wysocki" , peterz@infradead.org, vishal.l.verma@intel.com, dave.hansen@linux.intel.com, ard.biesheuvel@linaro.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, hch@lst.de, joao.m.martins@oracle.com Date: Sun, 12 Jul 2020 09:26:11 -0700 Message-ID: <159457117137.754248.3802690827107465125.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com> References: <159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Dan Williams --- arch/x86/include/asm/numa.h | 8 +++++++- arch/x86/mm/numa.c | 8 ++------ arch/x86/mm/numa_emulation.c | 3 ++- arch/x86/xen/enlighten_pv.c | 2 +- drivers/acpi/numa/srat.c | 9 +++++++-- include/acpi/acpi_numa.h | 6 +++++- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index bbfde3d2662f..0aecc0b629e0 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h @@ -3,6 +3,7 @@ #define _ASM_X86_NUMA_H #include +#include #include #include @@ -77,7 +78,12 @@ void debug_cpumask_set_cpu(int cpu, int node, bool enable); #ifdef CONFIG_NUMA_EMU #define FAKE_NODE_MIN_SIZE ((u64)32 << 20) #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) -void numa_emu_cmdline(char *); +int numa_emu_cmdline(char *str); +#else /* CONFIG_NUMA_EMU */ +static inline int numa_emu_cmdline(char *str) +{ + return -EINVAL; +} #endif /* CONFIG_NUMA_EMU */ #endif /* _ASM_X86_NUMA_H */ diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 8ee952038c80..ee24646dc44e 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -37,14 +37,10 @@ static __init int numa_setup(char *opt) return -EINVAL; if (!strncmp(opt, "off", 3)) numa_off = 1; -#ifdef CONFIG_NUMA_EMU if (!strncmp(opt, "fake=", 5)) - numa_emu_cmdline(opt + 5); -#endif -#ifdef CONFIG_ACPI_NUMA + return numa_emu_cmdline(opt + 5); if (!strncmp(opt, "noacpi", 6)) - acpi_numa = -1; -#endif + disable_srat(); return 0; } early_param("numa", numa_setup); diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index c5174b4e318b..847c23196e57 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c @@ -13,9 +13,10 @@ static int emu_nid_to_phys[MAX_NUMNODES]; static char *emu_cmdline __initdata; -void __init numa_emu_cmdline(char *str) +int __init numa_emu_cmdline(char *str) { emu_cmdline = str; + return 0; } static int __init emu_find_memblk_by_nid(int nid, const struct numa_meminfo *mi) diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index acc49fa6a097..39321b49b65d 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -1318,7 +1318,7 @@ asmlinkage __visible void __init xen_start_kernel(void) * any NUMA information the kernel tries to get from ACPI will * be meaningless. Prevent it from trying. */ - acpi_numa = -1; + disable_srat(); #endif WARN_ON(xen_cpuhp_setup(xen_cpu_up_prepare_pv, xen_cpu_dead_pv)); diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index 5be5a977da1b..09a5e54d8575 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c @@ -27,7 +27,12 @@ static int node_to_pxm_map[MAX_NUMNODES] = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL }; unsigned char acpi_srat_revision __initdata; -int acpi_numa __initdata; +static int acpi_numa __initdata; + +void __init disable_srat(void) +{ + acpi_numa = -1; +} int pxm_to_node(int pxm) { @@ -163,7 +168,7 @@ static int __init slit_valid(struct acpi_table_slit *slit) void __init bad_srat(void) { pr_err("SRAT: SRAT not used.\n"); - acpi_numa = -1; + disable_srat(); } int __init srat_disabled(void) diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h index fdebcfc6c8df..8784183b2204 100644 --- a/include/acpi/acpi_numa.h +++ b/include/acpi/acpi_numa.h @@ -17,10 +17,14 @@ extern int pxm_to_node(int); extern int node_to_pxm(int); extern int acpi_map_pxm_to_node(int); extern unsigned char acpi_srat_revision; -extern int acpi_numa __initdata; +extern void disable_srat(void); extern void bad_srat(void); extern int srat_disabled(void); +#else /* CONFIG_ACPI_NUMA */ +static inline void disable_srat(void) +{ +} #endif /* CONFIG_ACPI_NUMA */ #endif /* __ACP_NUMA_H */