Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1472272
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [tip:perf/core] perf/core: Check return value of the perf_event_read() IPI |
| Date | 2016-08-30 09:30 +0200 |
| Message-ID | <sbLEB-1Kt-7@gated-at.bofh.it> (permalink) |
| References | (5 earlier) <s8UO5-56V-1@gated-at.bofh.it> <sbsiB-6dl-21@gated-at.bofh.it> <sbuu6-7IC-25@gated-at.bofh.it> <sbzWN-2uN-3@gated-at.bofh.it> <sbL1U-1ib-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Aug 30, 2016 at 08:47:24AM +0200, Peter Zijlstra wrote:
> If oncpu is not valid, the sched_out that made it invalid will have
> updated the event count and we're good.
>
> All I'll leave is an explicit comment that we've ignored the
> smp_call_function_single() return value on purpose.
Something like so..
---
kernel/events/core.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 3f07e6cfc1b6..a35cbc382b2c 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3576,12 +3576,21 @@ static int perf_event_read(struct perf_event *event, bool group)
local_cpu = get_cpu();
cpu_to_read = find_cpu_to_read(event, local_cpu);
+
+ /*
+ * 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(cpu_to_read, __perf_event_read, &data, 1);
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;
+ ret = data.ret;
} else if (event->state == PERF_EVENT_STATE_INACTIVE) {
struct perf_event_context *ctx = event->ctx;
unsigned long flags;
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [tip:perf/core] perf/core: Check return value of the perf_event_read() IPI Peter Zijlstra <peterz@infradead.org> - 2016-08-29 12:50 +0200
Re: [tip:perf/core] perf/core: Check return value of the perf_event_read() IPI Peter Zijlstra <peterz@infradead.org> - 2016-08-29 15:10 +0200
Re: [tip:perf/core] perf/core: Check return value of the perf_event_read() IPI Vince Weaver <vincent.weaver@maine.edu> - 2016-08-29 15:20 +0200
Re: [tip:perf/core] perf/core: Check return value of the perf_event_read() IPI Jiri Olsa <jolsa@redhat.com> - 2016-08-29 21:00 +0200
Re: [tip:perf/core] perf/core: Check return value of the perf_event_read() IPI Peter Zijlstra <peterz@infradead.org> - 2016-08-30 08:50 +0200
Re: [tip:perf/core] perf/core: Check return value of the perf_event_read() IPI Peter Zijlstra <peterz@infradead.org> - 2016-08-30 09:30 +0200
Re: [tip:perf/core] perf/core: Check return value of the perf_event_read() IPI Jiri Olsa <jolsa@redhat.com> - 2016-08-30 11:50 +0200
Re: [tip:perf/core] perf/core: Check return value of the perf_event_read() IPI Stephane Eranian <eranian@google.com> - 2016-08-30 18:30 +0200
Re: [tip:perf/core] perf/core: Check return value of the perf_event_read() IPI Peter Zijlstra <peterz@infradead.org> - 2016-09-02 10:40 +0200
csiph-web