]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
perf: fix perf_event_context->time
authorSong Liu <song@kernel.org>
Mon, 13 Mar 2023 17:16:08 +0000 (10:16 -0700)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Wed, 17 May 2023 11:33:26 +0000 (13:33 +0200)
commitb271fdfedc29702d65ac9f41e34339889d972313
treeb2396b8bc3f3a739cf4ddbb1a1b8d1e0da9f05f7
parent5b1f6774ae617e580e083a915b8b81e03d21bb10
perf: fix perf_event_context->time

BugLink: https://bugs.launchpad.net/bugs/2016877
[ Upstream commit baf1b12a67f5b24f395baca03e442ce27cab0c18 ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
kernel/events/core.c