linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Arnaldo Carvalho de Melo <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: adrian.hunter@intel.com, namhyung@kernel.org, jolsa@redhat.com,
	alexander.shishkin@linux.intel.com, yhs@fb.com, acme@redhat.com,
	mingo@kernel.org, mathieu.poirier@linaro.org,
	suzuki.poulose@arm.com, songliubraving@fb.com,
	linux-kernel@vger.kernel.org, tglx@linutronix.de, kafai@fb.com,
	daniel@iogearbox.net, leo.yan@linaro.org, mike.leach@linaro.org,
	hpa@zytor.com, ast@kernel.org
Subject: [tip:perf/core] perf trace: Skip unknown syscalls when expanding strace like syscall groups
Date: Mon, 17 Jun 2019 12:53:36 -0700	[thread overview]
Message-ID: <tip-04c41bcb862bbec1fb225243ecf07a3219593f81@git.kernel.org> (raw)
In-Reply-To: <20190610184754.GU21245@kernel.org>

Commit-ID:  04c41bcb862bbec1fb225243ecf07a3219593f81
Gitweb:     https://git.kernel.org/tip/04c41bcb862bbec1fb225243ecf07a3219593f81
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 10 Jun 2019 15:37:45 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 10 Jun 2019 17:50:04 -0300

perf trace: Skip unknown syscalls when expanding strace like syscall groups

We have $INSTALL_DIR/share/perf-core/strace/groups/string files with
syscalls that should be selected when 'string' is used, meaning, in this
case, syscalls that receive as one of its arguments a string, like a
pathname.

But those were first selected and tested on x86_64, and end up failing
in architectures where some of those syscalls are not available, like
the 'access' syscall on arm64, which makes using 'perf trace -e string'
in such archs to fail.

Since this the routine doing the validation is used only when reading
such files, do not fail when some syscall is not found in the
syscalltbl, instead just use pr_debug() to register that in case people
are suspicious of problems.

Now using 'perf trace -e string' should work on arm64, selecting only
the syscalls that have a string and are available on that architecture.

Reported-by: Leo Yan <leo.yan@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Yonghong Song <yhs@fb.com>
Link: https://lkml.kernel.org/r/20190610184754.GU21245@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-trace.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 1a2a605cf068..eb70a4b71755 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1529,6 +1529,7 @@ static int trace__read_syscall_info(struct trace *trace, int id)
 static int trace__validate_ev_qualifier(struct trace *trace)
 {
 	int err = 0, i;
+	bool printed_invalid_prefix = false;
 	size_t nr_allocated;
 	struct str_node *pos;
 
@@ -1555,14 +1556,15 @@ static int trace__validate_ev_qualifier(struct trace *trace)
 			if (id >= 0)
 				goto matches;
 
-			if (err == 0) {
-				fputs("Error:\tInvalid syscall ", trace->output);
-				err = -EINVAL;
+			if (!printed_invalid_prefix) {
+				pr_debug("Skipping unknown syscalls: ");
+				printed_invalid_prefix = true;
 			} else {
-				fputs(", ", trace->output);
+				pr_debug(", ");
 			}
 
-			fputs(sc, trace->output);
+			pr_debug("%s", sc);
+			continue;
 		}
 matches:
 		trace->ev_qualifier_ids.entries[i++] = id;
@@ -1591,15 +1593,14 @@ matches:
 		}
 	}
 
-	if (err < 0) {
-		fputs("\nHint:\ttry 'perf list syscalls:sys_enter_*'"
-		      "\nHint:\tand: 'man syscalls'\n", trace->output);
-out_free:
-		zfree(&trace->ev_qualifier_ids.entries);
-		trace->ev_qualifier_ids.nr = 0;
-	}
 out:
+	if (printed_invalid_prefix)
+		pr_debug("\n");
 	return err;
+out_free:
+	zfree(&trace->ev_qualifier_ids.entries);
+	trace->ev_qualifier_ids.nr = 0;
+	goto out;
 }
 
 /*

  parent reply	other threads:[~2019-06-17 19:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06  9:48 [PATCH v2 0/4] perf augmented_raw_syscalls: Support for arm64 Leo Yan
2019-06-06  9:48 ` [PATCH v2 1/4] perf trace: Exit when build eBPF program failure Leo Yan
2019-06-06 13:30   ` Arnaldo Carvalho de Melo
2019-06-06 13:34     ` Arnaldo Carvalho de Melo
2019-06-10  7:38       ` Leo Yan
2019-06-06 13:56     ` Leo Yan
2019-06-06  9:48 ` [PATCH v2 2/4] perf augmented_raw_syscalls: Remove duplicate macros Leo Yan
2019-06-06  9:48 ` [PATCH v2 3/4] perf augmented_raw_syscalls: Support arm64 raw syscalls Leo Yan
2019-06-06 13:38   ` Arnaldo Carvalho de Melo
2019-06-06 13:46     ` Arnaldo Carvalho de Melo
2019-06-06 14:05       ` Arnaldo Carvalho de Melo
2019-06-06 14:12     ` Leo Yan
2019-06-06 14:44       ` Arnaldo Carvalho de Melo
2019-06-07  9:58         ` Leo Yan
2019-06-09 13:18           ` Leo Yan
2019-06-10 18:47             ` Arnaldo Carvalho de Melo
2019-06-11  4:18               ` Leo Yan
2019-06-12  2:49                 ` Arnaldo Carvalho de Melo
2019-06-13 18:15                   ` Arnaldo Carvalho de Melo
2019-06-15  5:52                     ` Leo Yan
2019-06-22  6:44                     ` [tip:perf/core] perf trace: Fix exclusion of not available syscall names from selector list tip-bot for Arnaldo Carvalho de Melo
2019-06-17 19:53               ` tip-bot for Arnaldo Carvalho de Melo [this message]
2019-06-06  9:48 ` [PATCH v2 4/4] perf augmented_raw_syscalls: Document clang configuration Leo Yan
2019-06-06 14:08   ` Arnaldo Carvalho de Melo
2019-06-06 14:35     ` Leo Yan
2019-06-06 18:29       ` Arnaldo Carvalho de Melo
2019-06-07 14:38         ` Leo Yan
2019-06-07 18:33           ` Arnaldo Carvalho de Melo

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=tip-04c41bcb862bbec1fb225243ecf07a3219593f81@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=kafai@fb.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tglx@linutronix.de \
    --cc=yhs@fb.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).