From: Ben Collins <bcollins@ubuntu.com>
To: linux-kernel@vger.kernel.org
Cc: torvalds@osdl.org
Subject: [PATCH 1/4] [x86] Add command line option to enable/disable hyper-threading.
Date: Wed, 29 Nov 2006 23:26:05 -0500 [thread overview]
Message-ID: <11648607733630-git-send-email-bcollins@ubuntu.com> (raw)
In-Reply-To: <11648607683157-git-send-email-bcollins@ubuntu.com>
This patch adds a config option to allow disabling hyper-threading by
default, and a kernel command line option to changes this default at
boot time.
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
---
Documentation/kernel-parameters.txt | 3 +++
arch/i386/Kconfig | 5 +++++
arch/i386/kernel/cpu/common.c | 29 +++++++++++++++++++++++++++++
3 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 6747384..2b68d6e 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -600,6 +600,9 @@ and is between 256 and 4096 characters.
hisax= [HW,ISDN]
See Documentation/isdn/README.HiSax.
+ ht= [HW,IA-32,SMP] Enable or disable hyper-threading.
+ Format: <on|off>
+
hugepages= [HW,IA-32,IA-64] Maximal number of HugeTLB pages.
noirqbalance [IA-32,SMP,KNL] Disable kernel irq balancing
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 8ff1c6f..b4a2461 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -1185,6 +1185,11 @@ config X86_HT
depends on SMP && !(X86_VISWS || X86_VOYAGER)
default y
+config X86_HT_DISABLE
+ bool "Disable Hyper-Threading by default"
+ depends on X86_HT
+ default n
+
config X86_BIOS_REBOOT
bool
depends on !(X86_VISWS || X86_VOYAGER)
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index d9f3e3c..42d2361 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -482,6 +482,29 @@ void __cpuinit identify_cpu(struct cpuin
}
#ifdef CONFIG_X86_HT
+
+#ifdef CONFIG_X86_HT_DISABLE
+static int disable_ht __cpuinitdata = 1;
+#else
+static int disable_ht __cpuinitdata;
+#endif
+
+static int __init parse_ht(char *arg)
+{
+ if (!arg)
+ return -EINVAL;
+
+ if (!memcmp(arg, "on", 2))
+ disable_ht = 0;
+ else if (!memcmp(arg, "off", 3))
+ disable_ht = 1;
+ else
+ return -EINVAL;
+
+ return 0;
+}
+early_param("ht", parse_ht);
+
void __cpuinit detect_ht(struct cpuinfo_x86 *c)
{
u32 eax, ebx, ecx, edx;
@@ -492,6 +515,12 @@ void __cpuinit detect_ht(struct cpuinfo_
if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY))
return;
+ if (disable_ht) {
+ printk(KERN_INFO "CPU: Hyper-Threading disabled by default. Enable with ht=on\n");
+ smp_num_siblings = 1;
+ return;
+ }
+
smp_num_siblings = (ebx & 0xff0000) >> 16;
if (smp_num_siblings == 1) {
--
1.4.1
next prev parent reply other threads:[~2006-11-30 4:26 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-30 4:26 Ubuntu patch sync for 2.6.20 Ben Collins
2006-11-30 4:26 ` Ben Collins
2006-11-30 4:26 ` Ben Collins
2006-11-30 4:26 ` Ben Collins [this message]
2006-11-30 11:06 ` [PATCH 1/4] [x86] Add command line option to enable/disable hyper-threading Alan
2006-11-30 18:08 ` Siddha, Suresh B
2006-12-01 13:29 ` Pavel Machek
2006-12-01 13:41 ` Ben Collins
2006-12-01 14:32 ` Arjan van de Ven
2006-12-01 15:09 ` Ben Collins
2006-12-01 16:10 ` Arjan van de Ven
2006-12-01 16:14 ` Ben Collins
2006-12-01 16:20 ` Linus Torvalds
2006-12-01 16:56 ` Alan
2006-12-01 17:13 ` Mark Rustad
2006-11-30 4:26 ` [PATCH 2/4] [APIC] Allow disabling of UP APIC/IO-APIC by default, with command line option to turn it on Ben Collins
2006-12-01 8:39 ` Ingo Molnar
2006-12-01 20:56 ` Ben Collins
2006-12-02 8:56 ` Ingo Molnar
2006-11-30 4:26 ` [PATCH 3/4] [ATM] Add CPPFLAGS to byteorder.h check Ben Collins
2006-11-30 4:26 ` [PATCH 4/4] [HVCS] Select HVC_CONSOLE if HVCS is enabled Ben Collins
2006-11-30 12:32 ` Roman Zippel
2006-11-30 15:04 ` Ben Collins
-- strict thread matches above, loose matches on Subject: below --
2006-12-07 22:50 [PATCH 1/4] [x86] Add command line option to enable/disable hyper-threading Peter Cordes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11648607733630-git-send-email-bcollins@ubuntu.com \
--to=bcollins@ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox