Messages in this thread | | | Date | Sat, 3 Nov 2018 11:04:10 +0100 (CET) | From | Thomas Gleixner <> | Subject | Re: [PATCH] tsc: make calibration refinement more robust |
| |
Daniel,
On Fri, 2 Nov 2018, Daniel Vacek wrote: > On Thu, Nov 1, 2018 at 4:34 PM, Thomas Gleixner <tglx@linutronix.de> wrote: > >> -#define MAX_RETRIES 5 > >> -#define SMI_TRESHOLD 50000 > >> +#define MAX_RETRIES 5 > >> +#define TSC_THRESHOLD (tsc_khz >> 5) > > > > This breaks pit_hpet_ptimer_calibrate_cpu() because at that point tsc_hkz is 0. > > That did not show up with my testing, sorry. I guess > pit_calibrate_tsc() never failed for me. Hmm, actually it looks like > quick_pit_calibrate() does the job for me so > pit_hpet_ptimer_calibrate_cpu() is likely not even called.
Right. It's only called when quick calibration fails. Testing does not replace code inspection :)
> Would this: > > #define TSC_THRESHOLD (tsc_khz? tsc_khz >> 5: 0x20000) > > work for you instead? Or alternatively at some point when chasing this > down I used: > > #define TSC_THRESHOLD (0x10000 + (tsc_khz >> 6)) > > The first one seems better though. I can send v2 next week if you like it.
Can you please avoid hiding the logic in a macro? Just use a local variable:
u64 thresh = tsc_khz ? tsc_khz >> 5 : TSC_DEFAULT_THRESHOLD;
and use that in the comparison.
Thanks,
tglx
| |