Re: [PATCH v2] perf: fix perf_event_context->time
From: Peter Zijlstra
Date: Tue Mar 14 2023 - 15:58:47 EST
On Mon, Mar 13, 2023 at 10:16:08AM -0700, Song Liu wrote:
> Time readers rely on perf_event_context->[time|timestamp|timeoffset] to get
> accurate time_enabled and time_running for an event. The difference between
> ctx->timestamp and ctx->time is the among of time when the context is not
> enabled. __update_context_time(ctx, false) is used to increase timestamp,
> but not time. Therefore, it should only be called in ctx_sched_in() when
> EVENT_TIME was not enabled.
>
> Fixes: 09f5e7dc7ad7 ("perf: Fix perf_event_read_local() time")
> Cc: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
> Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> Signed-off-by: Song Liu <song@xxxxxxxxxx>
Looks like I'm wearing another brown paper bag tonight..
Thanks!