[RndTbl] reliable way of counting real CPUs under Linux?

Sean Walberg sean at ertw.com
Tue Apr 22 17:52:41 CDT 2014


I was just looking at
https://github.com/opscode/ohai/blob/master/lib/ohai/plugins/linux/cpu.rband
realized it's related to this conversation. It's how Chef enumerates
CPUs on Linux and lines 42-44 is where it differentiates a real cpu vs a
logical one.

Sean


On Tue, Apr 22, 2014 at 3:55 PM, Gilbert E. Detillieux <
gedetil at cs.umanitoba.ca> wrote:

> This article from several years ago suggests AMD processors did not
> support hyper-threading...
>
> http://www.ducea.com/2006/06/23/linux-tips-how-to-find-out-
> if-a-your-cpu-supports-ht-hyper-threading/
>
> ...  but suggests they may in the future.  A talk with my CPU-savvy
> co-worker confirmed that AMD has never supported HT, and likely wouldn't
> ever.
>
> So, that raises the question:  What exactly does the "ht" flag in
> /proc/cpuinfo mean, then, if it's not the existence of HT?  This thread
> offers some insight...
>
> https://groups.google.com/forum/#!topic/fa.linux.kernel/rAttTaRINKw
>
> So, the "ht" flag seems to just indicate a processor's ability to detect
> siblings, whether they're actual cores or just HT.  Misleading, yes, but
> they chose to leave it that way rather than break the ABI.
>
> <rant>
> Let's leave an obscure, misleading flag in a particular /proc file alone,
> to avoid breaking things for some programmer, somewhere, who may be doing
> some weird test that would be better done in some other way. But, on the
> other hand, let's completely change the way all process and device
> initialization happens in a very fundamental way, regardless of how many
> scripts and 3rd-party services break as a result...
>
> Gotta love Linux!  (OK, that may be an unfair juxtaposition, since we're
> talking about kernel vs user space, and different groups of people
> supporting these, with radically different priorities and methods.  But
> still...  Ugh!)
> </rant>
>
> Gilbert
>
>
> On 21/04/2014 9:02 AM, Grigory Shamov wrote:
>
>> Dear Gilbert,
>>
>> On 14-04-17 4:33 PM, "Gilbert E. Detillieux" <gedetil at cs.umanitoba.ca>
>> wrote:
>>
>>> On 17/04/2014 4:01 PM, Grigory Shamov wrote:
>>>
>>>> Hi Gilbert,
>>>>
>>>> Thanks!
>>>>
>>>> There is a lot of advice there for sure. For example, The 'ht' flag is
>>>> always there on our AMD Opterons (Shaghais and Barcelonas), even they do
>>>> not have HT enabled. I'd think that 'ht' it is always there in any
>>>> SMP-enabled linux kernel?
>>>>
>>>
>>> More likely, it's always there for any processor that supports HT,
>>> whether it's currently enabled or not.
>>>
>>
>>
>> Do you know if AMD Opterons support HT?
>>
>> model name      : Quad-Core AMD Opteron(tm) Processor 2376
>> flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
>> mca cmov pat
>> pse36 clflush mmx fxsr sse sse2 *ht* etc. etc.
>>
>>
>> model name      : Six-Core AMD Opteron(tm) Processor 2431
>> flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
>> mca cmov pat
>> pse36 clflush mmx fxsr sse sse2 *ht* etc. etc.
>>
>
> --
> Gilbert E. Detillieux           E-mail: <gedetil at muug.mb.ca>
> Manitoba UNIX User Group        Web:    http://www.muug.mb.ca/
> PO Box 130 St-Boniface          Phone:  (204)474-8161
> Winnipeg MB CANADA  R2H 3B4     Fax:    (204)474-7609
>
> _______________________________________________
> Roundtable mailing list
> Roundtable at muug.mb.ca
> http://www.muug.mb.ca/mailman/listinfo/roundtable
>



-- 
Sean Walberg <sean at ertw.com>    http://ertw.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.muug.mb.ca/pipermail/roundtable/attachments/20140422/02babd3d/attachment.html>


More information about the Roundtable mailing list