Skip to content

Commit 5876314

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
perf/core: Remove WARN from perf_event_read()
This effectively reverts commit: 71e7bc2 ("perf/core: Check return value of the perf_event_read() IPI") ... and puts in a comment explaining why we ignore the return value. Reported-by: Vegard Nossum <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: David Carrillo-Cisneros <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Fixes: 71e7bc2 ("perf/core: Check return value of the perf_event_read() IPI") Signed-off-by: Ingo Molnar <[email protected]>
1 parent c693593 commit 5876314

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

kernel/events/core.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3549,10 +3549,18 @@ static int perf_event_read(struct perf_event *event, bool group)
35493549
.group = group,
35503550
.ret = 0,
35513551
};
3552-
ret = smp_call_function_single(event->oncpu, __perf_event_read, &data, 1);
3553-
/* The event must have been read from an online CPU: */
3554-
WARN_ON_ONCE(ret);
3555-
ret = ret ? : data.ret;
3552+
/*
3553+
* Purposely ignore the smp_call_function_single() return
3554+
* value.
3555+
*
3556+
* If event->oncpu isn't a valid CPU it means the event got
3557+
* scheduled out and that will have updated the event count.
3558+
*
3559+
* Therefore, either way, we'll have an up-to-date event count
3560+
* after this.
3561+
*/
3562+
(void)smp_call_function_single(event->oncpu, __perf_event_read, &data, 1);
3563+
ret = data.ret;
35563564
} else if (event->state == PERF_EVENT_STATE_INACTIVE) {
35573565
struct perf_event_context *ctx = event->ctx;
35583566
unsigned long flags;

0 commit comments

Comments
 (0)