Patch "perf: fix perf_event_context->time" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf: fix perf_event_context->time

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-fix-perf_event_context-time.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 259bc92ebe1e3de34e394106f8b8fb150bfc9fae
Author: Song Liu <song@xxxxxxxxxx>
Date:   Mon Mar 13 10:16:08 2023 -0700

    perf: fix perf_event_context->time
    
    [ 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@xxxxxxxxxx>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
    Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
    Link: https://lkml.kernel.org/r/20230313171608.298734-1-song@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/events/core.c b/kernel/events/core.c
index eb8660ed1abba..e2e1371fbb9d3 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3817,7 +3817,7 @@ ctx_sched_in(struct perf_event_context *ctx,
 	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(task, ctx);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux