Re: [PATCH V2 03/11] perf/x86: Add support for TSC in nanoseconds as a perf event clock

From: Peter Zijlstra
Date: Mon Mar 07 2022 - 09:42:43 EST


On Mon, Mar 07, 2022 at 02:36:03PM +0200, Adrian Hunter wrote:

> > diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
> > index 4420499f7bb4..a1f179ed39bf 100644
> > --- a/arch/x86/kernel/paravirt.c
> > +++ b/arch/x86/kernel/paravirt.c
> > @@ -145,6 +145,15 @@ DEFINE_STATIC_CALL(pv_sched_clock, native_sched_clock);
> >
> > void paravirt_set_sched_clock(u64 (*func)(void))
> > {
> > + /*
> > + * Anything with ART on promises to have sane TSC, otherwise the whole
> > + * ART thing is useless. In order to make ART useful for guests, we
> > + * should continue to use the TSC. As such, ignore any paravirt
> > + * muckery.
> > + */
> > + if (cpu_feature_enabled(X86_FEATURE_ART))
>
> Does not seem to work because the feature X86_FEATURE_ART does not seem to get set.
> Possibly because detect_art() excludes anything running on a hypervisor.

Simple enough to delete that clause I suppose. Christopher, what is
needed to make that go away? I suppose the guest needs to be aware of
the active TSC scaling parameters to make it work ?