x86/tsc: limit the usage of synchronization rendezvous
PATCH 1/1 x86/tsc: limit the usage of synchronization rendezvous
If Xen detects the TSC is unreliable it will set a rendezvous helper that tries to synchronize the different CPUs TSC value by propagating the one from CPU#0 and writing it into the IA32_TSC MSR on each CPU.
When the system has a single thread and there are no hotplugable CPUs doing the above just results in reading the TSC from CPU#0 and writing it into the IA32_TSC MSR of CPU#0, which is pointless, so limit the usage of the synchronization rendezvous to systems that have more than one CPU, even if those CPUs are yet to be hotplugged.
---
I'm not sure whether this is suitable for 4.13, being a performance improvement but not fixing a functional bug.
--- xen/arch/x86/time.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/time.c +2 -1
@@ -1821,7 +1821,8 @@ static int __init verify_tsc_reliability(void)* are not marked as 'reliable', re-sync during rendezvous. */ if (boot_cpu_has (X86_FEATURE_CONSTANT_TSC ) && - !boot_cpu_has (X86_FEATURE_TSC_RELIABLE ) ) + !boot_cpu_has (X86_FEATURE_TSC_RELIABLE ) && +num_present_cpus () >1 ) time_calibration_rendezvous_fn = time_calibration_tsc_rendezvous;return 0 ;
Signature · 7 lines
2.23.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Roger Pau Monne
If Xen detects the TSC is unreliable it will set a rendezvous helper that tries to synchronize the different CPUs TSC value by propagating the one from CPU#0 and writing it into the
IA32_TSCMSR on each CPU.When the system has a single thread and there are no hotplugable CPUs doing the above just results in reading the TSC from CPU#0 and writing it into the
IA32_TSCMSR of CPU#0, which is pointless, so limit the usage of the synchronization rendezvous to systems that have more than one CPU, even if those CPUs are yet to be hotplugged.
Quoted 4 lines
Signed-off-by Roger Pau Monné <[email protected]>---
I'm not sure whether this is suitable for 4.13, being a performance improvement but not fixing a functional bug.
Unless we know there's a lot of use of Xen in UP mode, I'd say rather not. _If_ there was a lot of such use, then I think we ought to do more work towards performance there (like re- introducing SMP alternatives patching).
Of course in the end the decision is to be taken by Jürgen, whom you didn't even Cc.
xen/arch/x86/time.c static int __init verify_tsc_reliability(void) · line 1826
Quoted 10 lines
xen/arch/x86/time.c +2
-1@@ -1821,7 +1821,8 @@ static int __init verify_tsc_reliability(void)* are not marked as 'reliable', re-sync during rendezvous. */ if (boot_cpu_has (X86_FEATURE_CONSTANT_TSC ) && - !boot_cpu_has (X86_FEATURE_TSC_RELIABLE ) ) + !boot_cpu_has (X86_FEATURE_TSC_RELIABLE ) && +num_present_cpus () >1 ) time_calibration_rendezvous_fn = time_calibration_tsc_rendezvous;
Did you consider the alternative of switching the rendezvous function when going from UP to MP mode (or back)?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 16 lines · Jan Beulich
Quoted 10 lines · Roger Pau Monne
If Xen detects the TSC is unreliable it will set a rendezvous helper that tries to synchronize the different CPUs TSC value by propagating the one from CPU#0 and writing it into the
IA32_TSCMSR on each CPU.When the system has a single thread and there are no hotplugable CPUs doing the above just results in reading the TSC from CPU#0 and writing it into the
IA32_TSCMSR of CPU#0, which is pointless, so limit the usage of the synchronization rendezvous to systems that have more than one CPU, even if those CPUs are yet to be hotplugged.Quoted 4 lines
Signed-off-by Roger Pau Monné <[email protected]>---
I'm not sure whether this is suitable for 4.13, being a performance improvement but not fixing a functional bug.
Quoted 4 lines
Unless we know there's a lot of use of Xen in UP mode, I'd say rather not. _If_ there was a lot of such use, then I think we ought to do more work towards performance there (like re- introducing SMP alternatives patching).
I believe the main use case is pv-shim.
Quoted 2 lines
Of course in the end the decision is to be taken by Jürgen, whom you didn't even Cc.
I'm inclined not to Release-ack it.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 16 lines · Jan Beulich
Quoted 10 lines · Roger Pau Monne
If Xen detects the TSC is unreliable it will set a rendezvous helper that tries to synchronize the different CPUs TSC value by propagating the one from CPU#0 and writing it into the
IA32_TSCMSR on each CPU.When the system has a single thread and there are no hotplugable CPUs doing the above just results in reading the TSC from CPU#0 and writing it into the
IA32_TSCMSR of CPU#0, which is pointless, so limit the usage of the synchronization rendezvous to systems that have more than one CPU, even if those CPUs are yet to be hotplugged.Quoted 4 lines
Signed-off-by Roger Pau Monné <[email protected]>---
I'm not sure whether this is suitable for 4.13, being a performance improvement but not fixing a functional bug.
Quoted 7 lines
Unless we know there's a lot of use of Xen in UP mode, I'd say rather not. _If_ there was a lot of such use, then I think we ought to do more work towards performance there (like re- introducing SMP alternatives patching).
Of course in the end the decision is to be taken by Jürgen, whom you didn't even Cc.
Since this is a performance fix I felt like it wasn't really appropriate for 4.13, hence I didn't Cc Jürgen but added this note.
Quoted 5 lines
Quoted 5 lines
xen/arch/x86/time.c +0
-0@@ -1821,7 +1821,8 @@ static int __init verify_tsc_reliability(void)* are not marked as 'reliable', re-sync during rendezvous. */
Quoted 8 lines
xen/arch/x86/time.c static int __init verify_tsc_reliability(void) · line 1826
Quoted 5 lines
xen/arch/x86/time.c +2
-1if (boot_cpu_has (X86_FEATURE_CONSTANT_TSC ) && - !boot_cpu_has (X86_FEATURE_TSC_RELIABLE ) ) + !boot_cpu_has (X86_FEATURE_TSC_RELIABLE ) && +num_present_cpus () >1 ) time_calibration_rendezvous_fn = time_calibration_tsc_rendezvous;Did you consider the alternative of switching the rendezvous function when going from UP to MP mode (or back)?
I will look into that. The usefulness of this fix is quite limited, given it only applies to UP, so I didn't want to add a lot of complexity for a not very common scenario IMO.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel