mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brian Gerst <brgerst@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>, linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] x86: Fix abuse of per_cpu_offset
Date: Sun,  8 Feb 2009 09:58:40 -0500	[thread overview]
Message-ID: <1234105120-19731-3-git-send-email-brgerst@gmail.com> (raw)
In-Reply-To: <1234105120-19731-1-git-send-email-brgerst@gmail.com>

Impact: bug fix

Don't use per_cpu_offset() to determine if it valid to access a
per-cpu variable for a given cpu number.  It is not a valid assumption
on x86-64 anymore.  Use cpu_possible() instead.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 arch/x86/mm/numa_64.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 08d140f..deb1c1a 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -702,7 +702,7 @@ void __cpuinit numa_set_node(int cpu, int node)
 	}
 
 #ifdef CONFIG_DEBUG_PER_CPU_MAPS
-	if (cpu >= nr_cpu_ids || !per_cpu_offset(cpu)) {
+	if (cpu >= nr_cpu_ids || !cpu_possible(cpu)) {
 		printk(KERN_ERR "numa_set_node: invalid cpu# (%d)\n", cpu);
 		dump_stack();
 		return;
@@ -790,7 +790,7 @@ int early_cpu_to_node(int cpu)
 	if (early_per_cpu_ptr(x86_cpu_to_node_map))
 		return early_per_cpu_ptr(x86_cpu_to_node_map)[cpu];
 
-	if (!per_cpu_offset(cpu)) {
+	if (!cpu_possible(cpu)) {
 		printk(KERN_WARNING
 			"early_cpu_to_node(%d): no per_cpu area!\n", cpu);
 		dump_stack();
-- 
1.6.1


  parent reply	other threads:[~2009-02-08 14:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-08 14:58 [PATCH 1/3] percpu: Make PER_CPU_BASE_SECTION overridable by arches Brian Gerst
2009-02-08 14:58 ` [PATCH 2/3] x86: Use linker to offset symbols by __per_cpu_load Brian Gerst
2009-02-09  9:29   ` Ingo Molnar
2009-02-11 22:53     ` Jiri Slaby
2009-02-08 14:58 ` Brian Gerst [this message]
2009-02-09  9:31   ` [PATCH 3/3] x86: Fix abuse of per_cpu_offset Ingo Molnar
2009-02-09  9:29 ` [PATCH 1/3] percpu: Make PER_CPU_BASE_SECTION overridable by arches Ingo Molnar

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=1234105120-19731-3-git-send-email-brgerst@gmail.com \
    --to=brgerst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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