Skip to content

Commit 49a66a0

Browse files
Maciej W. RozyckiIngo Molnar
authored andcommitted
x86: I/O APIC: Always report how the timer has been set up
Following recent (and less so) issues with the 8254 timer when routed through the I/O or local APIC, always report which configurations have been tried and which one has been set up eventually. This is so that logs posted by people for some other reason can be used as a cross-reference when investigating any possible future problems. The change unifies messages printed on 32-bit and 64-bit platforms and adds trailing newlines (removes leading ones), so that proper log level annotation can be used and any possible interspersed output will not cause a mess. I have chosen to use apic_printk(APIC_QUIET, ...) rather than printk(...) so that the distinction of these messages is maintained making possible future decisions about changes in this area easier. A change posted separately making apic_verbosity unsigned removes any extra code that would otherwise be generated as a result of this design decision. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent baa1318 commit 49a66a0

File tree

2 files changed

+44
-35
lines changed

2 files changed

+44
-35
lines changed

arch/x86/kernel/io_apic_32.c

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,8 +2177,9 @@ static inline void __init check_timer(void)
21772177
pin2 = ioapic_i8259.pin;
21782178
apic2 = ioapic_i8259.apic;
21792179

2180-
printk(KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n",
2181-
vector, apic1, pin1, apic2, pin2);
2180+
apic_printk(APIC_QUIET, KERN_INFO "..TIMER: vector=0x%02X "
2181+
"apic1=%d pin1=%d apic2=%d pin2=%d\n",
2182+
vector, apic1, pin1, apic2, pin2);
21822183

21832184
/*
21842185
* Some BIOS writers are clueless and report the ExtINTA
@@ -2216,12 +2217,13 @@ static inline void __init check_timer(void)
22162217
}
22172218
clear_IO_APIC_pin(apic1, pin1);
22182219
if (!no_pin1)
2219-
printk(KERN_ERR "..MP-BIOS bug: "
2220-
"8254 timer not connected to IO-APIC\n");
2220+
apic_printk(APIC_QUIET, KERN_ERR "..MP-BIOS bug: "
2221+
"8254 timer not connected to IO-APIC\n");
22212222

2222-
printk(KERN_INFO "...trying to set up timer (IRQ0) "
2223-
"through the 8259A ... ");
2224-
printk("\n..... (found pin %d) ...", pin2);
2223+
apic_printk(APIC_QUIET, KERN_INFO "...trying to set up timer "
2224+
"(IRQ0) through the 8259A ...\n");
2225+
apic_printk(APIC_QUIET, KERN_INFO
2226+
"..... (found apic %d pin %d) ...\n", apic2, pin2);
22252227
/*
22262228
* legacy devices should be connected to IO APIC #0
22272229
*/
@@ -2230,7 +2232,7 @@ static inline void __init check_timer(void)
22302232
unmask_IO_APIC_irq(0);
22312233
enable_8259A_irq(0);
22322234
if (timer_irq_works()) {
2233-
printk("works.\n");
2235+
apic_printk(APIC_QUIET, KERN_INFO "....... works.\n");
22342236
timer_through_8259 = 1;
22352237
if (nmi_watchdog == NMI_IO_APIC) {
22362238
disable_8259A_irq(0);
@@ -2244,30 +2246,33 @@ static inline void __init check_timer(void)
22442246
*/
22452247
disable_8259A_irq(0);
22462248
clear_IO_APIC_pin(apic2, pin2);
2247-
printk(" failed.\n");
2249+
apic_printk(APIC_QUIET, KERN_INFO "....... failed.\n");
22482250
}
22492251

22502252
if (nmi_watchdog == NMI_IO_APIC) {
2251-
printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
2253+
apic_printk(APIC_QUIET, KERN_WARNING "timer doesn't work "
2254+
"through the IO-APIC - disabling NMI Watchdog!\n");
22522255
nmi_watchdog = NMI_NONE;
22532256
}
22542257
timer_ack = 0;
22552258

2256-
printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
2259+
apic_printk(APIC_QUIET, KERN_INFO
2260+
"...trying to set up timer as Virtual Wire IRQ...\n");
22572261

22582262
lapic_register_intr(0, vector);
22592263
apic_write(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */
22602264
enable_8259A_irq(0);
22612265

22622266
if (timer_irq_works()) {
2263-
printk(" works.\n");
2267+
apic_printk(APIC_QUIET, KERN_INFO "..... works.\n");
22642268
goto out;
22652269
}
22662270
disable_8259A_irq(0);
22672271
apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector);
2268-
printk(" failed.\n");
2272+
apic_printk(APIC_QUIET, KERN_INFO "..... failed.\n");
22692273

2270-
printk(KERN_INFO "...trying to set up timer as ExtINT IRQ...");
2274+
apic_printk(APIC_QUIET, KERN_INFO
2275+
"...trying to set up timer as ExtINT IRQ...\n");
22712276

22722277
init_8259A(0);
22732278
make_8259A_irq(0);
@@ -2276,12 +2281,12 @@ static inline void __init check_timer(void)
22762281
unlock_ExtINT_logic();
22772282

22782283
if (timer_irq_works()) {
2279-
printk(" works.\n");
2284+
apic_printk(APIC_QUIET, KERN_INFO "..... works.\n");
22802285
goto out;
22812286
}
2282-
printk(" failed :(.\n");
2287+
apic_printk(APIC_QUIET, KERN_INFO "..... failed :(.\n");
22832288
panic("IO-APIC + timer doesn't work! Boot with apic=debug and send a "
2284-
"report. Then try booting with the 'noapic' option");
2289+
"report. Then try booting with the 'noapic' option.\n");
22852290
out:
22862291
local_irq_restore(flags);
22872292
}

arch/x86/kernel/io_apic_64.c

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,8 +1697,9 @@ static inline void __init check_timer(void)
16971697
pin2 = ioapic_i8259.pin;
16981698
apic2 = ioapic_i8259.apic;
16991699

1700-
apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n",
1701-
cfg->vector, apic1, pin1, apic2, pin2);
1700+
apic_printk(APIC_QUIET, KERN_INFO "..TIMER: vector=0x%02X "
1701+
"apic1=%d pin1=%d apic2=%d pin2=%d\n",
1702+
cfg->vector, apic1, pin1, apic2, pin2);
17021703

17031704
/*
17041705
* Some BIOS writers are clueless and report the ExtINTA
@@ -1736,14 +1737,13 @@ static inline void __init check_timer(void)
17361737
}
17371738
clear_IO_APIC_pin(apic1, pin1);
17381739
if (!no_pin1)
1739-
apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: "
1740+
apic_printk(APIC_QUIET, KERN_ERR "..MP-BIOS bug: "
17401741
"8254 timer not connected to IO-APIC\n");
17411742

1742-
apic_printk(APIC_VERBOSE,KERN_INFO
1743-
"...trying to set up timer (IRQ0) "
1744-
"through the 8259A ... ");
1745-
apic_printk(APIC_VERBOSE,"\n..... (found apic %d pin %d) ...",
1746-
apic2, pin2);
1743+
apic_printk(APIC_QUIET, KERN_INFO "...trying to set up timer "
1744+
"(IRQ0) through the 8259A ...\n");
1745+
apic_printk(APIC_QUIET, KERN_INFO
1746+
"..... (found apic %d pin %d) ...\n", apic2, pin2);
17471747
/*
17481748
* legacy devices should be connected to IO APIC #0
17491749
*/
@@ -1752,7 +1752,7 @@ static inline void __init check_timer(void)
17521752
unmask_IO_APIC_irq(0);
17531753
enable_8259A_irq(0);
17541754
if (timer_irq_works()) {
1755-
apic_printk(APIC_VERBOSE," works.\n");
1755+
apic_printk(APIC_QUIET, KERN_INFO "....... works.\n");
17561756
timer_through_8259 = 1;
17571757
if (nmi_watchdog == NMI_IO_APIC) {
17581758
disable_8259A_irq(0);
@@ -1766,29 +1766,32 @@ static inline void __init check_timer(void)
17661766
*/
17671767
disable_8259A_irq(0);
17681768
clear_IO_APIC_pin(apic2, pin2);
1769-
apic_printk(APIC_VERBOSE," failed.\n");
1769+
apic_printk(APIC_QUIET, KERN_INFO "....... failed.\n");
17701770
}
17711771

17721772
if (nmi_watchdog == NMI_IO_APIC) {
1773-
printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
1773+
apic_printk(APIC_QUIET, KERN_WARNING "timer doesn't work "
1774+
"through the IO-APIC - disabling NMI Watchdog!\n");
17741775
nmi_watchdog = NMI_NONE;
17751776
}
17761777

1777-
apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
1778+
apic_printk(APIC_QUIET, KERN_INFO
1779+
"...trying to set up timer as Virtual Wire IRQ...\n");
17781780

17791781
lapic_register_intr(0);
17801782
apic_write(APIC_LVT0, APIC_DM_FIXED | cfg->vector); /* Fixed mode */
17811783
enable_8259A_irq(0);
17821784

17831785
if (timer_irq_works()) {
1784-
apic_printk(APIC_VERBOSE," works.\n");
1786+
apic_printk(APIC_QUIET, KERN_INFO "..... works.\n");
17851787
goto out;
17861788
}
17871789
disable_8259A_irq(0);
17881790
apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector);
1789-
apic_printk(APIC_VERBOSE," failed.\n");
1791+
apic_printk(APIC_QUIET, KERN_INFO "..... failed.\n");
17901792

1791-
apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as ExtINT IRQ...");
1793+
apic_printk(APIC_QUIET, KERN_INFO
1794+
"...trying to set up timer as ExtINT IRQ...\n");
17921795

17931796
init_8259A(0);
17941797
make_8259A_irq(0);
@@ -1797,11 +1800,12 @@ static inline void __init check_timer(void)
17971800
unlock_ExtINT_logic();
17981801

17991802
if (timer_irq_works()) {
1800-
apic_printk(APIC_VERBOSE," works.\n");
1803+
apic_printk(APIC_QUIET, KERN_INFO "..... works.\n");
18011804
goto out;
18021805
}
1803-
apic_printk(APIC_VERBOSE," failed :(.\n");
1804-
panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n");
1806+
apic_printk(APIC_QUIET, KERN_INFO "..... failed :(.\n");
1807+
panic("IO-APIC + timer doesn't work! Boot with apic=debug and send a "
1808+
"report. Then try booting with the 'noapic' option.\n");
18051809
out:
18061810
local_irq_restore(flags);
18071811
}

0 commit comments

Comments
 (0)