From: tip-bot for David Rientjes <rientjes@google.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
jj@chaosbits.net, tj@kernel.org, tglx@linutronix.de,
rientjes@google.com, mingo@elte.hu
Subject: [tip:x86/numa] x86, numa: Add error handling for bad cpu-to-node mappings
Date: Mon, 14 Feb 2011 13:55:30 GMT [thread overview]
Message-ID: <tip-14392fd329eca9b59d51c0aa5d0acfb4965424d1@git.kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.00.1102071407250.7812@chino.kir.corp.google.com>
Commit-ID: 14392fd329eca9b59d51c0aa5d0acfb4965424d1
Gitweb: http://git.kernel.org/tip/14392fd329eca9b59d51c0aa5d0acfb4965424d1
Author: David Rientjes <rientjes@google.com>
AuthorDate: Mon, 7 Feb 2011 14:08:53 -0800
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 14 Feb 2011 13:29:27 +0100
x86, numa: Add error handling for bad cpu-to-node mappings
CONFIG_DEBUG_PER_CPU_MAPS may return NUMA_NO_NODE when an
early_cpu_to_node() mapping hasn't been initialized. In such a
case, it emits a warning and continues without an issue but
callers may try to use the return value to index into an array.
We can catch those errors and fail silently since a warning has
already been emitted. No current user of numa_add_cpu()
requires this error checking to avoid a crash, but it's better
to be proactive in case a future user happens to have a bug and
a user tries to diagnose it with CONFIG_DEBUG_PER_CPU_MAPS.
Reported-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Tejun Heo <tj@kernel.org>
LKML-Reference: <alpine.DEB.2.00.1102071407250.7812@chino.kir.corp.google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/mm/numa.c | 4 ++++
arch/x86/mm/numa_64.c | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index bf60715..9559d36 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -219,6 +219,10 @@ struct cpumask __cpuinit *debug_cpumask_set_cpu(int cpu, int enable)
struct cpumask *mask;
char buf[64];
+ if (node == NUMA_NO_NODE) {
+ /* early_cpu_to_node() already emits a warning and trace */
+ return NULL;
+ }
mask = node_to_cpumask_map[node];
if (!mask) {
pr_err("node_to_cpumask_map[%i] NULL\n", node);
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index f548fbf..3f9411e 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -709,6 +709,10 @@ static void __cpuinit numa_set_cpumask(int cpu, int enable)
struct cpumask *mask;
int i;
+ if (node == NUMA_NO_NODE) {
+ /* early_cpu_to_node() already emits a warning and trace */
+ return;
+ }
for_each_online_node(i) {
unsigned long addr;
prev parent reply other threads:[~2011-02-14 18:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-07 22:08 [patch] " David Rientjes
2011-02-14 13:55 ` tip-bot for David Rientjes [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-14392fd329eca9b59d51c0aa5d0acfb4965424d1@git.kernel.org \
--to=rientjes@google.com \
--cc=hpa@zytor.com \
--cc=jj@chaosbits.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome