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: <1403285253-25547-3-git-send-email-prarit@redhat.com>
Date:	Fri, 20 Jun 2014 13:27:33 -0400
From:	Prarit Bhargava <prarit@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	Prarit Bhargava <prarit@...hat.com>, Oren Twaig <oren@...lemp.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	Borislav Petkov <bp@...e.de>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andi Kleen <ak@...ux.intel.com>, Dave Jones <davej@...hat.com>,
	Torsten Kaiser <just.for.lkml@...glemail.com>,
	Jan Beulich <JBeulich@...e.com>,
	Jan Kiszka <jan.kiszka@...mens.com>,
	Toshi Kani <toshi.kani@...com>,
	Andrew Jones <drjones@...hat.com>
Subject: [PATCH 2/2] x86, disable ht flag when hyperthreading is disabled

The ht flag indicates that a processor is capable of having sibling threads.
This has long been confusing for users who confuse the ht flag as
indicating that hyperthreading is enabled on their systems even though
it may have been disabled in BIOS.

This patch removes the hyperthreading flag when no cpu thread siblings are
found, ie) smp_num_siblings == 1.

Cc: Oren Twaig <oren@...lemp.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: x86@...nel.org
Cc: Borislav Petkov <bp@...e.de>
Cc: Paul Gortmaker <paul.gortmaker@...driver.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Dave Jones <davej@...hat.com>
Cc: Torsten Kaiser <just.for.lkml@...glemail.com>
Cc: Jan Beulich <JBeulich@...e.com>
Cc: Jan Kiszka <jan.kiszka@...mens.com>
Cc: Toshi Kani <toshi.kani@...com>
Cc: Andrew Jones <drjones@...hat.com>
Signed-off-by: Prarit Bhargava <prarit@...hat.com>
---
 arch/x86/kernel/smpboot.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index e5ab30b..2eaadf0 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -371,6 +371,7 @@ void set_cpu_sibling_map(int cpu)
 		cpumask_set_cpu(cpu, cpu_core_mask(cpu));
 		c->booted_cores = 1;
 		smp_num_siblings = 1;
+		clear_cpu_cap(c, X86_FEATURE_HT);
 		return;
 	}
 
@@ -419,6 +420,9 @@ void set_cpu_sibling_map(int cpu)
 	/* Only need to check this on the boot cpu, o/w it is disabled */
 	if (cpu == 0)
 		smp_num_siblings = cpumask_weight(cpu_sibling_mask(cpu));
+
+	if (cpu_has_ht && smp_num_siblings == 1)
+		clear_cpu_cap(c, X86_FEATURE_HT);
 }
 
 /* maps the cpu to the sched domain representing multi-core */
-- 
1.7.9.3

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