Re: [PATCH 6/7] x86/vdso: Add vDSO functions for user wait instructions

From: Thomas Gleixner
Date: Wed Aug 01 2018 - 04:55:48 EST

On Tue, 31 Jul 2018, Andy Lutomirski wrote:
> On Tue, Jul 31, 2018 at 2:22 PM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> >> u64 start = __vdso_read_art_ns();
> >
> > Errm. No. You can't read ART. ART is only used by decives to which it is
> > distributed. You can only read TSC here and convert that to nsecs.
> Bah.
> But my point remains -- I think that the user (non-vDSO) code should
> think in nanoseconds, not TSC ticks. That we have have a much better
> chance of getting migration right.

Agreed. And we should not create new interfaces for that. We already have
clock_gettime() which is the right thing to use.

> > A possible solution would be to use CLOCK_MOTONIC_RAW which is not affected
> > by NTP/PTP adjustments. But that still has the issue of TSC not being the
> > timekeeping clocksource. Bah, the whole TSC deadline mode sucks. I have no
> > idea what's wrong with simple down counters. They Just Work.
> I think it's not totally crazy to declare UMWAIT on a system with a
> non-TSC clocksource to be unsupported.

Sure, the information is already available in the VDSO gtod data.