Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1804487pxa; Sun, 2 Aug 2020 22:19:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhzlUT4moZBMosI6XQ0mCpY747HhSvUhny4iwr8Hm0j0fyGL80QQeQIzdShJ4/ldSdEyJB X-Received: by 2002:a17:906:3b91:: with SMTP id u17mr14647631ejf.305.1596431968502; Sun, 02 Aug 2020 22:19:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596431968; cv=none; d=google.com; s=arc-20160816; b=El6/2+n0kd2s8XvAFHPmoQDuvNHRMm+8aus6lihHeYa3k3mJUwtUWNqfmGEzwX0i07 Sd7SIKfcE5F9X9Raqm98v8liJkhGqqK8+S3RR97G+SBEXLXLpdS0Pey08NGLmntLNIBt hN6ulNdcHVyfw6S1X+2bsxuAKrxVmzbBNhTp6IHaXbIXA0zMsBJ+syyEZUpWukpuJju9 VN7Twxrz7Mnd1aIo4Z8Nji0G3UE7QBP2kYNl6U2kooTP0gvbGV7zrEbJJkvDHXpVmkQy 6bfOkL5NRs0TE8HA8aYKzZZbA15G0AT3m9soRLYm/Or9omQGg18s4+bF0ZRxvaAJKyqV 6gGQ== 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=67PovC+dT6JwuszF1LM7/E4HpbP5PjAHndiCLnmg9OM=; b=YwPFzgQ3A24Ja8OQz4EJeKk9nU2Px621LQUE9IzolVBk0/scjC4nP2P66pokJcv1JL moc2FKwogNzmL6KNFPSRuHfu1JAAHRK5YZl+YI+22//d6Ze7r3SPwNagVV/56iamn/d7 smzjmcdkBKKwx6HQ6BvGlnTHoDEDF4eNJsm8YcaAMd5C0lcDZzC0NzoQs7LVefigknwC UOVyroOzVyl8eHmfFcqnuq5ipA128PyGeDTqJJieTopI4ty6QXPbtsyWEDEeUvzg3C5I 5Q4yVQ5ZFFDmzagXMjPjg2EOwqWfKbyQqW2blbHJ8fTzeAfjZMHSa1va2GMIDroadDn8 JTow== 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 lt11si9633806ejb.436.2020.08.02.22.19.06; Sun, 02 Aug 2020 22:19:28 -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 S1727998AbgHCFSt (ORCPT + 99 others); Mon, 3 Aug 2020 01:18:49 -0400 Received: from mga01.intel.com ([192.55.52.88]:43852 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725976AbgHCFSt (ORCPT ); Mon, 3 Aug 2020 01:18:49 -0400 IronPort-SDR: SWfO5qlGIYRpILY9CKtZJ8g9BKhEsyvh9spsJL40VjiVffIo7+/S7WPI9SpWyIDXVIPPJvISW9 S6GnRzE3NupQ== X-IronPort-AV: E=McAfee;i="6000,8403,9701"; a="170149580" X-IronPort-AV: E=Sophos;i="5.75,429,1589266800"; d="scan'208";a="170149580" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2020 22:18:48 -0700 IronPort-SDR: +LCo4bUedE9nSXjlPM0EiHjD/pUiDmLmNnkXsuPF93u0uWOap47Cu0f/ERcv+JjvZ3jZ5vs8Rq cro0K03v4+5A== X-IronPort-AV: E=Sophos;i="5.75,429,1589266800"; d="scan'208";a="275084755" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2020 22:18:48 -0700 Subject: [PATCH v4 01/23] x86/numa: Cleanup configuration dependent command-line options From: Dan Williams To: akpm@linux-foundation.org Cc: "Rafael J. Wysocki" , peterz@infradead.org, vishal.l.verma@intel.com, dave.hansen@linux.intel.com, ard.biesheuvel@linaro.org, vishal.l.verma@intel.com, linux-mm@kvack.org, linux-nvdimm@lists.01.org, joao.m.martins@oracle.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org Date: Sun, 02 Aug 2020 22:02:29 -0700 Message-ID: <159643094925.4062302.14979872973043772305.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <159643094279.4062302.17779410714418721328.stgit@dwillia2-desk3.amr.corp.intel.com> References: <159643094279.4062302.17779410714418721328.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 aa76ec2d359b..87c52822cc44 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 2aab43a13a8c..64b81ba5a4d6 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -1350,7 +1350,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 15bbaab8500b..1b0ae0a1959b 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 */