[PATCH] x86/APIC: no need for timer calibration when using TDT

Jan Beulich posted 1 patch 2 years, 3 months ago
Test gitlab-ci failed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/6f79f1e1-119b-b8fc-11a9-5f56bfc163e7@suse.com
[PATCH] x86/APIC: no need for timer calibration when using TDT
Posted by Jan Beulich 2 years, 3 months ago
The only global effect of calibrate_APIC_clock() is the setting of
"bus_scale"; the final __setup_APIC_LVTT(0) is (at best) redundant with
the immediately following setup_APIC_timer() invocation. Yet "bus_scale"
isn't used when using TDT. Avoid wasting 100ms for calibration in this
case.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -1292,11 +1292,15 @@ void __init setup_boot_APIC_clock(void)
 
     check_deadline_errata();
 
+    if ( !boot_cpu_has(X86_FEATURE_TSC_DEADLINE) )
+        tdt_enable = false;
+
     local_irq_save(flags);
 
-    calibrate_APIC_clock();
+    if ( !tdt_enable || apic_verbosity )
+        calibrate_APIC_clock();
 
-    if ( tdt_enable && boot_cpu_has(X86_FEATURE_TSC_DEADLINE) )
+    if ( tdt_enable )
     {
         printk(KERN_DEBUG "TSC deadline timer enabled\n");
         tdt_enabled = true;


Re: [PATCH] x86/APIC: no need for timer calibration when using TDT
Posted by Andrew Cooper 2 years, 3 months ago
On 17/01/2022 10:32, Jan Beulich wrote:
> The only global effect of calibrate_APIC_clock() is the setting of
> "bus_scale"; the final __setup_APIC_LVTT(0) is (at best) redundant with
> the immediately following setup_APIC_timer() invocation. Yet "bus_scale"
> isn't used when using TDT. Avoid wasting 100ms for calibration in this
> case.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>