From: Mike Travis <travis@sgi.com>
To: Ingo Molnar <mingo@elte.hu>,
Jeremy Fitzhardinge <jeremy@goop.org>,
"Eric W. Biederman" <ebiederm@xmission.com>
Cc: Christoph Lameter <cl@linux-foundation.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: [RFC 1/5] x86_64: Fix early references to cpumask_of_cpu
Date: Tue, 01 Jul 2008 05:16:35 -0700 [thread overview]
Message-ID: <20080701121635.056353000@polaris-admin.engr.sgi.com> (raw)
In-Reply-To: <20080701121634.865966000@polaris-admin.engr.sgi.com>
[-- Attachment #1: cleanup_percpu --]
[-- Type: text/plain, Size: 1795 bytes --]
* Initialize the cpumask_of_cpu_map to contain a cpumask for cpu 0
in the initdata section. This allows references before the real
cpumask_of_cpu_map is setup avoiding possible null pointer deref
panics.
Based on linux-2.6.tip/master
Signed-off-by: Mike Travis <travis@sgi.com>
---
arch/x86/kernel/setup_percpu.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
--- linux-2.6.tip.orig/arch/x86/kernel/setup_percpu.c
+++ linux-2.6.tip/arch/x86/kernel/setup_percpu.c
@@ -51,7 +51,7 @@ static void __init setup_node_to_cpumask
static inline void setup_node_to_cpumask_map(void) { }
#endif
-#if defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) && defined(CONFIG_SMP)
+#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
/*
* Copy data used in early init routines from the initial arrays to the
* per cpu data areas. These arrays then become expendable and the
@@ -81,16 +81,25 @@ static void __init setup_per_cpu_maps(vo
}
#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP
-cpumask_t *cpumask_of_cpu_map __read_mostly;
+
+/* Configure an initial cpumask_of_cpu(0) for early users */
+static cpumask_t initial_cpumask_of_cpu_map __initdata = (cpumask_t) { {
+ [BITS_TO_LONGS(NR_CPUS)-1] = 1
+} };
+cpumask_t *cpumask_of_cpu_map __read_mostly =
+ (cpumask_t *)&initial_cpumask_of_cpu_map;
EXPORT_SYMBOL(cpumask_of_cpu_map);
-/* requires nr_cpu_ids to be initialized */
+/* Requires nr_cpu_ids to be initialized */
static void __init setup_cpumask_of_cpu(void)
{
int i;
/* alloc_bootmem zeroes memory */
cpumask_of_cpu_map = alloc_bootmem_low(sizeof(cpumask_t) * nr_cpu_ids);
+#ifdef CONFIG_DEBUG_PER_CPU_MAPS
+ printk(KERN_DEBUG "cpumask_of_cpu_map %p\n", cpumask_of_cpu_map);
+#endif
for (i = 0; i < nr_cpu_ids; i++)
cpu_set(i, cpumask_of_cpu_map[i]);
}
--
next prev parent reply other threads:[~2008-07-01 12:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-01 12:16 [RFC 0/5] percpu: Optimize percpu accesses Mike Travis
2008-07-01 12:16 ` Mike Travis [this message]
2008-07-01 12:16 ` [RFC 2/5] x86_64: Fold pda into per cpu area Mike Travis
2008-07-01 12:16 ` [RFC 3/5] x86_64: Reference zero-based percpu variables offset from gs Mike Travis
2008-07-01 12:16 ` [RFC 4/5] x86_64: Replace cpu_pda ops with percpu ops Mike Travis
2008-07-01 12:16 ` [RFC 5/5] x86_64: Replace xxx_pda() operations with x86_xxx_percpu() Mike Travis
2008-07-01 14:54 ` [RFC 0/5] percpu: Optimize percpu accesses Ingo Molnar
2008-07-01 15:03 ` Ingo Molnar
2008-07-01 15:07 ` Mike Travis
2008-07-02 14:04 ` Mike Travis
2008-07-18 6:52 ` Ingo Molnar
2008-07-01 18:47 ` Mike Travis
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=20080701121635.056353000@polaris-admin.engr.sgi.com \
--to=travis@sgi.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
all inboxes | Powered by JetHome®