From: Ingo Molnar Date: Mon, 5 Sep 2016 10:09:59 +0000 (+0200) Subject: Merge branch 'perf/urgent' into perf/core, to pick up fixed and resolve conflicts X-Git-Tag: v4.14-rc1~2411^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2cc538412a1ca103923ec400a339a5b3833e0280;p=platform%2Fkernel%2Flinux-rpi.git Merge branch 'perf/urgent' into perf/core, to pick up fixed and resolve conflicts Conflicts: kernel/events/core.c Signed-off-by: Ingo Molnar --- 2cc538412a1ca103923ec400a339a5b3833e0280 diff --cc kernel/events/core.c index 3f07e6c,07ac859..dff00c7 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@@ -3573,15 -3549,18 +3573,23 @@@ static int perf_event_read(struct perf_ .group = group, .ret = 0, }; + + local_cpu = get_cpu(); + cpu_to_read = find_cpu_to_read(event, local_cpu); + put_cpu(); + - ret = smp_call_function_single(cpu_to_read, __perf_event_read, &data, 1); - /* The event must have been read from an online CPU: */ - WARN_ON_ONCE(ret); - ret = ret ? : data.ret; + /* + * Purposely ignore the smp_call_function_single() return + * value. + * + * If event->oncpu isn't a valid CPU it means the event got + * scheduled out and that will have updated the event count. + * + * Therefore, either way, we'll have an up-to-date event count + * after this. + */ - (void)smp_call_function_single(event->oncpu, __perf_event_read, &data, 1); ++ (void)smp_call_function_single(cpu_to_read, __perf_event_read, &data, 1); + ret = data.ret; } else if (event->state == PERF_EVENT_STATE_INACTIVE) { struct perf_event_context *ctx = event->ctx; unsigned long flags;