diff options
-rw-r--r-- | arch/x86_64/kernel/mce.c | 2 | ||||
-rw-r--r-- | arch/x86_64/kernel/smp.c | 23 | ||||
-rw-r--r-- | arch/x86_64/kernel/traps.c | 10 | ||||
-rw-r--r-- | include/asm-x86_64/smp.h | 2 |
4 files changed, 6 insertions, 31 deletions
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c index 4e017fb30fb3..1a93c3738404 100644 --- a/arch/x86_64/kernel/mce.c +++ b/arch/x86_64/kernel/mce.c | |||
@@ -182,7 +182,7 @@ void do_machine_check(struct pt_regs * regs, long error_code) | |||
182 | goto out2; | 182 | goto out2; |
183 | 183 | ||
184 | memset(&m, 0, sizeof(struct mce)); | 184 | memset(&m, 0, sizeof(struct mce)); |
185 | m.cpu = safe_smp_processor_id(); | 185 | m.cpu = smp_processor_id(); |
186 | rdmsrl(MSR_IA32_MCG_STATUS, m.mcgstatus); | 186 | rdmsrl(MSR_IA32_MCG_STATUS, m.mcgstatus); |
187 | if (!(m.mcgstatus & MCG_STATUS_RIPV)) | 187 | if (!(m.mcgstatus & MCG_STATUS_RIPV)) |
188 | kill_it = 1; | 188 | kill_it = 1; |
diff --git a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c index 2df988bbf312..4f67697f5036 100644 --- a/arch/x86_64/kernel/smp.c +++ b/arch/x86_64/kernel/smp.c | |||
@@ -522,26 +522,3 @@ asmlinkage void smp_call_function_interrupt(void) | |||
522 | } | 522 | } |
523 | } | 523 | } |
524 | 524 | ||
525 | int safe_smp_processor_id(void) | ||
526 | { | ||
527 | unsigned apicid, i; | ||
528 | |||
529 | if (disable_apic || !apic_mapped) | ||
530 | return 0; | ||
531 | |||
532 | apicid = hard_smp_processor_id(); | ||
533 | if (apicid < NR_CPUS && x86_cpu_to_apicid[apicid] == apicid) | ||
534 | return apicid; | ||
535 | |||
536 | for (i = 0; i < NR_CPUS; ++i) { | ||
537 | if (x86_cpu_to_apicid[i] == apicid) | ||
538 | return i; | ||
539 | } | ||
540 | |||
541 | /* No entries in x86_cpu_to_apicid? Either no MPS|ACPI, | ||
542 | * or called too early. Either way, we must be CPU 0. */ | ||
543 | if (x86_cpu_to_apicid[0] == BAD_APICID) | ||
544 | return 0; | ||
545 | |||
546 | return 0; /* Should not happen */ | ||
547 | } | ||
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index 34660b1e2720..38bc821e457b 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c | |||
@@ -264,7 +264,7 @@ static int dump_trace_unwind(struct unwind_frame_info *info, void *context) | |||
264 | void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long * stack, | 264 | void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long * stack, |
265 | struct stacktrace_ops *ops, void *data) | 265 | struct stacktrace_ops *ops, void *data) |
266 | { | 266 | { |
267 | const unsigned cpu = safe_smp_processor_id(); | 267 | const unsigned cpu = smp_processor_id(); |
268 | unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr; | 268 | unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr; |
269 | unsigned used = 0; | 269 | unsigned used = 0; |
270 | 270 | ||
@@ -429,7 +429,7 @@ _show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *rsp) | |||
429 | { | 429 | { |
430 | unsigned long *stack; | 430 | unsigned long *stack; |
431 | int i; | 431 | int i; |
432 | const int cpu = safe_smp_processor_id(); | 432 | const int cpu = smp_processor_id(); |
433 | unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr); | 433 | unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr); |
434 | unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE); | 434 | unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE); |
435 | 435 | ||
@@ -483,7 +483,7 @@ void show_registers(struct pt_regs *regs) | |||
483 | int i; | 483 | int i; |
484 | int in_kernel = !user_mode(regs); | 484 | int in_kernel = !user_mode(regs); |
485 | unsigned long rsp; | 485 | unsigned long rsp; |
486 | const int cpu = safe_smp_processor_id(); | 486 | const int cpu = smp_processor_id(); |
487 | struct task_struct *cur = cpu_pda(cpu)->pcurrent; | 487 | struct task_struct *cur = cpu_pda(cpu)->pcurrent; |
488 | 488 | ||
489 | rsp = regs->rsp; | 489 | rsp = regs->rsp; |
@@ -558,7 +558,7 @@ static unsigned int die_nest_count; | |||
558 | 558 | ||
559 | unsigned __kprobes long oops_begin(void) | 559 | unsigned __kprobes long oops_begin(void) |
560 | { | 560 | { |
561 | int cpu = safe_smp_processor_id(); | 561 | int cpu = smp_processor_id(); |
562 | unsigned long flags; | 562 | unsigned long flags; |
563 | 563 | ||
564 | oops_enter(); | 564 | oops_enter(); |
@@ -636,7 +636,7 @@ void __kprobes die_nmi(char *str, struct pt_regs *regs, int do_panic) | |||
636 | * We are in trouble anyway, lets at least try | 636 | * We are in trouble anyway, lets at least try |
637 | * to get a message out. | 637 | * to get a message out. |
638 | */ | 638 | */ |
639 | printk(str, safe_smp_processor_id()); | 639 | printk(str, smp_processor_id()); |
640 | show_registers(regs); | 640 | show_registers(regs); |
641 | if (kexec_should_crash(current)) | 641 | if (kexec_should_crash(current)) |
642 | crash_kexec(regs); | 642 | crash_kexec(regs); |
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h index 498fbc1fc179..58b5d6149a42 100644 --- a/include/asm-x86_64/smp.h +++ b/include/asm-x86_64/smp.h | |||
@@ -66,7 +66,6 @@ static inline int hard_smp_processor_id(void) | |||
66 | return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); | 66 | return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); |
67 | } | 67 | } |
68 | 68 | ||
69 | extern int safe_smp_processor_id(void); | ||
70 | extern int __cpu_disable(void); | 69 | extern int __cpu_disable(void); |
71 | extern void __cpu_die(unsigned int cpu); | 70 | extern void __cpu_die(unsigned int cpu); |
72 | extern void prefill_possible_map(void); | 71 | extern void prefill_possible_map(void); |
@@ -100,7 +99,6 @@ static inline int cpu_present_to_apicid(int mps_cpu) | |||
100 | 99 | ||
101 | #ifndef CONFIG_SMP | 100 | #ifndef CONFIG_SMP |
102 | #define stack_smp_processor_id() 0 | 101 | #define stack_smp_processor_id() 0 |
103 | #define safe_smp_processor_id() 0 | ||
104 | #define cpu_logical_map(x) (x) | 102 | #define cpu_logical_map(x) (x) |
105 | #else | 103 | #else |
106 | #include <asm/thread_info.h> | 104 | #include <asm/thread_info.h> |