Skip to contentSkip to conversation

x86/tsc: Add option to disable tsc clocksource watchdog

RFC PATCH In review Juri Lelli 3 participants 4 messages Mar 7, 2019 – Mar 22, 2019

Subsystems (2)
lore
Share & tools
lore

Juri Lelli

author
#0 lore raw

RFC PATCH 1/1 x86/tsc: Add option to disable tsc clocksource watchdog

Clocksource watchdog has been found responsible for generating latency spikes (in the 10-20 us range) when woken up to check for TSC stability.

Add an option to disable it at boot.

---
Sending this out as an RFC after yesterday discussion with Thomas on IRC.

AFAICT, CLOCK_SOURCE_MUST_VERIFY only controls enqueue\dequeue of the watchdog. TSC sync checks are still done if tsc_clocksource_reliable is set (booting w/o tsc=reliable).

Thomas, is this anywhere close to what you had in mind?

---
 Documentation/admin-guide/kernel-parameters.txt | 4 ++++
 arch/x86/kernel/tsc.c                           | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Documentation/admin-guide/kernel-parameters.txt +4 -0
index f5acf35c712f..ea7c4967aa80 100644
@@ -4619,6 +4619,10 @@
 			[x86] unstable: mark the TSC clocksource as unstable, this
 			marks the TSC unconditionally unstable at bootup and
 			avoids any further wobbles once the TSC watchdog notices.
+			[x86] nowatchdog: disable clocksource watchdog. Used
+			in situations with strict latency requirements (where
+			interruptions from clocksource watchdog are not
+			acceptable).
 
 	turbografx.map[2|3]=	[HW,JOY]
 			TurboGraFX parallel port interface
arch/x86/kernel/tsc.c +4 -1
index 6d5dc5dabfd7..4b753d057aee 100644
@@ -283,6 +283,7 @@ int __init notsc_setup(char *str)
 __setup("notsc", notsc_setup);
 
 static int no_sched_irq_time;
+static int no_tsc_watchdog;
 
 static int __init tsc_setup(char *str)
 {
@@ -292,6 +293,8 @@ static int __init tsc_setup(char *str)
 		no_sched_irq_time = 1;
 	if (!strcmp(str, "unstable"))
 		mark_tsc_unstable("boot parameter");
+	if (!strcmp(str, "nowatchdog"))
+		no_tsc_watchdog = 1;
 	return 1;
 }
 
@@ -1347,7 +1350,7 @@ static int __init init_tsc_clocksource(void)
 	if (tsc_unstable)
 		goto unreg;
 
-	if (tsc_clocksource_reliable)
+	if (tsc_clocksource_reliable || no_tsc_watchdog)
 		clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
 
 	if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC_S3))
Signature · 1 line
2.17.2
author
#1 lore raw

Hi,

Quoted 4 lines · Juri Lelli

Clocksource watchdog has been found responsible for generating latency spikes (in the 10-20 us range) when woken up to check for TSC stability.

Add an option to disable it at boot.

Gentle ping.

Does this make any sense?

Thanks,

- Juri

#2 lore raw
Quoted 11 lines · Juri Lelli

Hi,

Quoted 4 lines · Juri Lelli

Clocksource watchdog has been found responsible for generating latency spikes (in the 10-20 us range) when woken up to check for TSC stability.

Add an option to disable it at boot.

Gentle ping.

Does this make any sense?

I have to reroute this ping to tglx since I wasn't involved.

Quoted 3 lines

Thanks,

- Juri

Sebastian

#3 lore raw
In reply to Juri Lelli
x86/tsc: Add option to disable tsc clocksource watchdog
Commit-ID:  0f0b7e1cc7abf8e1a8b301f2868379d611d05ae2
Gitweb:     https://git.kernel.org/tip/0f0b7e1cc7abf8e1a8b301f2868379d611d05ae2
Author:     Juri Lelli <[email protected]>
AuthorDate: Thu, 7 Mar 2019 13:09:13 +0100
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Fri, 22 Mar 2019 14:14:58 +0100

x86/tsc: Add option to disable tsc clocksource watchdog

Clocksource watchdog has been found responsible for generating latency spikes (in the 10-20 us range) when woken up to check for TSC stability.

Add an option to disable it at boot.

---
 Documentation/admin-guide/kernel-parameters.txt | 4 ++++
 arch/x86/kernel/tsc.c                           | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Documentation/admin-guide/kernel-parameters.txt +4 -0
index 2b8ee90bb644..c4d830003b21 100644
@@ -4703,6 +4703,10 @@
 			[x86] unstable: mark the TSC clocksource as unstable, this
 			marks the TSC unconditionally unstable at bootup and
 			avoids any further wobbles once the TSC watchdog notices.
+			[x86] nowatchdog: disable clocksource watchdog. Used
+			in situations with strict latency requirements (where
+			interruptions from clocksource watchdog are not
+			acceptable).
 
 	turbografx.map[2|3]=	[HW,JOY]
 			TurboGraFX parallel port interface
arch/x86/kernel/tsc.c +4 -1
index 3fae23834069..aab0c82e0a0d 100644
@@ -283,6 +283,7 @@ int __init notsc_setup(char *str)
 __setup("notsc", notsc_setup);
 
 static int no_sched_irq_time;
+static int no_tsc_watchdog;
 
 static int __init tsc_setup(char *str)
 {
@@ -292,6 +293,8 @@ static int __init tsc_setup(char *str)
 		no_sched_irq_time = 1;
 	if (!strcmp(str, "unstable"))
 		mark_tsc_unstable("boot parameter");
+	if (!strcmp(str, "nowatchdog"))
+		no_tsc_watchdog = 1;
 	return 1;
 }
 
@@ -1349,7 +1352,7 @@ static int __init init_tsc_clocksource(void)
 	if (tsc_unstable)
 		goto unreg;
 
-	if (tsc_clocksource_reliable)
+	if (tsc_clocksource_reliable || no_tsc_watchdog)
 		clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
 
 	if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC_S3))