Re: [PATCH v4 01/10] timekeeper: introduce extended clocksource reading callback

From: Paolo Bonzini
Date: Wed Aug 02 2017 - 13:21:30 EST


On 02/08/2017 19:08, John Stultz wrote:
>> + bool (*read_with_stamp)(struct clocksource *cs,
>> + u64 *cycles, u64 *cycles_stamp);
>> u64 mask;
> I'm not really fan of an interface that leaks magic data to users that
> know enough.
>
> And its not clear from this if the magic data is standardized or
> different clocksources export different data?
>
> What exactly are the attributes you're trying to pull from the
> lower-level hardware that you can't get otherwise (without using the
> update_pvclock_gtod() since, if I'm understanding that apparently
> gives you too much detail to deal with)?

We need the exact TSC value that was used to compute the ktime. This is
different between TSC and kvmclock because TSC's read() callback
returns cycles (of course), while kvmclock's read() callback returns
nanoseconds.

In turn, kvmclock's read() callback returns nanoseconds because it has
to check the read against the host-provided seqlock, so this cannot be
changed.

Paolo