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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230510181815.GA18418@ranerica-svr.sc.intel.com>
Date:   Wed, 10 May 2023 11:18:15 -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 Fri, May 05, 2023 at 09:42:36AM -0700, Dave Hansen wrote:
> On 4/20/21 03:46, tip-bot2 for Ricardo Neri wrote:
> > +#define X86_HYBRID_CPU_TYPE_ID_SHIFT	24
> > +
> > +/**
> > + * get_this_hybrid_cpu_type() - Get the type of this hybrid CPU
> > + *
> > + * Returns the CPU type [31:24] (i.e., Atom or Core) of a CPU in
> > + * a hybrid processor. If the processor is not hybrid, returns 0.
> > + */
> > +u8 get_this_hybrid_cpu_type(void)
> > +{
> > +	if (!cpu_feature_enabled(X86_FEATURE_HYBRID_CPU))
> > +		return 0;
> > +
> > +	return cpuid_eax(0x0000001a) >> X86_HYBRID_CPU_TYPE_ID_SHIFT;
> > +}
> 
> Hi Folks,

Hi Dave,

> 
> 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.

I read the SDM again. It seems that cpuid_eax(0x0000001a) already returns
0 when the leaf does not exist.

Probably the check for X86_FEATURE_HYBRID_CPU is not needed.

Still, callers need to check for a valid value, IMO.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ