Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2927357ybi; Mon, 17 Jun 2019 12:54:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2QhOKenxYXurAXQV9PRTEzvM2El8ITfv14hCLhviEx+MIJF6+Jrcm8rW4ML1CMZzGKXp4 X-Received: by 2002:a17:90a:7148:: with SMTP id g8mr664046pjs.51.1560801294231; Mon, 17 Jun 2019 12:54:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560801294; cv=none; d=google.com; s=arc-20160816; b=se37PrQL1LAMM5ipT/rE9xiMjS5YezwmaIIb6o/B6TL5FiVbZM6SCU1u/TluhdztYP u7EsL7zer8j6Pws571EtzTLO+x19tNty24aFOVu7iiEf+EwChUE9S4UJYxWAxr+8Wjxm het2+xZBEbhiSNMaJQed0GTLOi44ZG+J8vLpT3d+6M9kBdGSbOI7eyScZctYVEE4Uhs+ ZvG8oDc3ZamgiDKocuy1VMnZNXvwd0VEr5vhD+IudCrfGViEon3QcAWbPQCiioPEYVwf /V6j6gQPx6IzOPOQdY4cMjUyxSJx6rgk7cXevPQepiAN6lBbA8SI1RXLJxI5JoNKOrqj Pd3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=Rzo0baNNo6xSxGbeyFpsmtO3SJ2LPXYBvECxFKlMfCM=; b=ZZ7hqa8+mbgNzeEAFufpqg6aPVkpU5WkzebTBvAzkQxlUfZZoHqcTYYrW1AT5LG2ZK uiit6JSrIOmPXN0hsKA/vMjhMzv6VpWZ6+jkbBK0DwIvCZ2F8ezGs7ivw3bg6jU7y81B CFbA63T9QewKwqx6/k7hasBVat12qKqFQZsbFq0KWRqWz0mFVvb5HERk13q65YtlpD+9 GXqofa65XkHvbHyb12ZXuVeP2BxX07YaKzb3ul3XQv7vzym056COCXkFRDlHpFMoloEs yJevAYfY+RLKIz3vYY5na1HxLuOZ5qyEUvUIj0xFVs+IeZeBm19Bh2aeQ0j9xuNtozb7 l70w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019051801 header.b=YopBetrA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j68si372838plb.28.2019.06.17.12.54.38; Mon, 17 Jun 2019 12:54:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2019051801 header.b=YopBetrA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727875AbfFQTyV (ORCPT + 99 others); Mon, 17 Jun 2019 15:54:21 -0400 Received: from terminus.zytor.com ([198.137.202.136]:35047 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725878AbfFQTyU (ORCPT ); Mon, 17 Jun 2019 15:54:20 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x5HJraSi3570891 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 17 Jun 2019 12:53:36 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x5HJraSi3570891 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019051801; t=1560801217; bh=Rzo0baNNo6xSxGbeyFpsmtO3SJ2LPXYBvECxFKlMfCM=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=YopBetrACyMm/eQme48LXZMVu/oOLv2NyV76v5yf5nEM6r+x8SxLSR91VKPt/Na+l Maep9ZHyEy4nl/d+GCDNEmrVZkpK552QIctOZ8JBL4kX0IyBAaD6nkkAMUxudERSJs GQwvo0QS4pzUz7Dvy/MqcXDPiefVR3toZW5IMi3kurr25xjiWnwkVybvpQOatDNKos nyRplhr/oMQD0CH20HRQ4l5YbX2fcM589OJKA/feyiDE4Zj21ZezFNDPyJxoSl5ptN Baj1J3te3tFe9yuTg0TvpMQOrvRn9KACAvxWEomlq47cl9OUT3J/OrZkugtBA3cnZF vghdHQOqC2IHw== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x5HJra9u3570888; Mon, 17 Jun 2019 12:53:36 -0700 Date: Mon, 17 Jun 2019 12:53:36 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Arnaldo Carvalho de Melo Message-ID: 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 Reply-To: kafai@fb.com, daniel@iogearbox.net, leo.yan@linaro.org, mike.leach@linaro.org, tglx@linutronix.de, ast@kernel.org, hpa@zytor.com, jolsa@redhat.com, adrian.hunter@intel.com, namhyung@kernel.org, suzuki.poulose@arm.com, songliubraving@fb.com, linux-kernel@vger.kernel.org, acme@redhat.com, mingo@kernel.org, yhs@fb.com, alexander.shishkin@linux.intel.com, mathieu.poirier@linaro.org In-Reply-To: <20190610184754.GU21245@kernel.org> References: <20190610184754.GU21245@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf trace: Skip unknown syscalls when expanding strace like syscall groups Git-Commit-ID: 04c41bcb862bbec1fb225243ecf07a3219593f81 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_06_12,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 04c41bcb862bbec1fb225243ecf07a3219593f81 Gitweb: https://git.kernel.org/tip/04c41bcb862bbec1fb225243ecf07a3219593f81 Author: Arnaldo Carvalho de Melo AuthorDate: Mon, 10 Jun 2019 15:37:45 -0300 Committer: Arnaldo Carvalho de Melo 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 Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Jiri Olsa Cc: Martin KaFai Lau Cc: Mathieu Poirier Cc: Mike Leach Cc: Namhyung Kim Cc: Song Liu Cc: Suzuki K Poulose Cc: Yonghong Song Link: https://lkml.kernel.org/r/20190610184754.GU21245@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- 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; } /*