Re: [PATCH v3 1/3] arch, x86, tsc deadline clockevent dev: reduce frequency roundoff error

From: Paolo Bonzini
Date: Wed Jul 13 2016 - 09:52:46 EST




On 13/07/2016 15:49, Peter Zijlstra wrote:
> On Wed, Jul 13, 2016 at 03:03:42PM +0200, Nicolai Stange wrote:
>
>> clockevents_config_and_register(levt,
>> + (u32)(((u64)tsc_khz * 1000) /
>> + TSC_DIVISOR),
>> 0xF, ~0UL);
>
> div_u64() perhaps ?

Or just squash together the two patches and do

tsc_khz * (1000 / TSC_DIVISOR)

because with TSC_DIVISOR equal to 2/4/8 there is no error from
reassociating the operation.

Paolo