Skip to content

Commit 0051293

Browse files
committed
clocksource: Enable TSC watchdog checking of HPET and PMTMR only when requested
Unconditionally enabling TSC watchdog checking of the HPET and PMTMR clocksources can degrade latency and performance. Therefore, provide a new "watchdog" option to the tsc= boot parameter that opts into such checking. Note that tsc=watchdog is overridden by a tsc=nowatchdog regardless of their relative positions in the list of boot parameters. Reported-by: Thomas Gleixner <[email protected]> Reported-by: Waiman Long <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Acked-by: Waiman Long <[email protected]>
1 parent efc8b32 commit 0051293

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6373,6 +6373,12 @@
63736373
(HPET or PM timer) on systems whose TSC frequency was
63746374
obtained from HW or FW using either an MSR or CPUID(0x15).
63756375
Warn if the difference is more than 500 ppm.
6376+
[x86] watchdog: Use TSC as the watchdog clocksource with
6377+
which to check other HW timers (HPET or PM timer), but
6378+
only on systems where TSC has been deemed trustworthy.
6379+
This will be suppressed by an earlier tsc=nowatchdog and
6380+
can be overridden by a later tsc=nowatchdog. A console
6381+
message will flag any such suppression or overriding.
63766382

63776383
tsc_early_khz= [X86] Skip early TSC calibration and use the given
63786384
value instead. Useful when the early TSC frequency discovery

arch/x86/kernel/tsc.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ __setup("notsc", notsc_setup);
294294

295295
static int no_sched_irq_time;
296296
static int no_tsc_watchdog;
297+
static int tsc_as_watchdog;
297298

298299
static int __init tsc_setup(char *str)
299300
{
@@ -303,10 +304,22 @@ static int __init tsc_setup(char *str)
303304
no_sched_irq_time = 1;
304305
if (!strcmp(str, "unstable"))
305306
mark_tsc_unstable("boot parameter");
306-
if (!strcmp(str, "nowatchdog"))
307+
if (!strcmp(str, "nowatchdog")) {
307308
no_tsc_watchdog = 1;
309+
if (tsc_as_watchdog)
310+
pr_alert("%s: Overriding earlier tsc=watchdog with tsc=nowatchdog\n",
311+
__func__);
312+
tsc_as_watchdog = 0;
313+
}
308314
if (!strcmp(str, "recalibrate"))
309315
tsc_force_recalibrate = 1;
316+
if (!strcmp(str, "watchdog")) {
317+
if (no_tsc_watchdog)
318+
pr_alert("%s: tsc=watchdog overridden by earlier tsc=nowatchdog\n",
319+
__func__);
320+
else
321+
tsc_as_watchdog = 1;
322+
}
310323
return 1;
311324
}
312325

@@ -1192,7 +1205,8 @@ static void __init tsc_disable_clocksource_watchdog(void)
11921205

11931206
bool tsc_clocksource_watchdog_disabled(void)
11941207
{
1195-
return !(clocksource_tsc.flags & CLOCK_SOURCE_MUST_VERIFY);
1208+
return !(clocksource_tsc.flags & CLOCK_SOURCE_MUST_VERIFY) &&
1209+
tsc_as_watchdog && !no_tsc_watchdog;
11961210
}
11971211

11981212
static void __init check_system_tsc_reliable(void)

0 commit comments

Comments
 (0)