Re: [PATCH] x86/cacheinfo: fix a -Wtype-limits warning

From: Sean Christopherson
Date: Wed Jun 19 2019 - 13:18:00 EST


On Wed, Jun 19, 2019 at 07:01:27PM +0200, Borislav Petkov wrote:
> On Wed, Jun 05, 2019 at 01:07:04PM -0700, Sean Christopherson wrote:
> > Might be worth calling out in the changelog that 'c->x86 == 0x17' is true
> > if and only if c->x86_model was explicitly set by cpu_detect(), i.e. the
> > patch is correct even if the original intent was a misguided attempt to
> > check that x86_model has been set.
>
> Are you thinking about some sick virt scenario where base CPUID level is < 1?

Ha, no. My comment was that it'd be worth explaining that the original
'c->x86_model >= 0' check was completely bogus, even if the intent was
something like 'c->x86_model != 0'.

> In this particular case, there's a guard at the beginning of
> cacheinfo_amd_init_llc_id():
>
> if (!cpuid_edx(0x80000006))
> return;
>
> but if there's CPUs which have CPUID 0x80000006 but base CPUID level is
> < 1, then that's their problem.
>
> --
> Regards/Gruss,
> Boris.
>
> Good mailing practices for 400: avoid top-posting and trim the reply.