projects/linux·commit 033ab7f8

[PATCH] add smp_setup_processor_id()

033ab7f8 · Andrew Morton <[email protected]> · 2006-06-30 01:55:50 -07:00

Presently, smp_processor_id() isn't necessarily set up until setup_arch().
But it's used in boot_cpu_init() and printk() and perhaps in other places,
prior to setup_arch() being called.

So provide a new smp_setup_processor_id() which is called before anything
else, wire it up for Voyager (which boots on a CPU other than #0, and broke).

Cc: James Bottomley <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
033ab7f8e5c655f49ec8039930b2efd412abbbd7
Parents
a1836a42

Changes

3 files changed · +15 −0

FileStatusAddDelContent
arch/i386/mach-voyager/voyager_smp.cmodified+6−0View file
include/linux/smp.hmodified+2−0View file
init/main.cmodified+7−0View file

arch/i386/mach-voyager/voyager_smp.c

View file
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
index 5b8b579..6e9e494 100644
--- a/arch/i386/mach-voyager/voyager_smp.c
+++ b/arch/i386/mach-voyager/voyager_smp.c
@@ -1938,3 +1938,9 @@ smp_cpus_done(unsigned int max_cpus)
{
zap_low_mappings();
}
+
+void __init
+smp_setup_processor_id(void)
+{
+ current_thread_info()->cpu = hard_smp_processor_id();
+}

include/linux/smp.h

View file
diff --git a/include/linux/smp.h b/include/linux/smp.h
index c93c3fe..837e8bc 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -125,4 +125,6 @@ static inline void smp_send_reschedule(int cpu) { }
#define put_cpu() preempt_enable()
#define put_cpu_no_resched() preempt_enable_no_resched()
+void smp_setup_processor_id(void);
+
#endif /* __LINUX_SMP_H */

init/main.c

View file
diff --git a/init/main.c b/init/main.c
index bce0eb7..ae04eb7 100644
--- a/init/main.c
+++ b/init/main.c
@@ -446,10 +446,17 @@ static void __init boot_cpu_init(void)
cpu_set(cpu, cpu_possible_map);
}
+void __init __attribute__((weak)) smp_setup_processor_id(void)
+{
+}
+
asmlinkage void __init start_kernel(void)
{
char * command_line;
extern struct kernel_param __start___param[], __stop___param[];
+
+ smp_setup_processor_id();
+
/*
* Interrupts are still disabled. Do necessary setups, then
* enable them