mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
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 <[email protected]> Cc: David Ahern <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
ad4e3c0458
commit
e8968e6541
1 changed files with 4 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue