diff options
author | Song Liu <song@kernel.org> | 2023-03-13 18:16:08 +0100 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2023-03-15 21:49:46 +0100 |
commit | baf1b12a67f5b24f395baca03e442ce27cab0c18 (patch) | |
tree | f9712ff14ca14f51daf9ec21bc3b534f55040fcc /kernel | |
parent | perf/core: Fix perf_output_begin parameter is incorrectly invoked in perf_eve... (diff) | |
download | linux-baf1b12a67f5b24f395baca03e442ce27cab0c18.tar.xz linux-baf1b12a67f5b24f395baca03e442ce27cab0c18.zip |
perf: fix perf_event_context->time
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")
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/r/20230313171608.298734-1-song@kernel.org
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/events/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index 296617edbda1..52b4aa0b3bd1 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -3872,7 +3872,7 @@ ctx_sched_in(struct perf_event_context *ctx, enum event_type_t event_type) if (likely(!ctx->nr_events)) return; - if (is_active ^ EVENT_TIME) { + if (!(is_active & EVENT_TIME)) { /* start ctx time */ __update_context_time(ctx, false); perf_cgroup_set_timestamp(cpuctx); |