From: Peter Zijlstra <peterz@infradead.org>
To: Ian Rogers <irogers@google.com>
Cc: acme@kernel.org, adrian.hunter@intel.com,
alexander.shishkin@linux.intel.com, ast@kernel.org,
bpf@vger.kernel.org, james.clark@linaro.org, jolsa@kernel.org,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
mark.rutland@arm.com, mingo@redhat.com, namhyung@kernel.org,
song@kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v1] perf/core: Replace perf_event_header__init_id with full header init
Date: Thu, 1 Oct 2026 09:07:55 +0200 [thread overview]
Message-ID: <20261001070755.GQ88198@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260929222332.973435-1-irogers@google.com>
On Tue, Sep 29, 2026 at 03:23:32PM -0700, Ian Rogers wrote:
> Rather than splitting header initialization between callers and output
> callbacks and saving/restoring mutated header fields, replace
> perf_event_header__init_id() with
> perf_event_header__init_header_and_id(), which initializes header->type,
> header->misc, and header->size alongside the sample_id fields on each
> invocation.
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 33210aff3ee6..c1b2d0c9b2af 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -8119,13 +8119,18 @@ static void __perf_event_header__init_id(struct perf_sample_data *data,
> }
> }
>
> -void perf_event_header__init_id(struct perf_event_header *header,
> - struct perf_sample_data *data,
> - struct perf_event *event)
> +void perf_event_header__init_header_and_id(struct perf_event_header *header,
> + struct perf_sample_data *data,
> + u32 type, u16 misc, u16 size,
> + struct perf_event *event)
> {
> + header->type = type;
> + header->misc = misc;
> if (event->attr.sample_id_all) {
> - header->size += event->id_header_size;
> + header->size = size + event->id_header_size;
> __perf_event_header__init_id(data, event, event->attr.sample_type);
> + } else {
> + header->size = size;
> }
> }
I've renamed the thing to perf_event_header__init(). Also, I've done:
header->size = size;
and restored the:
header->size += event->id_header_size;
and lost the else :-)
But yes, this is better. Thanks!
next prev parent reply other threads:[~2026-10-01 7:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 1:42 [PATCH v1] perf/core: Restore header fields in sideband output callbacks Ian Rogers
2026-09-29 1:48 ` sashiko-bot
2026-09-29 12:04 ` Peter Zijlstra
2026-09-29 18:21 ` Ian Rogers
2026-09-29 22:23 ` [PATCH v1] perf/core: Replace perf_event_header__init_id with full header init Ian Rogers
2026-09-29 22:35 ` sashiko-bot
2026-10-01 7:07 ` Peter Zijlstra [this message]
2026-10-01 16:45 ` Ian Rogers
2026-10-09 23:30 ` patchwork-bot+netdevbpf
2026-09-29 23:37 ` [PATCH v1] perf/core: Restore header fields in sideband output callbacks bot+bpf-ci
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=20261001070755.GQ88198@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--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=song@kernel.org \
--cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.