Platform SMIs and their interferance with tsc based delay calibration
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Venkatesh Pallipadi
(0) Estimate a value for
loops_per_jiffy
(1) While (loops_per_jiffyestimate is accurate enough)(2) wait for jiffy transition (jiffy1) (3) Note down current tsc (tsc1) (4) loop until tsc becomes tsc1 + loops_per_jiffy (5) check whether jiffy changed since jiffy1 or notand refine
loops_per_jiffyestimateCase 2: If SMIs happen between (3) and (4) above, then we can end up with a
loops_per_jiffyvalue that is too high.
I don't think this can really happen (at least not on the bootstrap CPU) because even if an SMI occurs, the CPU must first serve the timer interrupt and increment jiffies before it continues looping.
However "LPJ too short" is what needs to be avoided at all cost.
Regards and thanks for working on this problem,
Martin
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line · Linus Torvalds
In particular, I don't see why you didn't just put this in the generic
calibrate_delay()routine. You seem to have basically duplicated it, and added the "guess from an external timer" code - and I don't see what's non-generic about that, except for some trivial "what's the current timer" lookup.
The trivial lookup is hidden in the __delay() function. Making it return the number of "loops" it actually waited would help having a robust generic code.
Regards
Martin