Skip to content

Commit e3b4f79

Browse files
Peter ZijlstraKAGA-KOKO
authored andcommitted
x86/tsc: Fix mark_tsc_unstable()
mark_tsc_unstable() also needs to affect tsc_early, Now that clocksource_mark_unstable() can be used on a clocksource irrespective of its registration state, use it on both tsc_early and tsc. This does however require cs->list to be initialized empty, otherwise it cannot tell the registation state before registation. Fixes: aa83c45 ("x86/tsc: Introduce early tsc clocksource") Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Diego Viola <[email protected]> Reviewed-by: Rafael J. Wysocki <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent 5b9e886 commit e3b4f79

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

arch/x86/kernel/tsc.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,7 @@ static struct clocksource clocksource_tsc_early = {
10671067
.resume = tsc_resume,
10681068
.mark_unstable = tsc_cs_mark_unstable,
10691069
.tick_stable = tsc_cs_tick_stable,
1070+
.list = LIST_HEAD_INIT(clocksource_tsc_early.list),
10701071
};
10711072

10721073
/*
@@ -1086,6 +1087,7 @@ static struct clocksource clocksource_tsc = {
10861087
.resume = tsc_resume,
10871088
.mark_unstable = tsc_cs_mark_unstable,
10881089
.tick_stable = tsc_cs_tick_stable,
1090+
.list = LIST_HEAD_INIT(clocksource_tsc.list),
10891091
};
10901092

10911093
void mark_tsc_unstable(char *reason)
@@ -1098,13 +1100,9 @@ void mark_tsc_unstable(char *reason)
10981100
clear_sched_clock_stable();
10991101
disable_sched_clock_irqtime();
11001102
pr_info("Marking TSC unstable due to %s\n", reason);
1101-
/* Change only the rating, when not registered */
1102-
if (clocksource_tsc.mult) {
1103-
clocksource_mark_unstable(&clocksource_tsc);
1104-
} else {
1105-
clocksource_tsc.flags |= CLOCK_SOURCE_UNSTABLE;
1106-
clocksource_tsc.rating = 0;
1107-
}
1103+
1104+
clocksource_mark_unstable(&clocksource_tsc_early);
1105+
clocksource_mark_unstable(&clocksource_tsc);
11081106
}
11091107

11101108
EXPORT_SYMBOL_GPL(mark_tsc_unstable);

0 commit comments

Comments
 (0)