perf tools: Do not rely on errno values for precise_ip fallback
Jiri Olsa
reviewerPATCH 1/1 perf tools: Do not rely on errno values for precise_ip fallback
Konstantin reported problem with default perf record command, which fails on some AMD servers, because of the default maximum precise config.
The current fallback mechanism counts on getting ENOTSUP errno for precise_ip fails, but that's not the case on some AMD servers.
We can fix this by removing the errno check completely, because the precise_ip fallback is separated. We can just try (if requested by evsel->precise_max) all possible precise_ip, and if one succeeds we win, if not, we continue with standard fallback.
--- tools/perf/util/evsel.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
tools/perf/util/evsel.c +2 -8
@@ -1800,14 +1800,8 @@ static int perf_event_open(struct perf_evsel *evsel,if (fd >=0 )break ; -/* -* Do quick precise_ip fallback if: -* - there is precise_ip set in perf_event_attr -* - maximum precise is requested -* - sys_perf_event_open failed with ENOTSUP error, -* which is associated with wrong precise_ip -*/ -if (!precise_ip || !evsel->precise_max || (errno !=ENOTSUP )) +/* Do not try less precise if not requested. */ +if (!evsel->precise_max)break ;/*
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
AppliedEm Wed, Jul 03, 2019 at 10:09:49AM +0200, Jiri Olsa escreveu:
Quoted 11 lines
Konstantin reported problem with default perf record command, which fails on some AMD servers, because of the default maximum precise config.
The current fallback mechanism counts on getting ENOTSUP errno for
precise_ipfails, but that's not the case on some AMD servers.We can fix this by removing the errno check completely, because the
precise_ipfallback is separated. We can just try (if requested byevsel->precise_max) all possibleprecise_ip, and if one succeeds we win, if not, we continue with standard fallback.
Thanks, applied.
Simple test shows that behaviour continues the same on x86_64.
- Arnaldo
Quoted 32 lines
Reported-by Konstantin Kharlamov <[email protected]>Cc Quentin Monnet <[email protected]>Cc Kim Phillips <[email protected]>Cc Andi Kleen <[email protected]>Signed-off-by Jiri Olsa <[email protected]>--- tools/perf/util/evsel.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)tools/perf/util/evsel.c +2
-8@@ -1800,14 +1800,8 @@ static int perf_event_open(struct perf_evsel *evsel,if (fd >=0 )break ; -/* -* Do quick precise_ip fallback if: -* - there is precise_ip set in perf_event_attr -* - maximum precise is requested -* - sys_perf_event_open failed with ENOTSUP error, -* which is associated with wrong precise_ip -*/ -if (!precise_ip || !evsel->precise_max || (errno !=ENOTSUP )) +/* Do not try less precise if not requested. */ +if (!evsel->precise_max)break ;/* Signature · 1 line
2.21.0
Signature · 1 line
- Arnaldo
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf evsel: Do not rely on errno values for precise_ip fallback
In reply to Jiri Olsaperf evsel: Do not rely on errno values for precise_ip fallback
Commit-ID: cd136189370cc8a5aec0ea4b4ec517e5ee38d8a0 Gitweb: https://git.kernel.org/tip/cd136189370cc8a5aec0ea4b4ec517e5ee38d8a0 Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 3 Jul 2019 10:09:49 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Sat, 6 Jul 2019 14:30:30 -0300
perf evsel: Do not rely on errno values for precise_ip fallback
Konstantin reported problem with default perf record command, which fails on some AMD servers, because of the default maximum precise config.
The current fallback mechanism counts on getting ENOTSUP errno for precise_ip fails, but that's not the case on some AMD servers.
We can fix this by removing the errno check completely, because the precise_ip fallback is separated. We can just try (if requested by evsel->precise_max) all possible precise_ip, and if one succeeds we win, if not, we continue with standard fallback.
--- tools/perf/util/evsel.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
tools/perf/util/evsel.c +2 -8
@@ -1785,14 +1785,8 @@ static int perf_event_open(struct perf_evsel *evsel,if (fd >=0 )break ; -/* -* Do quick precise_ip fallback if: -* - there is precise_ip set in perf_event_attr -* - maximum precise is requested -* - sys_perf_event_open failed with ENOTSUP error, -* which is associated with wrong precise_ip -*/ -if (!precise_ip || !evsel->precise_max || (errno !=ENOTSUP )) +/* Do not try less precise if not requested. */ +if (!evsel->precise_max)break ;/*