Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1230323 > unrolled thread
| Started by | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| First post | 2015-09-22 17:30 +0200 |
| Last post | 2015-09-23 09:50 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[GIT PULL 0/2] perf/urgent fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-22 17:30 +0200
[PATCH 1/2] perf record: Avoid infinite loop at buildid processing with no samples Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-22 17:30 +0200
Re: [GIT PULL 0/2] perf/urgent fixes Ingo Molnar <mingo@kernel.org> - 2015-09-23 09:50 +0200
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-09-22 17:30 +0200 |
| Subject | [GIT PULL 0/2] perf/urgent fixes |
| Message-ID | <qbxG1-P2-7@gated-at.bofh.it> |
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit f73e22ab450140830005581c2c7ec389791a1b8d:
perf: Fix races in computing the header sizes (2015-09-18 09:20:26 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo
for you to fetch changes up to c2e4b24ff848bb180f9b9cd873a38327cd219ad2:
tools lib traceevent: Fix string handling in heterogeneous arch environments (2015-09-22 11:57:04 -0300)
----------------------------------------------------------------
perf/urgent fixes:
User visible:
- Fix libtraceevent string handling in heterogeneous arch environments (Kapileshwar Singh)
- Avoid infinite loop at buildid processing with no samples in 'perf record' (Mark Rutland)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Kapileshwar Singh (1):
tools lib traceevent: Fix string handling in heterogeneous arch environments
Mark Rutland (1):
perf record: Avoid infinite loop at buildid processing with no samples
tools/lib/traceevent/event-parse.c | 23 ++++++++++++++++++++---
tools/perf/util/session.c | 5 ++++-
2 files changed, 24 insertions(+), 4 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-09-22 17:30 +0200 |
| Subject | [PATCH 1/2] perf record: Avoid infinite loop at buildid processing with no samples |
| Message-ID | <qbxG3-P2-49@gated-at.bofh.it> |
| In reply to | #1230323 |
From: Mark Rutland <mark.rutland@arm.com> If a session contains no events, we can get stuck in an infinite loop in __perf_session__process_events, with a non-zero file_size and data_offset, but a zero data_size. In this case, we can mmap the entirety of the file (consisting of the file and attribute headers), and fetch_mmaped_event will correctly refuse to read any (unmapped and non-existent) event headers. This causes __perf_session__process_events to unmap the file and retry with the exact same parameters, getting stuck in an infinite loop. This has been observed to result in an exit-time hang when counting rare/unschedulable events with perf record, and can be triggered artificially with the script below: ---- #!/bin/sh printf "REPRO: launching perf\n"; ./perf record -e software/config=9/ sleep 1 & PERF_PID=$!; sleep 0.002; kill -2 $PERF_PID; printf "REPRO: waiting for perf (%d) to exit...\n" "$PERF_PID"; wait $PERF_PID; printf "REPRO: perf exited\n"; ---- To avoid this, have __perf_session__process_events bail out early when the file has no data (i.e. it has no events). Commiter note: I only managed to reproduce this when setting /proc/sys/kernel/kptr_restrict to '1' and changing the code to purposefully not process any samples and no synthesized samples, i.e. kptr_restrict prevents 'record' from synthesizing the kernel mmaps for vmlinux + modules and since it is a workload started from perf, we don't synthesize mmap/comm records for existing threads. Adrian Hunter managed to reproduce it in his environment tho. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Arnaldo Carvalho de Melo <acme@kernel.org> Tested-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1442423929-12253-1-git-send-email-mark.rutland@arm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/util/session.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 8a4537ee9bc3..fc3f7c922f99 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1580,7 +1580,10 @@ static int __perf_session__process_events(struct perf_session *session, file_offset = page_offset; head = data_offset - page_offset; - if (data_size && (data_offset + data_size < file_size)) + if (data_size == 0) + goto out; + + if (data_offset + data_size < file_size) file_size = data_offset + data_size; ui_progress__init(&prog, file_size, "Processing events..."); -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-09-23 09:50 +0200 |
| Message-ID | <qbMYq-686-19@gated-at.bofh.it> |
| In reply to | #1230323 |
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > Hi Ingo, > > Please consider pulling, > > - Arnaldo > > The following changes since commit f73e22ab450140830005581c2c7ec389791a1b8d: > > perf: Fix races in computing the header sizes (2015-09-18 09:20:26 +0200) > > are available in the git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo > > for you to fetch changes up to c2e4b24ff848bb180f9b9cd873a38327cd219ad2: > > tools lib traceevent: Fix string handling in heterogeneous arch environments (2015-09-22 11:57:04 -0300) > > ---------------------------------------------------------------- > perf/urgent fixes: > > User visible: > > - Fix libtraceevent string handling in heterogeneous arch environments (Kapileshwar Singh) > > - Avoid infinite loop at buildid processing with no samples in 'perf record' (Mark Rutland) > > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> > > ---------------------------------------------------------------- > Kapileshwar Singh (1): > tools lib traceevent: Fix string handling in heterogeneous arch environments > > Mark Rutland (1): > perf record: Avoid infinite loop at buildid processing with no samples > > tools/lib/traceevent/event-parse.c | 23 ++++++++++++++++++++--- > tools/perf/util/session.c | 5 ++++- > 2 files changed, 24 insertions(+), 4 deletions(-) Pulled, thanks Arnaldo! Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web