Skip to contentSkip to conversation

x86: avoid check hlt for newer cpus

PATCH In review Jacob Pan 1 participant 3 messages May 7, 2010

Subsystems (2)
lore
Share & tools
lore

Jacob Pan

author
#0 lore raw

PATCH 1/1 x86: avoid check hlt for newer cpus

Check hlt instruction was targeted for some older CPUs. It is an expensive operation in that it takes 4 ticks to break out the check. We can avoid such check completely for newer x86 cpus ( family > 5).
http://lkml.org/lkml/2010/5/7/395

---
 arch/x86/kernel/cpu/bugs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/bugs.c +1 -1
index 01a2652..36d9bcf 100644
@@ -86,7 +86,7 @@ static void __init check_fpu(void)
 
 static void __init check_hlt(void)
 {
-	if (paravirt_enabled())
+	if (paravirt_enabled() || boot_cpu_data.x86 > 5)
 		return;
 
 	printk(KERN_INFO "Checking 'hlt' instruction... ");
Signature · 1 line
1.6.3.3
#1 lore raw

[tip:x86/mrst] x86: Avoid check hlt for newer cpus

Commit-ID:  d081dd5fe0ed8449433b972d3080f9d776e9424b
Gitweb:     http://git.kernel.org/tip/d081dd5fe0ed8449433b972d3080f9d776e9424b
Author:     Jacob Pan <[email protected]>
AuthorDate: Fri, 7 May 2010 14:59:45 -0700
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Fri, 7 May 2010 15:15:47 -0700

x86: Avoid check hlt for newer cpus

Check hlt instruction was targeted for some older CPUs. It is an expensive operation in that it takes 4 ticks to break out the check. We can avoid such check completely for newer x86 cpus (family >= 5).

[ hpa: corrected family > 5 to family >= 5 ]

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/cpu/bugs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/bugs.c +1 -1
index 01a2652..38f20e8 100644
@@ -86,7 +86,7 @@ static void __init check_fpu(void)
 
 static void __init check_hlt(void)
 {
-	if (paravirt_enabled())
+	if (boot_cpu_data >= 5 || paravirt_enabled())
 		return;
 
 	printk(KERN_INFO "Checking 'hlt' instruction... ");
#2 lore raw

[tip:x86/mrst] x86: Avoid check hlt for newer cpus

In reply to Jacob Pan
Commit-ID:  2b107d93635616db0c3f893c8cc2e6d5cd8d77b2
Gitweb:     http://git.kernel.org/tip/2b107d93635616db0c3f893c8cc2e6d5cd8d77b2
Author:     Jacob Pan <[email protected]>
AuthorDate: Fri, 7 May 2010 14:59:45 -0700
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Fri, 7 May 2010 15:31:17 -0700

x86: Avoid check hlt for newer cpus

Check hlt instruction was targeted for some older CPUs. It is an expensive operation in that it takes 4 ticks to break out the check. We can avoid such check completely for newer x86 cpus (family >= 5).

[ hpa: corrected family > 5 to family >= 5 ]

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/cpu/bugs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/bugs.c +1 -1
index 01a2652..c39576c 100644
@@ -86,7 +86,7 @@ static void __init check_fpu(void)
 
 static void __init check_hlt(void)
 {
-	if (paravirt_enabled())
+	if (boot_cpu_data.x86 >= 5 || paravirt_enabled())
 		return;
 
 	printk(KERN_INFO "Checking 'hlt' instruction... ");