• Nicolai Stange's avatar
    x86/timers/apic: Inform TSC deadline clockevent device about recalibration · 6731b0d6
    Nicolai Stange authored
    This patch eliminates a source of imprecise APIC timer interrupts,
    which imprecision may result in double interrupts or even late
    interrupts.
    
    The TSC deadline clockevent devices' configuration and registration
    happens before the TSC frequency calibration is refined in
    tsc_refine_calibration_work().
    
    This results in the TSC clocksource and the TSC deadline clockevent
    devices being configured with slightly different frequencies: the former
    gets the refined one and the latter are configured with the inaccurate
    frequency detected earlier by means of the "Fast TSC calibration using PIT".
    
    Within the APIC code, introduce the notifier function
    lapic_update_tsc_freq() which reconfigures all per-CPU TSC deadline
    clockevent devices with the current tsc_khz.
    
    Call it from the TSC code after TSC calibration refinement has happened.
    Signed-off-by: default avatarNicolai Stange <nicstange@gmail.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: Christopher S. Hall <christopher.s.hall@intel.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
    Cc: Len Brown <len.brown@intel.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Viresh Kumar <viresh.kumar@linaro.org>
    Link: http://lkml.kernel.org/r/20160714152255.18295-3-nicstange@gmail.com
    [ Pushed #ifdef CONFIG_X86_LOCAL_APIC into header, improved changelog. ]
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    6731b0d6
apic.h 15.9 KB