linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@linutronix.de>
Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Clark Williams <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Konstantin Kharlamov <Hi-Angel@yandex.ru>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Quentin Monnet <quentin.monnet@netronome.com>,
	Kim Phillips <kim.phillips@amd.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 4/8] perf evsel: Do not rely on errno values for precise_ip fallback
Date: Mon,  8 Jul 2019 12:42:03 -0300	[thread overview]
Message-ID: <20190708154207.11403-5-acme@kernel.org> (raw)
In-Reply-To: <20190708154207.11403-1-acme@kernel.org>

From: Jiri Olsa <jolsa@kernel.org>

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.

Reported-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin.monnet@netronome.com>
Cc: Kim Phillips <kim.phillips@amd.com>
Link: http://lkml.kernel.org/r/20190703080949.10356-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evsel.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 4a5947625c5c..69beb9f80f07 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -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;
 
 		/*
-- 
2.20.1

  parent reply	other threads:[~2019-07-08 15:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08 15:41 [GIT PULL 0/8] perf/urgent fixes Arnaldo Carvalho de Melo
2019-07-08 15:42 ` [PATCH 1/8] tools arch kvm: Sync kvm headers with the kernel sources Arnaldo Carvalho de Melo
2019-07-08 15:42 ` [PATCH 2/8] perf header: Assign proper ff->ph in perf_event__synthesize_features() Arnaldo Carvalho de Melo
2019-07-08 15:42 ` [PATCH 3/8] perf thread: Allow references to thread objects after machine__exit() Arnaldo Carvalho de Melo
2019-07-08 15:42 ` Arnaldo Carvalho de Melo [this message]
2019-07-13 12:42   ` [PATCH 4/8] perf evsel: Do not rely on errno values for precise_ip fallback Konstantin Kharlamov
2019-07-08 15:42 ` [PATCH 5/8] perf tests: Fix record+probe_libc_inet_pton.sh for powerpc64 Arnaldo Carvalho de Melo
2019-07-08 15:42 ` [PATCH 6/8] perf annotate TUI browser: Do not use member from variable within its own initialization Arnaldo Carvalho de Melo
2019-07-08 15:42 ` [PATCH 7/8] perf python: Remove -fstack-protector-strong if clang doesn't have it Arnaldo Carvalho de Melo
2019-07-08 15:42 ` [PATCH 8/8] perf jvmti: Address gcc string overflow warning for strncpy() Arnaldo Carvalho de Melo
2019-07-08 21:50 ` [GIT PULL 0/8] perf/urgent fixes Arnaldo Carvalho de Melo
2019-07-08 21:54   ` Arnaldo Carvalho de Melo
2019-07-09 11:23     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190708154207.11403-5-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=Hi-Angel@yandex.ru \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kim.phillips@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=quentin.monnet@netronome.com \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).