aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-09-26 04:52:37 -0400
committerAndi Kleen <andi@basil.nowhere.org>2006-09-26 04:52:37 -0400
commit151f8cc1169f9052095b2be36183ab132d75c6c2 (patch)
treef3aae7a7e2fc15e88a8471256b2aa43c4850ad0f /arch/x86_64
parent34464a5b8937b79801776dfb6970c1b949fed4be (diff)
[PATCH] Remove safe_smp_processor_id()
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>
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/kernel/mce.c2
-rw-r--r--arch/x86_64/kernel/smp.c23
-rw-r--r--arch/x86_64/kernel/traps.c10
3 files changed, 6 insertions, 29 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
525int 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)
264void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long * stack, 264void 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
559unsigned __kprobes long oops_begin(void) 559unsigned __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);