aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@suse.de>2006-07-01 07:36:18 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-01 12:56:02 -0400
commit8ec4d41f88872e6a5980558e362c0174dce54e40 (patch)
treef02eaf6b61832ded30bc19bd8e5d8494d91f8bc6
parent27b678dd04a636f2c351816f4b3042c8815d4e9d (diff)
[PATCH] SMP alternatives: skip with UP kernels
Hide the magic in alternative.h and provide some dummy inline functions for the UP case (gcc should manage to optimize away these calls). No changes in module.c. Cc: Dave Jones <davej@codemonkey.org.uk> Cc: Andi Kleen <ak@muc.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/i386/kernel/alternative.c6
-rw-r--r--include/asm-i386/alternative.h8
-rw-r--r--include/asm-x86_64/alternative.h9
3 files changed, 23 insertions, 0 deletions
diff --git a/arch/i386/kernel/alternative.c b/arch/i386/kernel/alternative.c
index 50eb0e03777e..7b421b3a053e 100644
--- a/arch/i386/kernel/alternative.c
+++ b/arch/i386/kernel/alternative.c
@@ -168,6 +168,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
168 } 168 }
169} 169}
170 170
171#ifdef CONFIG_SMP
172
171static void alternatives_smp_save(struct alt_instr *start, struct alt_instr *end) 173static void alternatives_smp_save(struct alt_instr *start, struct alt_instr *end)
172{ 174{
173 struct alt_instr *a; 175 struct alt_instr *a;
@@ -328,6 +330,8 @@ void alternatives_smp_switch(int smp)
328 spin_unlock_irqrestore(&smp_alt, flags); 330 spin_unlock_irqrestore(&smp_alt, flags);
329} 331}
330 332
333#endif
334
331void __init alternative_instructions(void) 335void __init alternative_instructions(void)
332{ 336{
333 if (no_replacement) { 337 if (no_replacement) {
@@ -349,6 +353,7 @@ void __init alternative_instructions(void)
349 smp_alt_once = 1; 353 smp_alt_once = 1;
350#endif 354#endif
351 355
356#ifdef CONFIG_SMP
352 if (smp_alt_once) { 357 if (smp_alt_once) {
353 if (1 == num_possible_cpus()) { 358 if (1 == num_possible_cpus()) {
354 printk(KERN_INFO "SMP alternatives: switching to UP code\n"); 359 printk(KERN_INFO "SMP alternatives: switching to UP code\n");
@@ -370,4 +375,5 @@ void __init alternative_instructions(void)
370 _text, _etext); 375 _text, _etext);
371 alternatives_smp_switch(0); 376 alternatives_smp_switch(0);
372 } 377 }
378#endif
373} 379}
diff --git a/include/asm-i386/alternative.h b/include/asm-i386/alternative.h
index c61bd1a17f37..96adbabec740 100644
--- a/include/asm-i386/alternative.h
+++ b/include/asm-i386/alternative.h
@@ -19,11 +19,19 @@ struct alt_instr {
19extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end); 19extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
20 20
21struct module; 21struct module;
22#ifdef CONFIG_SMP
22extern void alternatives_smp_module_add(struct module *mod, char *name, 23extern void alternatives_smp_module_add(struct module *mod, char *name,
23 void *locks, void *locks_end, 24 void *locks, void *locks_end,
24 void *text, void *text_end); 25 void *text, void *text_end);
25extern void alternatives_smp_module_del(struct module *mod); 26extern void alternatives_smp_module_del(struct module *mod);
26extern void alternatives_smp_switch(int smp); 27extern void alternatives_smp_switch(int smp);
28#else
29static inline void alternatives_smp_module_add(struct module *mod, char *name,
30 void *locks, void *locks_end,
31 void *text, void *text_end) {}
32static inline void alternatives_smp_module_del(struct module *mod) {}
33static inline void alternatives_smp_switch(int smp) {}
34#endif
27 35
28#endif 36#endif
29 37
diff --git a/include/asm-x86_64/alternative.h b/include/asm-x86_64/alternative.h
index 387c8f66af7d..aa67bfd1b3ce 100644
--- a/include/asm-x86_64/alternative.h
+++ b/include/asm-x86_64/alternative.h
@@ -17,11 +17,20 @@ struct alt_instr {
17extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end); 17extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
18 18
19struct module; 19struct module;
20
21#ifdef CONFIG_SMP
20extern void alternatives_smp_module_add(struct module *mod, char *name, 22extern void alternatives_smp_module_add(struct module *mod, char *name,
21 void *locks, void *locks_end, 23 void *locks, void *locks_end,
22 void *text, void *text_end); 24 void *text, void *text_end);
23extern void alternatives_smp_module_del(struct module *mod); 25extern void alternatives_smp_module_del(struct module *mod);
24extern void alternatives_smp_switch(int smp); 26extern void alternatives_smp_switch(int smp);
27#else
28static inline void alternatives_smp_module_add(struct module *mod, char *name,
29 void *locks, void *locks_end,
30 void *text, void *text_end) {}
31static inline void alternatives_smp_module_del(struct module *mod) {}
32static inline void alternatives_smp_switch(int smp) {}
33#endif
25 34
26#endif 35#endif
27 36