From: Andi Kleen <andi@firstfloor.org>
To: acma@infradead.org
Cc: peterz@infradead.org, mingo@kernel.org,
linux-kernel@vger.kernel.org, jolsa@redhat.com,
Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 2/6] perf, x86: Add Haswell specific transaction flag reporting v5
Date: Mon, 30 Sep 2013 14:58:59 -0700 [thread overview]
Message-ID: <1380578343-31301-3-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1380578343-31301-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
In the PEBS handler report the transaction flags using the new
generic transaction flags facility. Most of them come from
the "tsx_tuning" field in PEBSv2, but the abort code is derived
from the RAX register reported in the PEBS record.
v2: Fix interaction with precise-loads
v3: Mask out reserved bits. More comments.
v4: Adjust white space
v5: Refactor PEBS handler code to collapse one if
and move parts into new inline.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
arch/x86/kernel/cpu/perf_event_intel_ds.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 54ff6ce..81111df 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -206,6 +206,8 @@ union hsw_tsx_tuning {
u64 value;
};
+#define PEBS_HSW_TSX_FLAGS 0xff00000000ULL
+
void init_debug_store_on_cpu(int cpu)
{
struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
@@ -806,6 +808,16 @@ static inline u64 intel_hsw_weight(struct pebs_record_hsw *pebs)
return 0;
}
+static inline u64 intel_hsw_transaction(struct pebs_record_hsw *pebs)
+{
+ u64 txn = (pebs->tsx_tuning & PEBS_HSW_TSX_FLAGS) >> 32;
+
+ /* For RTM XABORTs also log the abort code from AX */
+ if ((txn & PERF_TXN_TRANSACTION) && (pebs->ax & 1))
+ txn |= ((pebs->ax >> 24) & 0xff) << PERF_TXN_ABORT_SHIFT;
+ return txn;
+}
+
static void __intel_pmu_pebs_event(struct perf_event *event,
struct pt_regs *iregs, void *__pebs)
{
@@ -884,10 +896,14 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
x86_pmu.intel_cap.pebs_format >= 1)
data.addr = pebs->dla;
- /* Only set the TSX weight when no memory weight was requested. */
- if ((event->attr.sample_type & PERF_SAMPLE_WEIGHT) && !fll &&
- (x86_pmu.intel_cap.pebs_format >= 2))
- data.weight = intel_hsw_weight(pebs);
+ if (x86_pmu.intel_cap.pebs_format >= 2) {
+ /* Only set the TSX weight when no memory weight. */
+ if ((event->attr.sample_type & PERF_SAMPLE_WEIGHT) && !fll)
+ data.weight = intel_hsw_weight(pebs);
+
+ if (event->attr.sample_type & PERF_SAMPLE_TRANSACTION)
+ data.txn = intel_hsw_transaction(pebs);
+ }
if (has_branch_stack(event))
data.br_stack = &cpuc->lbr_stack;
--
1.8.3.1
next prev parent reply other threads:[~2013-09-30 21:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-30 21:58 perf, x86: Add last TSX PMU code for Haswell v3 Andi Kleen
2013-09-30 21:58 ` [PATCH 1/6] perf, core: Add generic transaction flags v5 Andi Kleen
2013-09-30 21:58 ` Andi Kleen [this message]
2013-09-30 21:59 ` [PATCH 3/6] perf, tools: Support sorting by in_tx, abort branch flags v3 Andi Kleen
2013-09-30 21:59 ` [PATCH 4/6] perf, tools: Add abort_tx,no_tx,in_tx branch filter options to perf record -j v3 Andi Kleen
2013-09-30 21:59 ` [PATCH 5/6] perf, tools: Add support for record transaction flags v5 Andi Kleen
2013-09-30 21:59 ` [PATCH 6/6] perf, x86: Suppress duplicated abort LBR records v2 Andi Kleen
2013-10-01 7:22 ` perf, x86: Add last TSX PMU code for Haswell v3 Peter Zijlstra
2013-10-01 7:31 ` Andi Kleen
2013-10-01 8:04 ` Peter Zijlstra
-- strict thread matches above, loose matches on Subject: below --
2013-09-20 14:40 perf, x86: Add last TSX PMU code for Haswell v2 Andi Kleen
2013-09-20 14:40 ` [PATCH 2/6] perf, x86: Add Haswell specific transaction flag reporting v5 Andi Kleen
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=1380578343-31301-3-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=acma@infradead.org \
--cc=ak@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.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