Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1440075 > unrolled thread
| Started by | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| First post | 2016-07-10 13:10 +0200 |
| Last post | 2016-07-13 09:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 04/10] perf python: Fix pyrf_evlist__read_on_cpu event consuming Jiri Olsa <jolsa@kernel.org> - 2016-07-10 13:10 +0200
[tip:perf/core] perf python: Fix pyrf_evlist__read_on_cpu event consuming tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-07-13 09:30 +0200
| From | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| Date | 2016-07-10 13:10 +0200 |
| Subject | [PATCH 04/10] perf python: Fix pyrf_evlist__read_on_cpu event consuming |
| Message-ID | <rTkMy-8fe-31@gated-at.bofh.it> |
We can't consume the event before parsing it. Under heavy load we could get caught by kernel writer overwriting the event we're trying to parse. Link: http://lkml.kernel.org/n/tip-8dbalvrufeisa4cioyd9k65i@git.kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org> --- tools/perf/util/python.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index d0c1267741ee..c68ef0319114 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -865,12 +865,14 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, PyObject *pyevent = pyrf_event__new(event); struct pyrf_event *pevent = (struct pyrf_event *)pyevent; - perf_evlist__mmap_consume(evlist, cpu); - if (pyevent == NULL) return PyErr_NoMemory(); err = perf_evlist__parse_sample(evlist, event, &pevent->sample); + + /* Consume the even only after we parsed it out. */ + perf_evlist__mmap_consume(evlist, cpu); + if (err) return PyErr_Format(PyExc_OSError, "perf: can't parse sample, err=%d", err); -- 2.4.11
[toc] | [next] | [standalone]
| From | tip-bot for Jiri Olsa <tipbot@zytor.com> |
|---|---|
| Date | 2016-07-13 09:30 +0200 |
| Subject | [tip:perf/core] perf python: Fix pyrf_evlist__read_on_cpu event consuming |
| Message-ID | <rUmMk-8ia-57@gated-at.bofh.it> |
| In reply to | #1440075 |
Commit-ID: e8968e654191390a1300f0847250353a1c9da30d Gitweb: http://git.kernel.org/tip/e8968e654191390a1300f0847250353a1c9da30d Author: Jiri Olsa <jolsa@kernel.org> AuthorDate: Sun, 10 Jul 2016 13:07:56 +0200 Committer: Arnaldo Carvalho de Melo <acme@redhat.com> CommitDate: Tue, 12 Jul 2016 16:16:44 -0300 perf python: Fix pyrf_evlist__read_on_cpu event consuming We can't consume the event before parsing it. Under heavy load we could get caught by kernel writer overwriting the event we're trying to parse. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1468148882-10362-5-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/util/python.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index d0c1267..c68ef03 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -865,12 +865,14 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, PyObject *pyevent = pyrf_event__new(event); struct pyrf_event *pevent = (struct pyrf_event *)pyevent; - perf_evlist__mmap_consume(evlist, cpu); - if (pyevent == NULL) return PyErr_NoMemory(); err = perf_evlist__parse_sample(evlist, event, &pevent->sample); + + /* Consume the even only after we parsed it out. */ + perf_evlist__mmap_consume(evlist, cpu); + if (err) return PyErr_Format(PyExc_OSError, "perf: can't parse sample, err=%d", err);
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web