lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230510235635.GC18514@ranerica-svr.sc.intel.com>
Date:   Wed, 10 May 2023 16:56:35 -0700
From:   Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>
To:     Dave Hansen <dave.hansen@...el.com>
Cc:     linux-kernel@...r.kernel.org, linux-tip-commits@...r.kernel.org,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Tony Luck <tony.luck@...el.com>,
        Len Brown <len.brown@...el.com>, Borislav Petkov <bp@...e.de>,
        x86@...nel.org
Subject: Re: [tip: perf/core] x86/cpu: Add helper function to get the type of
 the current hybrid CPU

On Wed, May 10, 2023 at 11:33:40AM -0700, Dave Hansen wrote:
> On 5/10/23 11:18, Ricardo Neri wrote:
> >> Sorry to dredge up an old thread.  But, where does this information
> >> about "If the processor is not hybrid, returns 0." come from?
> >>
> >> What is there to keep cpuid_eax(0x0000001a) from having 0x0 in those
> >> bits?  Seems to me like 0 is theoretically a valid hybrid CPU type.  Right?
> > My reasoning was that according to the Intel SDM the only valid values were
> > 0x20 and 0x40. 0 was meant to be an invalid value.
> 
> That doesn't make any sense to me really.  Just because today's SDM
> doesn't have a value doesn't mean that it becomes an invalid value tomorrow.
> 
> For instance, there's no model 0xEE today.  But that doesn't make it
> *INVALID*, it just means there's not one defined *today*.  Today's
> kernel shouldn't fall over if it runs on an model==0xEE system.

Yes, I agree. 0 may become a valid value tomorrow.

> 
> > I read the SDM again. It seems that cpuid_eax(0x0000001a) already returns
> > 0 when the leaf does not exist.
> 
> Right, but this isn't really relevant here either.  A CPU's APICID comes
> out of a leaf that can be unsupported (not exist).  That doesn't make
> APICID==0 invalid in any way.

But you always need an APICID, no? You would only need to get the CPU type
only when running on a hybrid CPU; from cpuid_eax(0x0000001a) or any other
future mechanism. Yes, I agree that is plausible to have 0 as the CPU type.

> 
> > Probably the check for X86_FEATURE_HYBRID_CPU is not needed.
> > 
> > Still, callers need to check for a valid value, IMO.
> 
> Right.  But if they're just going to check the number that comes back
> from this function, 0 can't represent an invalid value.

So maybe changing the function to return -ENOTSUP or -ENODEV on a non-hybrid
processor?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ