Patch "perf: fix perf_event_context->time" has been added to the 6.1-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 6.1-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-6.1 subdirectory.

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



commit c953a2c5ed43f37c2de6b1a6ff9b8f56ff2d3b8d
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 6c4e78cd7a8b5..2aa286b4151b3 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3830,7 +3830,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(cpuctx);



[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