Re: [PATCH 2/4] perf/x86/ibs: Use CPUID region helper
From: Robert Richter
Date: Mon Apr 22 2024 - 17:31:37 EST
On 22.04.24 22:41:46, Borislav Petkov wrote:
> On Mon, Apr 22, 2024 at 10:09:57PM +0200, Robert Richter wrote:
> > Since we check get_cpuid_region_leaf()'s return code here we know if
> > the cpud leaf exists and return IBS_CAPS_DEFAULT if not. That would
> > not change the refB behaviour.
>
> Yes.
>
> > Though I think that case is rare or even not existing, I would just
> > keep the implementation like that and as it was for for years.
>
> Yes.
>
> > > > This slightly modifies the functionality so that 0 is return if
> > > > !IBS_CAPS_AVAIL (instead of IBS_CAPS_DEFAULT).
> > >
> > > If !IBS_CAPS_AVAIL, then this is revB. But then you want to return
> > > IBS_CAPS_DEFAULT there.
> >
> > No, on a rebB get_cpuid_region_leaf() would be false, meaning the
> > cpuid leaf is missing, function returns with IBS_CAPS_DEFAULT then.
>
> So what functionality modification do you mean then?
>
> When will IBS_CAPS_AVAIL be not set?
I mean the case where the cpuid leaf exists but IBS_CAPS_AVAIL is
clear. That could be possible with some cpuid override e.g. in virt
envs.
>
> GH BKDG says about that bit:
>
> "IBSFFV. IBS feature flags valid. Revision B = 0. Revision C = 1."
>
> so that has been set ever since on >= revC.
>
> And on revB we'll return IBS_CAPS_DEFAULT which has IBS_CAPS_AVAIL.
Yes, all this is correct.
>
> IOW, I don't see how we'll return 0 if !IBS_CAPS_AVAIL because latter
> doesn't happen practically with that flow.
Not on real hardware and if future systems not decide to enable IBS
feature bit and clear IBS_CAPS_AVAIL, which could be a valid case IMO.
Thanks,
-Robert
>
> Thx.
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette