Skip to contentSkip to conversation

perf/x86/intel/pt: Use boot_cpu_has() because it's there

PATCH In review Alexander Shishkin 3 participants 3 messages Apr 6, 2016 – Apr 13, 2016

Subsystems (2)
lore
Share & tools
lore

Alexander Shishkin

author reviewer
#0 lore raw

PATCH 1/1 perf/x86/intel/pt: Use boot_cpu_has() because it's there

At the moment, initialization path is using test_cpu_cap(&boot_cpu_data), to detect PT, which is just open coding boot_cpu_has(). Use the latter instead.

---
 arch/x86/events/intel/pt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/pt.c +1 -1
index 32b613e863..7c7f09a8fe 100644
@@ -1159,7 +1159,7 @@ static __init int pt_init(void)
 
 	BUILD_BUG_ON(sizeof(struct topa) > PAGE_SIZE);
 
-	if (!test_cpu_cap(&boot_cpu_data, X86_FEATURE_INTEL_PT))
+	if (!boot_cpu_has(X86_FEATURE_INTEL_PT))
 		return -ENODEV;
 
 	get_online_cpus();
Signature · 1 line
2.8.0.rc3
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Alexander Shishkin

At the moment, initialization path is using test_cpu_cap(&boot_cpu_data), to detect PT, which is just open coding boot_cpu_has(). Use the latter instead.

---
 arch/x86/events/intel/pt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/pt.c +0 -0
index 32b613e863..7c7f09a8fe 100644

arch/x86/events/intel/pt.c static __init int pt_init(void) · line 1165

Quoted 8 lines
arch/x86/events/intel/pt.c +1 -1
@@ -1159,7 +1159,7 @@ static __init int pt_init(void)
 
 	BUILD_BUG_ON(sizeof(struct topa) > PAGE_SIZE);
 
-	if (!test_cpu_cap(&boot_cpu_data, X86_FEATURE_INTEL_PT))
+	if (!boot_cpu_has(X86_FEATURE_INTEL_PT))
 		return -ENODEV;
 
 	get_online_cpus();

Btw, there's another wonderful gem in the tree:

arch/x86/kernel/cpu/cyrix.c:201: if (test_cpu_cap(c, 1*32+24)) {

Jeez, and a naked number at that which is not even a define in arch/x86/include/asm/cpufeatures.h

Ah, I need to look at the whole thing:

        /* Cyrix used bit 24 in extended (AMD) CPUID for Cyrix MMX extensions */
        if (test_cpu_cap(c, 1*32+24)) {
                clear_cpu_cap(c, 1*32+24);
                set_cpu_cap(c, X86_FEATURE_CXMMX);
        }

So it is actually a correction for "smart" hw.

Signature · 4 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
#2 lore raw
In reply to Alexander Shishkin
perf/x86/intel/pt: Use boot_cpu_has() because it's there
Commit-ID:  e465de1cd5e1759e40f077bac287de60d56ad06c
Gitweb:     http://git.kernel.org/tip/e465de1cd5e1759e40f077bac287de60d56ad06c
Author:     Alexander Shishkin <[email protected]>
AuthorDate: Wed, 6 Apr 2016 17:35:07 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 13 Apr 2016 10:49:23 +0200

perf/x86/intel/pt: Use boot_cpu_has() because it's there

At the moment, initialization path is using test_cpu_cap(&boot_cpu_data), to detect PT, which is just open coding boot_cpu_has(). Use the latter instead.

---
 arch/x86/events/intel/pt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/pt.c +1 -1
index 127f58c..1aefd43 100644
@@ -1106,7 +1106,7 @@ static __init int pt_init(void)
 
 	BUILD_BUG_ON(sizeof(struct topa) > PAGE_SIZE);
 
-	if (!test_cpu_cap(&boot_cpu_data, X86_FEATURE_INTEL_PT))
+	if (!boot_cpu_has(X86_FEATURE_INTEL_PT))
 		return -ENODEV;
 
 	get_online_cpus();