Skip to content

Commit 3f4a0b9

Browse files
john stultzLinus Torvalds
authored andcommitted
[PATCH] i386 Time: Avoid PIT SMP lockups
Avoid possible PIT livelock issues seen on SMP systems (and reported by Andi), by not allowing it as a clocksource on SMP boxes. However, since the PIT may no longer be present, we have to properly handle the cases where SMP systems have TSC skew and fall back from the TSC. Since the PIT isn't there, it would "fall back" to the TSC again. So this changes the jiffies rating to 1, and the TSC-bad rating value to 0. Thus you will get the following behavior priority on i386 systems: tsc [if present & stable] hpet [if present] cyclone [if present] acpi_pm [if present] pit [if UP] jiffies Rather then the current more complicated: tsc [if present & stable] hpet [if present] cyclone [if present] acpi_pm [if present] pit [if cpus < 4] tsc [if present & unstable] jiffies Signed-off-by: John Stultz <johnstul@us.ibm.com> Cc: Andi Kleen <ak@suse.de> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent b9f5d80 commit 3f4a0b9

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎arch/i386/kernel/i8253.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static struct clocksource clocksource_pit = {
109109

110110
static int __init init_pit_clocksource(void)
111111
{
112-
if (num_possible_cpus() > 4) /* PIT does not scale! */
112+
if (num_possible_cpus() > 1) /* PIT does not scale! */
113113
return 0;
114114

115115
clocksource_pit.mult = clocksource_hz2mult(CLOCK_TICK_RATE, 20);

‎arch/i386/kernel/tsc.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ static int tsc_update_callback(void)
349349
int change = 0;
350350

351351
/* check to see if we should switch to the safe clocksource: */
352-
if (clocksource_tsc.rating != 50 && check_tsc_unstable()) {
353-
clocksource_tsc.rating = 50;
352+
if (clocksource_tsc.rating != 0 && check_tsc_unstable()) {
353+
clocksource_tsc.rating = 0;
354354
clocksource_reselect();
355355
change = 1;
356356
}
@@ -461,7 +461,7 @@ static int __init init_tsc_clocksource(void)
461461
clocksource_tsc.shift);
462462
/* lower the rating if we already know its unstable: */
463463
if (check_tsc_unstable())
464-
clocksource_tsc.rating = 50;
464+
clocksource_tsc.rating = 0;
465465

466466
init_timer(&verify_tsc_freq_timer);
467467
verify_tsc_freq_timer.function = verify_tsc_freq;

‎kernel/time/jiffies.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static cycle_t jiffies_read(void)
5757

5858
struct clocksource clocksource_jiffies = {
5959
.name = "jiffies",
60-
.rating = 0, /* lowest rating*/
60+
.rating = 1, /* lowest valid rating*/
6161
.read = jiffies_read,
6262
.mask = 0xffffffff, /*32bits*/
6363
.mult = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */

0 commit comments

Comments
 (0)