Skip to contentSkip to conversation

Calling check_system_tsc_reliable before unsynchronized_tsc

PATCH Superseded Zhenzhong Duan 2 participants 4 messages Jun 8, 2017 – Jun 20, 2017 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Calling check_system_tsc_reliable before unsynchronized_tsc

unsynchronized_tsc() checks value of tsc_clocksource_reliable which is set by check_system_tsc_reliable(). It's better to move check_system_tsc_reliable() at front, or else this check makes no sense.

Though X86_FEATURE_CONSTANT_TSC is usually set for TSC reliable system, just in case.

---
 arch/x86/kernel/tsc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/tsc.c +2 -2
index 714dfba..a316bdd 100644
@@ -1412,11 +1412,11 @@ void __init tsc_init(void)
 
 	use_tsc_delay();
 
+	check_system_tsc_reliable();
+
 	if (unsynchronized_tsc())
 		mark_tsc_unstable("TSCs unsynchronized");
 
-	check_system_tsc_reliable();
-
 	detect_art();
 }
 
Signature · 1 line
1.7.3
#1 lore raw
Quoted 19 lines · Zhenzhong Duan

unsynchronized_tsc() checks value of tsc_clocksource_reliable which is set by check_system_tsc_reliable(). It's better to move check_system_tsc_reliable() at
front, or else this check makes no sense.

Though X86_FEATURE_CONSTANT_TSC is usually set for TSC reliable system, just in
case.

---
 arch/x86/kernel/tsc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/tsc.c +0 -0
index 714dfba..a316bdd 100644

arch/x86/kernel/tsc.c void __init tsc_init(void) · line 1417

Quoted 7 lines
arch/x86/kernel/tsc.c +1 -1
@@ -1412,11 +1412,11 @@ void __init tsc_init(void)
  	use_tsc_delay();
 +	check_system_tsc_reliable();
+
 	if (unsynchronized_tsc())
 		mark_tsc_unstable("TSCs unsynchronized");
 -	check_system_tsc_reliable();
-

What kind of patch is that? Definitely nothing which can be applied.

Thanks,

tglx

#2 lore raw
Quoted 16 lines · Thomas Gleixner
Quoted 14 lines · Zhenzhong Duan

unsynchronized_tsc() checks value of tsc_clocksource_reliable which is set by check_system_tsc_reliable(). It's better to move check_system_tsc_reliable() at
front, or else this check makes no sense.

Though X86_FEATURE_CONSTANT_TSC is usually set for TSC reliable system, just in
case.

---
  arch/x86/kernel/tsc.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
Quoted 13 lines

arch/x86/kernel/tsc.c void __init tsc_init(void) · line 1417

Quoted 12 lines
arch/x86/kernel/tsc.c +1 -1
index 714dfba..a316bdd 100644
@@ -1412,11 +1412,11 @@ void __init tsc_init(void)
   	use_tsc_delay();
  +	check_system_tsc_reliable();
+
  	if (unsynchronized_tsc())
  		mark_tsc_unstable("TSCs unsynchronized");
  -	check_system_tsc_reliable();
-

What kind of patch is that? Definitely nothing which can be applied.

To avoid using unassigned variable tsc_clocksource_reliable.
Or what's the purpose of if (tsc_clocksource_reliable) check in unsynchronized_tsc()?

Signature · 2 lines
thanks
zduan
#3 lore raw
Quoted 33 lines · Zhenzhong Duan
Quoted 19 lines · Thomas Gleixner
Quoted 17 lines · Zhenzhong Duan

unsynchronized_tsc() checks value of tsc_clocksource_reliable which is set by
check_system_tsc_reliable(). It's better to move check_system_tsc_reliable()
at
front, or else this check makes no sense.

Though X86_FEATURE_CONSTANT_TSC is usually set for TSC reliable system, just
in
case.

---
  arch/x86/kernel/tsc.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
Quoted 13 lines

arch/x86/kernel/tsc.c void __init tsc_init(void) · line 1417

Quoted 12 lines
arch/x86/kernel/tsc.c +1 -1
index 714dfba..a316bdd 100644
@@ -1412,11 +1412,11 @@ void __init tsc_init(void)
   	use_tsc_delay();
  +	check_system_tsc_reliable();
+
  	if (unsynchronized_tsc())
  		mark_tsc_unstable("TSCs unsynchronized");
  -	check_system_tsc_reliable();
-

What kind of patch is that? Definitely nothing which can be applied.

Quoted 3 lines

To avoid using unassigned variable tsc_clocksource_reliable. Or what's the purpose of if (tsc_clocksource_reliable) check in unsynchronized_tsc()?

That's not the question. The patch format itself is broken:

@@ -1412,11 +1412,11 @@ void __init tsc_init(void)

    	use_tsc_delay();

+ check_system_tsc_reliable();
+
if (unsynchronized_tsc())
mark_tsc_unstable("TSCs unsynchronized");
- check_system_tsc_reliable();
-

That is not a patch created with diff -u or any other mechanism which creates properly formatted patches.

Thanks,

tglx