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]
Date:	Mon, 03 Jan 2011 11:58:32 +0100
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	Lin Ming <ming.m.lin@...el.com>
Cc:	Ingo Molnar <mingo@...e.hu>, Andi Kleen <andi@...stfloor.org>,
	Stephane Eranian <eranian@...gle.com>,
	lkml <linux-kernel@...r.kernel.org>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH 4/7] perf: Check if HT is supported and enabled

On Tue, 2010-12-28 at 16:51 +0800, Lin Ming wrote:
> > +static bool ht_enabled(int cpu)
> > +{
> > +       int total_logical_processors, total_cores;
> > +       unsigned int eax, ebx, ecx, edx;
> > +
> > +       cpuid(1, &eax, &ebx, &ecx, &edx);
> > +
> > +       /* Bit 28 in EDX indicates if it's HT capable */
> > +       if (!(edx & 0x10000000))
> > +               return false;
> > +
> > +       total_logical_processors = (ebx >> 16) & 0xff;
> > +
> > +       ecx = 0;
> > +       cpuid(4, &eax, &ebx, &ecx, &edx);
> > +       total_cores = ((eax >> 26) & 0x3f) + 1;
> > +
> > +       /* Thread nums per core */
> > +       return (total_logical_processors / total_cores) > 1;
> > +}
> > +
> 
> This function can be simplified as below,
> 
> static bool ht_enabled()
> {
>         if (!cpu_has(&boot_cpu_data, X86_FEATURE_HT))
>                 return false;
> 
>         return smp_num_siblings > 1;
> }
> 
> But this still can't detect if HT is on or off.
> smp_num_siblings is always 2 even if HT is disabled in BIOS.
> 
> Any idea how to detect if HT is on or not?

Not quite sure, the intel docs aren't really clear on how the HW
supports HT, has 2 siblings but BIOS disabled it thing works. I just
tried reading the arch/x86 code but that only got me more confused.

hpa, could you comment?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ