]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
[PATCH] Remove safe_smp_processor_id()
authorAndi Kleen <ak@suse.de>
Tue, 26 Sep 2006 08:52:37 +0000 (10:52 +0200)
committerAndi Kleen <andi@basil.nowhere.org>
Tue, 26 Sep 2006 08:52:37 +0000 (10:52 +0200)
And replace all users with ordinary smp_processor_id.  The function
was originally added to get some basic oops information out even
if the GS register was corrupted. However that didn't
work for some anymore because printk is needed to print the oops
and it uses smp_processor_id() already. Also GS register corruptions
are not particularly common anymore.

This also helps the Xen port which would otherwise need to
do this in a special way because it can't access the local APIC.

Cc: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Andi Kleen <ak@suse.de>
arch/x86_64/kernel/mce.c
arch/x86_64/kernel/smp.c
arch/x86_64/kernel/traps.c
include/asm-x86_64/smp.h

index 4e017fb30fb3f60c824fabc384bd895867dc90e8..1a93c3738404f6c5ede55d9dd197e86b3ab430a6 100644 (file)
@@ -182,7 +182,7 @@ void do_machine_check(struct pt_regs * regs, long error_code)
                goto out2;
 
        memset(&m, 0, sizeof(struct mce));
-       m.cpu = safe_smp_processor_id();
+       m.cpu = smp_processor_id();
        rdmsrl(MSR_IA32_MCG_STATUS, m.mcgstatus);
        if (!(m.mcgstatus & MCG_STATUS_RIPV))
                kill_it = 1;
index 2df988bbf3124bfe6356b5a4c145483d589fcf15..4f67697f5036faf1f37222ced236c0b3a04626c7 100644 (file)
@@ -522,26 +522,3 @@ asmlinkage void smp_call_function_interrupt(void)
        }
 }
 
-int safe_smp_processor_id(void)
-{
-       unsigned apicid, i;
-
-       if (disable_apic || !apic_mapped)
-               return 0;
-
-       apicid = hard_smp_processor_id();
-       if (apicid < NR_CPUS && x86_cpu_to_apicid[apicid] == apicid)
-               return apicid;
-
-       for (i = 0; i < NR_CPUS; ++i) {
-               if (x86_cpu_to_apicid[i] == apicid)
-                       return i;
-       }
-
-       /* No entries in x86_cpu_to_apicid?  Either no MPS|ACPI,
-        * or called too early.  Either way, we must be CPU 0. */
-       if (x86_cpu_to_apicid[0] == BAD_APICID)
-               return 0;
-
-       return 0; /* Should not happen */
-}
index 34660b1e2720d2d7cc4e0e96ff90c7dd0db97868..38bc821e457bf217b8f12a8e5cdc115500a54c4f 100644 (file)
@@ -264,7 +264,7 @@ static int dump_trace_unwind(struct unwind_frame_info *info, void *context)
 void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long * stack,
                struct stacktrace_ops *ops, void *data)
 {
-       const unsigned cpu = safe_smp_processor_id();
+       const unsigned cpu = smp_processor_id();
        unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr;
        unsigned used = 0;
 
@@ -429,7 +429,7 @@ _show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *rsp)
 {
        unsigned long *stack;
        int i;
-       const int cpu = safe_smp_processor_id();
+       const int cpu = smp_processor_id();
        unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr);
        unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE);
 
@@ -483,7 +483,7 @@ void show_registers(struct pt_regs *regs)
        int i;
        int in_kernel = !user_mode(regs);
        unsigned long rsp;
-       const int cpu = safe_smp_processor_id(); 
+       const int cpu = smp_processor_id();
        struct task_struct *cur = cpu_pda(cpu)->pcurrent;
 
                rsp = regs->rsp;
@@ -558,7 +558,7 @@ static unsigned int die_nest_count;
 
 unsigned __kprobes long oops_begin(void)
 {
-       int cpu = safe_smp_processor_id();
+       int cpu = smp_processor_id();
        unsigned long flags;
 
        oops_enter();
@@ -636,7 +636,7 @@ void __kprobes die_nmi(char *str, struct pt_regs *regs, int do_panic)
         * We are in trouble anyway, lets at least try
         * to get a message out.
         */
-       printk(str, safe_smp_processor_id());
+       printk(str, smp_processor_id());
        show_registers(regs);
        if (kexec_should_crash(current))
                crash_kexec(regs);
index 498fbc1fc179b20d1d247b95bd44c55dc0cda4ea..58b5d6149a421b7cb17fd5d58071d4d767c4a57b 100644 (file)
@@ -66,7 +66,6 @@ static inline int hard_smp_processor_id(void)
        return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID));
 }
 
-extern int safe_smp_processor_id(void);
 extern int __cpu_disable(void);
 extern void __cpu_die(unsigned int cpu);
 extern void prefill_possible_map(void);
@@ -100,7 +99,6 @@ static inline int cpu_present_to_apicid(int mps_cpu)
 
 #ifndef CONFIG_SMP
 #define stack_smp_processor_id() 0
-#define safe_smp_processor_id() 0
 #define cpu_logical_map(x) (x)
 #else
 #include <asm/thread_info.h>