aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/smpboot.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-22 15:04:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-22 15:04:44 -0400
commit3fad0953a12f92289f1e35f091c4fa09d8e1884e (patch)
treefdf5d23d76f03ac06289ee0e8678d4e125083cbb /arch/x86/kernel/smpboot.c
parenta065de0d257779ed1b8ee6e0c005ad6b1d989cef (diff)
parent0fa0e2f02e8edfbdb5f86d1cab0fa6dc0517489f (diff)
Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull debug-for-linus git tree from Ingo Molnar. Fix up trivial conflict in arch/x86/kernel/cpu/perf_event_intel.c due to a printk() having changed to a pr_info() differently in the two branches. * 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86: Move call to print_modules() out of show_regs() x86/mm: Mark free_initrd_mem() as __init x86/microcode: Mark microcode_id[] as __initconst x86/nmi: Clean up register_nmi_handler() usage x86: Save cr2 in NMI in case NMIs take a page fault (for i386) x86: Remove cmpxchg from i386 NMI nesting code x86: Save cr2 in NMI in case NMIs take a page fault x86/debug: Add KERN_<LEVEL> to bare printks, convert printks to pr_<level>
Diffstat (limited to 'arch/x86/kernel/smpboot.c')
-rw-r--r--arch/x86/kernel/smpboot.c97
1 files changed, 45 insertions, 52 deletions
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 27e2eeff7a4b..c1a310fb8309 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1,4 +1,4 @@
1/* 1 /*
2 * x86 SMP booting functions 2 * x86 SMP booting functions
3 * 3 *
4 * (c) 1995 Alan Cox, Building #3 <alan@lxorguk.ukuu.org.uk> 4 * (c) 1995 Alan Cox, Building #3 <alan@lxorguk.ukuu.org.uk>
@@ -39,6 +39,8 @@
39 * Glauber Costa : i386 and x86_64 integration 39 * Glauber Costa : i386 and x86_64 integration
40 */ 40 */
41 41
42#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
43
42#include <linux/init.h> 44#include <linux/init.h>
43#include <linux/smp.h> 45#include <linux/smp.h>
44#include <linux/module.h> 46#include <linux/module.h>
@@ -184,7 +186,7 @@ static void __cpuinit smp_callin(void)
184 * boards) 186 * boards)
185 */ 187 */
186 188
187 pr_debug("CALLIN, before setup_local_APIC().\n"); 189 pr_debug("CALLIN, before setup_local_APIC()\n");
188 if (apic->smp_callin_clear_local_apic) 190 if (apic->smp_callin_clear_local_apic)
189 apic->smp_callin_clear_local_apic(); 191 apic->smp_callin_clear_local_apic();
190 setup_local_APIC(); 192 setup_local_APIC();
@@ -423,17 +425,16 @@ static void impress_friends(void)
423 /* 425 /*
424 * Allow the user to impress friends. 426 * Allow the user to impress friends.
425 */ 427 */
426 pr_debug("Before bogomips.\n"); 428 pr_debug("Before bogomips\n");
427 for_each_possible_cpu(cpu) 429 for_each_possible_cpu(cpu)
428 if (cpumask_test_cpu(cpu, cpu_callout_mask)) 430 if (cpumask_test_cpu(cpu, cpu_callout_mask))
429 bogosum += cpu_data(cpu).loops_per_jiffy; 431 bogosum += cpu_data(cpu).loops_per_jiffy;
430 printk(KERN_INFO 432 pr_info("Total of %d processors activated (%lu.%02lu BogoMIPS)\n",
431 "Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
432 num_online_cpus(), 433 num_online_cpus(),
433 bogosum/(500000/HZ), 434 bogosum/(500000/HZ),
434 (bogosum/(5000/HZ))%100); 435 (bogosum/(5000/HZ))%100);
435 436
436 pr_debug("Before bogocount - setting activated=1.\n"); 437 pr_debug("Before bogocount - setting activated=1\n");
437} 438}
438 439
439void __inquire_remote_apic(int apicid) 440void __inquire_remote_apic(int apicid)
@@ -443,18 +444,17 @@ void __inquire_remote_apic(int apicid)
443 int timeout; 444 int timeout;
444 u32 status; 445 u32 status;
445 446
446 printk(KERN_INFO "Inquiring remote APIC 0x%x...\n", apicid); 447 pr_info("Inquiring remote APIC 0x%x...\n", apicid);
447 448
448 for (i = 0; i < ARRAY_SIZE(regs); i++) { 449 for (i = 0; i < ARRAY_SIZE(regs); i++) {
449 printk(KERN_INFO "... APIC 0x%x %s: ", apicid, names[i]); 450 pr_info("... APIC 0x%x %s: ", apicid, names[i]);
450 451
451 /* 452 /*
452 * Wait for idle. 453 * Wait for idle.
453 */ 454 */
454 status = safe_apic_wait_icr_idle(); 455 status = safe_apic_wait_icr_idle();
455 if (status) 456 if (status)
456 printk(KERN_CONT 457 pr_cont("a previous APIC delivery may have failed\n");
457 "a previous APIC delivery may have failed\n");
458 458
459 apic_icr_write(APIC_DM_REMRD | regs[i], apicid); 459 apic_icr_write(APIC_DM_REMRD | regs[i], apicid);
460 460
@@ -467,10 +467,10 @@ void __inquire_remote_apic(int apicid)
467 switch (status) { 467 switch (status) {
468 case APIC_ICR_RR_VALID: 468 case APIC_ICR_RR_VALID:
469 status = apic_read(APIC_RRR); 469 status = apic_read(APIC_RRR);
470 printk(KERN_CONT "%08x\n", status); 470 pr_cont("%08x\n", status);
471 break; 471 break;
472 default: 472 default:
473 printk(KERN_CONT "failed\n"); 473 pr_cont("failed\n");
474 } 474 }
475 } 475 }
476} 476}
@@ -504,12 +504,12 @@ wakeup_secondary_cpu_via_nmi(int logical_apicid, unsigned long start_eip)
504 apic_write(APIC_ESR, 0); 504 apic_write(APIC_ESR, 0);
505 accept_status = (apic_read(APIC_ESR) & 0xEF); 505 accept_status = (apic_read(APIC_ESR) & 0xEF);
506 } 506 }
507 pr_debug("NMI sent.\n"); 507 pr_debug("NMI sent\n");
508 508
509 if (send_status) 509 if (send_status)
510 printk(KERN_ERR "APIC never delivered???\n"); 510 pr_err("APIC never delivered???\n");
511 if (accept_status) 511 if (accept_status)
512 printk(KERN_ERR "APIC delivery error (%lx).\n", accept_status); 512 pr_err("APIC delivery error (%lx)\n", accept_status);
513 513
514 return (send_status | accept_status); 514 return (send_status | accept_status);
515} 515}
@@ -531,7 +531,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
531 apic_read(APIC_ESR); 531 apic_read(APIC_ESR);
532 } 532 }
533 533
534 pr_debug("Asserting INIT.\n"); 534 pr_debug("Asserting INIT\n");
535 535
536 /* 536 /*
537 * Turn INIT on target chip 537 * Turn INIT on target chip
@@ -547,7 +547,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
547 547
548 mdelay(10); 548 mdelay(10);
549 549
550 pr_debug("Deasserting INIT.\n"); 550 pr_debug("Deasserting INIT\n");
551 551
552 /* Target chip */ 552 /* Target chip */
553 /* Send IPI */ 553 /* Send IPI */
@@ -580,14 +580,14 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
580 /* 580 /*
581 * Run STARTUP IPI loop. 581 * Run STARTUP IPI loop.
582 */ 582 */
583 pr_debug("#startup loops: %d.\n", num_starts); 583 pr_debug("#startup loops: %d\n", num_starts);
584 584
585 for (j = 1; j <= num_starts; j++) { 585 for (j = 1; j <= num_starts; j++) {
586 pr_debug("Sending STARTUP #%d.\n", j); 586 pr_debug("Sending STARTUP #%d\n", j);
587 if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */ 587 if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */
588 apic_write(APIC_ESR, 0); 588 apic_write(APIC_ESR, 0);
589 apic_read(APIC_ESR); 589 apic_read(APIC_ESR);
590 pr_debug("After apic_write.\n"); 590 pr_debug("After apic_write\n");
591 591
592 /* 592 /*
593 * STARTUP IPI 593 * STARTUP IPI
@@ -604,7 +604,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
604 */ 604 */
605 udelay(300); 605 udelay(300);
606 606
607 pr_debug("Startup point 1.\n"); 607 pr_debug("Startup point 1\n");
608 608
609 pr_debug("Waiting for send to finish...\n"); 609 pr_debug("Waiting for send to finish...\n");
610 send_status = safe_apic_wait_icr_idle(); 610 send_status = safe_apic_wait_icr_idle();
@@ -619,12 +619,12 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
619 if (send_status || accept_status) 619 if (send_status || accept_status)
620 break; 620 break;
621 } 621 }
622 pr_debug("After Startup.\n"); 622 pr_debug("After Startup\n");
623 623
624 if (send_status) 624 if (send_status)
625 printk(KERN_ERR "APIC never delivered???\n"); 625 pr_err("APIC never delivered???\n");
626 if (accept_status) 626 if (accept_status)
627 printk(KERN_ERR "APIC delivery error (%lx).\n", accept_status); 627 pr_err("APIC delivery error (%lx)\n", accept_status);
628 628
629 return (send_status | accept_status); 629 return (send_status | accept_status);
630} 630}
@@ -638,11 +638,11 @@ static void __cpuinit announce_cpu(int cpu, int apicid)
638 if (system_state == SYSTEM_BOOTING) { 638 if (system_state == SYSTEM_BOOTING) {
639 if (node != current_node) { 639 if (node != current_node) {
640 if (current_node > (-1)) 640 if (current_node > (-1))
641 pr_cont(" Ok.\n"); 641 pr_cont(" OK\n");
642 current_node = node; 642 current_node = node;
643 pr_info("Booting Node %3d, Processors ", node); 643 pr_info("Booting Node %3d, Processors ", node);
644 } 644 }
645 pr_cont(" #%d%s", cpu, cpu == (nr_cpu_ids - 1) ? " Ok.\n" : ""); 645 pr_cont(" #%d%s", cpu, cpu == (nr_cpu_ids - 1) ? " OK\n" : "");
646 return; 646 return;
647 } else 647 } else
648 pr_info("Booting Node %d Processor %d APIC 0x%x\n", 648 pr_info("Booting Node %d Processor %d APIC 0x%x\n",
@@ -722,9 +722,9 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
722 /* 722 /*
723 * allow APs to start initializing. 723 * allow APs to start initializing.
724 */ 724 */
725 pr_debug("Before Callout %d.\n", cpu); 725 pr_debug("Before Callout %d\n", cpu);
726 cpumask_set_cpu(cpu, cpu_callout_mask); 726 cpumask_set_cpu(cpu, cpu_callout_mask);
727 pr_debug("After Callout %d.\n", cpu); 727 pr_debug("After Callout %d\n", cpu);
728 728
729 /* 729 /*
730 * Wait 5s total for a response 730 * Wait 5s total for a response
@@ -752,7 +752,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
752 pr_err("CPU%d: Stuck ??\n", cpu); 752 pr_err("CPU%d: Stuck ??\n", cpu);
753 else 753 else
754 /* trampoline code not run */ 754 /* trampoline code not run */
755 pr_err("CPU%d: Not responding.\n", cpu); 755 pr_err("CPU%d: Not responding\n", cpu);
756 if (apic->inquire_remote_apic) 756 if (apic->inquire_remote_apic)
757 apic->inquire_remote_apic(apicid); 757 apic->inquire_remote_apic(apicid);
758 } 758 }
@@ -797,7 +797,7 @@ int __cpuinit native_cpu_up(unsigned int cpu, struct task_struct *tidle)
797 if (apicid == BAD_APICID || apicid == boot_cpu_physical_apicid || 797 if (apicid == BAD_APICID || apicid == boot_cpu_physical_apicid ||
798 !physid_isset(apicid, phys_cpu_present_map) || 798 !physid_isset(apicid, phys_cpu_present_map) ||
799 !apic->apic_id_valid(apicid)) { 799 !apic->apic_id_valid(apicid)) {
800 printk(KERN_ERR "%s: bad cpu %d\n", __func__, cpu); 800 pr_err("%s: bad cpu %d\n", __func__, cpu);
801 return -EINVAL; 801 return -EINVAL;
802 } 802 }
803 803
@@ -878,9 +878,8 @@ static int __init smp_sanity_check(unsigned max_cpus)
878 unsigned int cpu; 878 unsigned int cpu;
879 unsigned nr; 879 unsigned nr;
880 880
881 printk(KERN_WARNING 881 pr_warn("More than 8 CPUs detected - skipping them\n"
882 "More than 8 CPUs detected - skipping them.\n" 882 "Use CONFIG_X86_BIGSMP\n");
883 "Use CONFIG_X86_BIGSMP.\n");
884 883
885 nr = 0; 884 nr = 0;
886 for_each_present_cpu(cpu) { 885 for_each_present_cpu(cpu) {
@@ -901,8 +900,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
901#endif 900#endif
902 901
903 if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) { 902 if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) {
904 printk(KERN_WARNING 903 pr_warn("weird, boot CPU (#%d) not listed by the BIOS\n",
905 "weird, boot CPU (#%d) not listed by the BIOS.\n",
906 hard_smp_processor_id()); 904 hard_smp_processor_id());
907 905
908 physid_set(hard_smp_processor_id(), phys_cpu_present_map); 906 physid_set(hard_smp_processor_id(), phys_cpu_present_map);
@@ -914,11 +912,10 @@ static int __init smp_sanity_check(unsigned max_cpus)
914 */ 912 */
915 if (!smp_found_config && !acpi_lapic) { 913 if (!smp_found_config && !acpi_lapic) {
916 preempt_enable(); 914 preempt_enable();
917 printk(KERN_NOTICE "SMP motherboard not detected.\n"); 915 pr_notice("SMP motherboard not detected\n");
918 disable_smp(); 916 disable_smp();
919 if (APIC_init_uniprocessor()) 917 if (APIC_init_uniprocessor())
920 printk(KERN_NOTICE "Local APIC not detected." 918 pr_notice("Local APIC not detected. Using dummy APIC emulation.\n");
921 " Using dummy APIC emulation.\n");
922 return -1; 919 return -1;
923 } 920 }
924 921
@@ -927,9 +924,8 @@ static int __init smp_sanity_check(unsigned max_cpus)
927 * CPU too, but we do it for the sake of robustness anyway. 924 * CPU too, but we do it for the sake of robustness anyway.
928 */ 925 */
929 if (!apic->check_phys_apicid_present(boot_cpu_physical_apicid)) { 926 if (!apic->check_phys_apicid_present(boot_cpu_physical_apicid)) {
930 printk(KERN_NOTICE 927 pr_notice("weird, boot CPU (#%d) not listed by the BIOS\n",
931 "weird, boot CPU (#%d) not listed by the BIOS.\n", 928 boot_cpu_physical_apicid);
932 boot_cpu_physical_apicid);
933 physid_set(hard_smp_processor_id(), phys_cpu_present_map); 929 physid_set(hard_smp_processor_id(), phys_cpu_present_map);
934 } 930 }
935 preempt_enable(); 931 preempt_enable();
@@ -942,8 +938,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
942 if (!disable_apic) { 938 if (!disable_apic) {
943 pr_err("BIOS bug, local APIC #%d not detected!...\n", 939 pr_err("BIOS bug, local APIC #%d not detected!...\n",
944 boot_cpu_physical_apicid); 940 boot_cpu_physical_apicid);
945 pr_err("... forcing use of dummy APIC emulation." 941 pr_err("... forcing use of dummy APIC emulation (tell your hw vendor)\n");
946 "(tell your hw vendor)\n");
947 } 942 }
948 smpboot_clear_io_apic(); 943 smpboot_clear_io_apic();
949 disable_ioapic_support(); 944 disable_ioapic_support();
@@ -956,7 +951,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
956 * If SMP should be disabled, then really disable it! 951 * If SMP should be disabled, then really disable it!
957 */ 952 */
958 if (!max_cpus) { 953 if (!max_cpus) {
959 printk(KERN_INFO "SMP mode deactivated.\n"); 954 pr_info("SMP mode deactivated\n");
960 smpboot_clear_io_apic(); 955 smpboot_clear_io_apic();
961 956
962 connect_bsp_APIC(); 957 connect_bsp_APIC();
@@ -1008,7 +1003,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1008 1003
1009 1004
1010 if (smp_sanity_check(max_cpus) < 0) { 1005 if (smp_sanity_check(max_cpus) < 0) {
1011 printk(KERN_INFO "SMP disabled\n"); 1006 pr_info("SMP disabled\n");
1012 disable_smp(); 1007 disable_smp();
1013 goto out; 1008 goto out;
1014 } 1009 }
@@ -1046,7 +1041,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1046 * Set up local APIC timer on boot CPU. 1041 * Set up local APIC timer on boot CPU.
1047 */ 1042 */
1048 1043
1049 printk(KERN_INFO "CPU%d: ", 0); 1044 pr_info("CPU%d: ", 0);
1050 print_cpu_info(&cpu_data(0)); 1045 print_cpu_info(&cpu_data(0));
1051 x86_init.timers.setup_percpu_clockev(); 1046 x86_init.timers.setup_percpu_clockev();
1052 1047
@@ -1096,7 +1091,7 @@ void __init native_smp_prepare_boot_cpu(void)
1096 1091
1097void __init native_smp_cpus_done(unsigned int max_cpus) 1092void __init native_smp_cpus_done(unsigned int max_cpus)
1098{ 1093{
1099 pr_debug("Boot done.\n"); 1094 pr_debug("Boot done\n");
1100 1095
1101 nmi_selftest(); 1096 nmi_selftest();
1102 impress_friends(); 1097 impress_friends();
@@ -1157,8 +1152,7 @@ __init void prefill_possible_map(void)
1157 1152
1158 /* nr_cpu_ids could be reduced via nr_cpus= */ 1153 /* nr_cpu_ids could be reduced via nr_cpus= */
1159 if (possible > nr_cpu_ids) { 1154 if (possible > nr_cpu_ids) {
1160 printk(KERN_WARNING 1155 pr_warn("%d Processors exceeds NR_CPUS limit of %d\n",
1161 "%d Processors exceeds NR_CPUS limit of %d\n",
1162 possible, nr_cpu_ids); 1156 possible, nr_cpu_ids);
1163 possible = nr_cpu_ids; 1157 possible = nr_cpu_ids;
1164 } 1158 }
@@ -1167,13 +1161,12 @@ __init void prefill_possible_map(void)
1167 if (!setup_max_cpus) 1161 if (!setup_max_cpus)
1168#endif 1162#endif
1169 if (possible > i) { 1163 if (possible > i) {
1170 printk(KERN_WARNING 1164 pr_warn("%d Processors exceeds max_cpus limit of %u\n",
1171 "%d Processors exceeds max_cpus limit of %u\n",
1172 possible, setup_max_cpus); 1165 possible, setup_max_cpus);
1173 possible = i; 1166 possible = i;
1174 } 1167 }
1175 1168
1176 printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n", 1169 pr_info("Allowing %d CPUs, %d hotplug CPUs\n",
1177 possible, max_t(int, possible - num_processors, 0)); 1170 possible, max_t(int, possible - num_processors, 0));
1178 1171
1179 for (i = 0; i < possible; i++) 1172 for (i = 0; i < possible; i++)