From: Peter Zijlstra <peterz@infradead.org>
To: Yang Jihong <yangjihong1@huawei.com>
Cc: mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
namhyung@kernel.org, irogers@google.com, adrian.hunter@intel.com,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf/core: Fix perf_sample_data not properly initialized for different swevents in perf_tp_event()
Date: Tue, 18 Apr 2023 12:25:45 +0200 [thread overview]
Message-ID: <20230418102545.GX4253@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <15805714-27c0-b8ff-143a-8f768704a673@huawei.com>
On Tue, Apr 18, 2023 at 09:35:23AM +0800, Yang Jihong wrote:
> > I'm thinking perhaps those flags that update ->dyn_size are the problem?
> > At the same time, Should you not also then clear dyn_size?
> Yes, according to the code, dyn_size should also be cleared.
> Maybe we need to change it to the following, which would be more
> appropriate?
>
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -10144,14 +10144,14 @@ void perf_tp_event(u16 event_type, u64 count, void
> *record, int entry_size,
> },
> };
>
> - perf_sample_data_init(&data, 0, 0);
> - perf_sample_save_raw_data(&data, &raw);
> -
> perf_trace_buf_update(record, event_type);
>
> hlist_for_each_entry_rcu(event, head, hlist_entry) {
> - if (perf_tp_event_match(event, &data, regs))
> + if (perf_tp_event_match(event, &data, regs)) {
> + perf_sample_data_init(&data, 0, 0);
> + perf_sample_save_raw_data(&data, &raw);
> perf_swevent_event(event, count, &data, regs);
> + }
> }
That is certainly the safe option. I just went through the list and
while there's certainly a number of options we'll recompute for naught,
most of them are indeed either dyn_size or event specific :/
So yeah, please send the above as v2.
next prev parent reply other threads:[~2023-04-18 10:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 9:52 [PATCH] perf/core: Fix perf_sample_data not properly initialized for different swevents in perf_tp_event() Yang Jihong
2023-04-17 11:45 ` Peter Zijlstra
2023-04-18 1:35 ` Yang Jihong
2023-04-18 10:25 ` Peter Zijlstra [this message]
2023-04-19 1:47 ` Yang Jihong
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=20230418102545.GX4253@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=yangjihong1@huawei.com \
/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