From: tip-bot for Robert Richter <robert.richter@amd.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
robert.richter@amd.com, a.p.zijlstra@chello.nl,
tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perf/core] perf, x86: Use ALTERNATIVE() to check for X86_FEATURE_PERFCTR_CORE
Date: Tue, 19 Apr 2011 12:04:50 GMT [thread overview]
Message-ID: <tip-c8e5910edf8bbe2e5c6c35a4ef2a578cc7893b25@git.kernel.org> (raw)
In-Reply-To: <1302913676-14352-4-git-send-email-robert.richter@amd.com>
Commit-ID: c8e5910edf8bbe2e5c6c35a4ef2a578cc7893b25
Gitweb: http://git.kernel.org/tip/c8e5910edf8bbe2e5c6c35a4ef2a578cc7893b25
Author: Robert Richter <robert.richter@amd.com>
AuthorDate: Sat, 16 Apr 2011 02:27:55 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 19 Apr 2011 10:08:12 +0200
perf, x86: Use ALTERNATIVE() to check for X86_FEATURE_PERFCTR_CORE
Using ALTERNATIVE() when checking for X86_FEATURE_PERFCTR_CORE avoids
an extra pointer chase and data cache hit.
Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1302913676-14352-4-git-send-email-robert.richter@amd.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/cpu/perf_event.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index eed3673a..224a84f 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -31,6 +31,7 @@
#include <asm/nmi.h>
#include <asm/compat.h>
#include <asm/smp.h>
+#include <asm/alternative.h>
#if 0
#undef wrmsrl
@@ -363,12 +364,18 @@ again:
return new_raw_count;
}
-/* using X86_FEATURE_PERFCTR_CORE to later implement ALTERNATIVE() here */
static inline int x86_pmu_addr_offset(int index)
{
- if (boot_cpu_has(X86_FEATURE_PERFCTR_CORE))
- return index << 1;
- return index;
+ int offset;
+
+ /* offset = X86_FEATURE_PERFCTR_CORE ? index << 1 : index */
+ alternative_io(ASM_NOP2,
+ "shll $1, %%eax",
+ X86_FEATURE_PERFCTR_CORE,
+ "=a" (offset),
+ "a" (index));
+
+ return offset;
}
static inline unsigned int x86_pmu_config_addr(int index)
next prev parent reply other threads:[~2011-04-19 12:05 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-16 0:27 [PATCH 0/4] perf, x86: Fixes for v2.6.39 Robert Richter
2011-04-16 0:27 ` [PATCH 1/4] perf, x86: Fix pre-defined cache-misses event for AMD family 15h cpus Robert Richter
2011-04-19 12:03 ` [tip:perf/urgent] " tip-bot for Andre Przywara
2011-04-16 0:27 ` [PATCH 2/4] perf, x86: Fix AMD family 15h FPU event constraints Robert Richter
2011-04-19 12:04 ` [tip:perf/urgent] " tip-bot for Robert Richter
2011-04-16 0:27 ` [PATCH 3/4] perf, x86: Use ALTERNATIVE() to check for X86_FEATURE_PERFCTR_CORE Robert Richter
2011-04-18 20:00 ` Andi Kleen
2011-04-19 10:39 ` Robert Richter
2011-04-19 18:21 ` Andi Kleen
2011-04-19 12:04 ` tip-bot for Robert Richter [this message]
2011-04-16 0:27 ` [PATCH 4/4] perf, x86: Fix event scheduler to solve complex scheduling problems Robert Richter
2011-04-16 8:51 ` Peter Zijlstra
2011-04-16 9:43 ` Ingo Molnar
2011-04-16 10:08 ` Peter Zijlstra
2011-04-16 10:14 ` Ingo Molnar
2011-04-16 10:15 ` Peter Zijlstra
2011-04-16 14:26 ` Valdis.Kletnieks
2011-04-17 8:15 ` Robert Richter
2011-04-17 8:18 ` Ingo Molnar
2011-04-17 8:53 ` Peter Zijlstra
2011-04-17 11:23 ` Robert Richter
2011-04-18 8:17 ` Robert Richter
2011-04-16 15:52 ` Stephane Eranian
2011-04-17 8:44 ` Robert Richter
2011-04-17 9:05 ` Stephane Eranian
2011-04-19 10:26 ` [PATCH v2] perf, x86: Fix event scheduler for constraints with overlapping counters Robert Richter
2011-04-19 11:29 ` Ingo Molnar
2011-04-19 13:55 ` Robert Richter
2011-04-28 9:50 ` Robert Richter
2011-05-18 21:16 ` Peter Zijlstra
2011-05-18 21:20 ` Ingo Molnar
2011-05-18 21:36 ` Peter Zijlstra
2011-05-19 10:49 ` Robert Richter
2011-05-19 18:06 ` Ingo Molnar
2011-05-20 3:18 ` Robert Richter
2011-09-01 12:56 ` Peter Zijlstra
2011-09-01 14:12 ` Robert Richter
2011-09-01 16:37 ` Peter Zijlstra
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=tip-c8e5910edf8bbe2e5c6c35a4ef2a578cc7893b25@git.kernel.org \
--to=robert.richter@amd.com \
--cc=a.p.zijlstra@chello.nl \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).