From: "tip-bot2 for Namhyung Kim" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Namhyung Kim <namhyung@kernel.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: perf/core] perf: Use sample_flags for addr
Date: Wed, 28 Sep 2022 06:57:22 -0000 [thread overview]
Message-ID: <166434824254.401.581163246945360838.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20220921220032.2858517-1-namhyung@kernel.org>
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 7b084630153152239d84990ac4540c2dd360186f
Gitweb: https://git.kernel.org/tip/7b084630153152239d84990ac4540c2dd360186f
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Wed, 21 Sep 2022 15:00:31 -07:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Tue, 27 Sep 2022 22:50:24 +02:00
perf: Use sample_flags for addr
Use the new sample_flags to indicate whether the addr field is filled by
the PMU driver. As most PMU drivers pass 0, it can set the flag only if
it has a non-zero value. And use 0 in perf_sample_output() if it's not
filled already.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220921220032.2858517-1-namhyung@kernel.org
---
arch/x86/events/intel/ds.c | 8 ++++++--
include/linux/perf_event.h | 8 ++++++--
kernel/events/core.c | 5 +++++
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index 4ba6ab6..d2e9ff1 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -1621,8 +1621,10 @@ static void setup_pebs_fixed_sample_data(struct perf_event *event,
if ((sample_type & PERF_SAMPLE_ADDR_TYPE) &&
- x86_pmu.intel_cap.pebs_format >= 1)
+ x86_pmu.intel_cap.pebs_format >= 1) {
data->addr = pebs->dla;
+ data->sample_flags |= PERF_SAMPLE_ADDR;
+ }
if (x86_pmu.intel_cap.pebs_format >= 2) {
/* Only set the TSX weight when no memory weight. */
@@ -1783,8 +1785,10 @@ static void setup_pebs_adaptive_sample_data(struct perf_event *event,
data->sample_flags |= PERF_SAMPLE_DATA_SRC;
}
- if (sample_type & PERF_SAMPLE_ADDR_TYPE)
+ if (sample_type & PERF_SAMPLE_ADDR_TYPE) {
data->addr = meminfo->address;
+ data->sample_flags |= PERF_SAMPLE_ADDR;
+ }
if (sample_type & PERF_SAMPLE_TRANSACTION) {
data->txn = intel_get_tsx_transaction(meminfo->tsx_tuning,
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 368bdc4..f4a1357 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1028,7 +1028,6 @@ struct perf_sample_data {
* minimize the cachelines touched.
*/
u64 sample_flags;
- u64 addr;
struct perf_raw_record *raw;
u64 period;
@@ -1040,6 +1039,7 @@ struct perf_sample_data {
union perf_sample_weight weight;
union perf_mem_data_src data_src;
u64 txn;
+ u64 addr;
u64 type;
u64 ip;
@@ -1079,9 +1079,13 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
{
/* remaining struct members initialized in perf_prepare_sample() */
data->sample_flags = 0;
- data->addr = addr;
data->raw = NULL;
data->period = period;
+
+ if (addr) {
+ data->addr = addr;
+ data->sample_flags |= PERF_SAMPLE_ADDR;
+ }
}
/*
diff --git a/kernel/events/core.c b/kernel/events/core.c
index c07e9a3..a91f74d 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7414,6 +7414,11 @@ void perf_prepare_sample(struct perf_event_header *header,
if (filtered_sample_type & PERF_SAMPLE_TRANSACTION)
data->txn = 0;
+ if (sample_type & (PERF_SAMPLE_ADDR | PERF_SAMPLE_PHYS_ADDR | PERF_SAMPLE_DATA_PAGE_SIZE)) {
+ if (filtered_sample_type & PERF_SAMPLE_ADDR)
+ data->addr = 0;
+ }
+
if (sample_type & PERF_SAMPLE_REGS_INTR) {
/* regs dump ABI info */
int size = sizeof(u64);
prev parent reply other threads:[~2022-09-28 6:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-21 22:00 [PATCH 1/2] perf: Use sample_flags for addr Namhyung Kim
2022-09-21 22:00 ` [PATCH 2/2] perf: Use sample_flags for raw_data Namhyung Kim
2022-09-28 6:57 ` [tip: perf/core] " tip-bot2 for Namhyung Kim
2022-10-06 16:00 ` [PATCH] " Sumanth Korikkar
2022-10-06 17:12 ` Namhyung Kim
2022-10-06 18:58 ` Jiri Olsa
2022-10-07 8:13 ` [PATCH] bpf: fix sample_flags for bpf_perf_event_output Sumanth Korikkar
2022-10-07 9:45 ` Jiri Olsa
2022-10-07 15:18 ` Peter Zijlstra
2022-10-19 4:57 ` Alexei Starovoitov
2022-10-21 1:36 ` Alexei Starovoitov
2022-10-23 1:16 ` bpf+perf is still broken. Was: " Alexei Starovoitov
2022-10-23 16:55 ` Linus Torvalds
2022-10-23 17:19 ` Linus Torvalds
2022-10-23 17:28 ` Alexei Starovoitov
2022-10-17 14:45 ` [tip: perf/urgent] bpf: Fix " tip-bot2 for Sumanth Korikkar
2022-10-17 19:27 ` [PATCH] bpf: fix " SeongJae Park
2022-10-17 22:52 ` Namhyung Kim
2022-10-17 23:35 ` SeongJae Park
2022-10-19 10:44 ` [tip: perf/core] perf: Use sample_flags for raw_data Athira Rajeev
2022-09-22 14:48 ` [PATCH 1/2] perf: Use sample_flags for addr Peter Zijlstra
2022-09-22 16:32 ` Namhyung Kim
2022-09-22 20:55 ` [PATCH] perf: Change the layout of perf_sample_data Namhyung Kim
2022-09-23 7:45 ` [PATCH 1/2] perf: Use sample_flags for addr Peter Zijlstra
2022-09-28 6:57 ` tip-bot2 for Namhyung Kim [this message]
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=166434824254.401.581163246945360838.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).