linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/x86/intel/pt: Use boot_cpu_has() because it's there
@ 2016-04-06 14:35 Alexander Shishkin
  2016-04-06 16:57 ` Borislav Petkov
  2016-04-13 11:34 ` [tip:perf/core] " tip-bot for Alexander Shishkin
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander Shishkin @ 2016-04-06 14:35 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ingo Molnar, linux-kernel, vince, eranian,
	Arnaldo Carvalho de Melo, Borislav Petkov, 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.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
 arch/x86/events/intel/pt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
index 32b613e863..7c7f09a8fe 100644
--- a/arch/x86/events/intel/pt.c
+++ b/arch/x86/events/intel/pt.c
@@ -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();
-- 
2.8.0.rc3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf/x86/intel/pt: Use boot_cpu_has() because it's there
  2016-04-06 14:35 [PATCH] perf/x86/intel/pt: Use boot_cpu_has() because it's there Alexander Shishkin
@ 2016-04-06 16:57 ` Borislav Petkov
  2016-04-13 11:34 ` [tip:perf/core] " tip-bot for Alexander Shishkin
  1 sibling, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2016-04-06 16:57 UTC (permalink / raw)
  To: Alexander Shishkin
  Cc: Peter Zijlstra, Ingo Molnar, linux-kernel, vince, eranian,
	Arnaldo Carvalho de Melo

On Wed, Apr 06, 2016 at 05:35:07PM +0300, Alexander Shishkin wrote:
> 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.
> 
> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> ---
>  arch/x86/events/intel/pt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
> index 32b613e863..7c7f09a8fe 100644
> --- a/arch/x86/events/intel/pt.c
> +++ b/arch/x86/events/intel/pt.c
> @@ -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();
> -- 

Acked-by: Borislav Petkov <bp@suse.de>

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.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:perf/core] perf/x86/intel/pt: Use boot_cpu_has() because it's there
  2016-04-06 14:35 [PATCH] perf/x86/intel/pt: Use boot_cpu_has() because it's there Alexander Shishkin
  2016-04-06 16:57 ` Borislav Petkov
@ 2016-04-13 11:34 ` tip-bot for Alexander Shishkin
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Alexander Shishkin @ 2016-04-13 11:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: a.p.zijlstra, hpa, bp, mingo, peterz, torvalds, tglx,
	alexander.shishkin, bp, linux-kernel, acme

Commit-ID:  e465de1cd5e1759e40f077bac287de60d56ad06c
Gitweb:     http://git.kernel.org/tip/e465de1cd5e1759e40f077bac287de60d56ad06c
Author:     Alexander Shishkin <alexander.shishkin@linux.intel.com>
AuthorDate: Wed, 6 Apr 2016 17:35:07 +0300
Committer:  Ingo Molnar <mingo@kernel.org>
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.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Acked-by: Borislav Petkov <bp@suse.de>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: eranian@google.com
Cc: vince@deater.net
Link: http://lkml.kernel.org/r/1459953307-14372-1-git-send-email-alexander.shishkin@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/events/intel/pt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
index 127f58c..1aefd43 100644
--- a/arch/x86/events/intel/pt.c
+++ b/arch/x86/events/intel/pt.c
@@ -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();

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-13 11:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-06 14:35 [PATCH] perf/x86/intel/pt: Use boot_cpu_has() because it's there Alexander Shishkin
2016-04-06 16:57 ` Borislav Petkov
2016-04-13 11:34 ` [tip:perf/core] " tip-bot for Alexander Shishkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).