Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp549561rwe; Thu, 1 Sep 2022 04:13:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Hj26pZUAyuqQHTP4stzGodRofLQqbU4vr7xxxLwmIxJNQRvgxzYhC/Nri2Mfhcn27c4xD X-Received: by 2002:a05:6402:4007:b0:448:6c4c:b40 with SMTP id d7-20020a056402400700b004486c4c0b40mr16653868eda.422.1662030814483; Thu, 01 Sep 2022 04:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662030814; cv=none; d=google.com; s=arc-20160816; b=SjtCTH4YRvKgV4NbZGn1jiTw9hqFYyWnBB2XfgPmI88HNXNpJifrI/VJv70KTvxeO3 Zlm8e/k88/VAaH0xOA9JSOLwY+fSoqs7x2GiSOdB+DNmwj8fsVPsqvDW9rILWrxUmldR HPPx5xYKl8ZqFHFt+b2vVNj6PcKIl1ZJm4fHmENg9dor63sBiZdU83gNMN6R+GJFH49X r20COstkRro3b9tb0agZYIDsCJB+PfsXZY5m6vdEqGgrsh8I+yNyPAh9v3s5Jx7hLjip DNJpq+ukuhDHuRpBq3e3RTezG6SLESk1gXokvbbZ2Chn9XN8Xrd2obFyaR6Nk2CTlwpH FhSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oKnkvg0ZRHHmqscCSM1JvjAU3g/w1zF2zpxdAQoyEho=; b=vLtASQec2mWN3dMWAFVo0pH3V7h95l1RCHxxqGNQ+av6m7OxyHNkHMJaY5n7MZYzZ5 bqWS0GzClwlW5+r31HXzh4ePG1x1+l3Og5wIyR0f0pyXkUwOv+6ZkYoHXFP1/Hl/5+vU ykhpPhq0LZd0SHwxHN6/zcQLArmSLE28a+48HKsmzVUvPlLsJ1ZrVwol6gZWp2Y7b8Ca 9YZ1Jj966a1eU5iUlI+/qYFkVNp/Ej9p8hRSPHNwtjZAjsa1sOSxca3cQDYzUXcICUOk /WggNHfdGfG5soboP315uVRcVYGaB+X+O9ysLsADlCfoWVOEk7j4ThsB2B3+1dVxtBPw IjgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BNg3u820; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l16-20020a056402255000b0043bb6a22af3si1351091edb.387.2022.09.01.04.13.07; Thu, 01 Sep 2022 04:13:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BNg3u820; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234392AbiIALBH (ORCPT + 99 others); Thu, 1 Sep 2022 07:01:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234381AbiIALBA (ORCPT ); Thu, 1 Sep 2022 07:01:00 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 428DB1144CF for ; Thu, 1 Sep 2022 04:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662030050; x=1693566050; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+COgNiJU60nrHtd5yoDxcybxCHTdKYQtexMUf29NKBA=; b=BNg3u820hedk6LcWtUnC/nYpks68wLs+mD2Vi5sUHC1ovH3aFYlSAfw5 j+BMTB1liC8n5C7z8c8EHnSzXBWzuEMFJcd3DFOsgUeiR7jeRFEOJA/Kd j9C3jZTCy5C1PjoiQrPX/n/5s90TQb6xY/Dl/qWHvth2VN9Ztxb85heh6 xj+Dcozz+yb+tJB9PJBEVWK3eUqb53fFV46FJiT1SnKo3ps34NZFsl2Bc K/zAZjAwpU+0T612AsOr1lOy0hAxnt9AG8T2pjc7TF3/p0HMV7trjPVBU X4jD5SMOU35ircc8LPRcc1z0RsKejrQL761S071b+OTgTLGRSd90nqjt2 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10456"; a="294424792" X-IronPort-AV: E=Sophos;i="5.93,280,1654585200"; d="scan'208";a="294424792" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2022 04:00:50 -0700 X-IronPort-AV: E=Sophos;i="5.93,280,1654585200"; d="scan'208";a="673799633" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.42.13]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2022 04:00:48 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ian Rogers , Andi Kleen , linux-kernel@vger.kernel.org Subject: [PATCH 2/5] perf auxtrace: Add itrace option flag d+e to log on error Date: Thu, 1 Sep 2022 14:00:29 +0300 Message-Id: <20220901110032.9226-3-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220901110032.9226-1-adrian.hunter@intel.com> References: <20220901110032.9226-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add flag +e to the itrace d (decoder debug log) option to get output only on decoding errors. The log can be very big so reducing the output to where there are decoding errors can be useful for analyzing errors. By default, the log size in that case is 16384 bytes, but can be altered by perf config e.g. perf config itrace.debug-log-buffer-size=30000 Signed-off-by: Adrian Hunter --- tools/perf/Documentation/itrace.txt | 1 + tools/perf/Documentation/perf-config.txt | 7 +++++++ tools/perf/util/auxtrace.c | 13 +++++++++++++ tools/perf/util/auxtrace.h | 3 +++ 4 files changed, 24 insertions(+) diff --git a/tools/perf/Documentation/itrace.txt b/tools/perf/Documentation/itrace.txt index 6b189669c450..0916bbfe64cb 100644 --- a/tools/perf/Documentation/itrace.txt +++ b/tools/perf/Documentation/itrace.txt @@ -64,6 +64,7 @@ debug messages will or will not be logged. Each flag must be preceded by either '+' or '-'. The flags are: a all perf events + e output only on errors (size configurable - see linkperf:perf-config[1]) o output to stdout If supported, the 'q' option may be repeated to increase the effect. diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt index 0420e71698ee..39c890ead2dc 100644 --- a/tools/perf/Documentation/perf-config.txt +++ b/tools/perf/Documentation/perf-config.txt @@ -729,6 +729,13 @@ auxtrace.*:: If the directory does not exist or has the wrong file type, the current directory is used. +itrace.*:: + + debug-log-buffer-size:: + Log size in bytes to output when using the option --itrace=d+e + Refer 'itrace' option of linkperf:perf-script[1] or + linkperf:perf-report[1]. The default is 16384. + daemon.*:: daemon.base:: diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index 6edab8a16de6..b59c278fe9ed 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c @@ -26,6 +26,7 @@ #include #include +#include "config.h" #include "evlist.h" #include "dso.h" #include "map.h" @@ -1434,6 +1435,16 @@ static int get_flags(const char **ptr, unsigned int *plus_flags, unsigned int *m } } +#define ITRACE_DFLT_LOG_ON_ERROR_SZ 16384 + +static unsigned int itrace_log_on_error_size(void) +{ + unsigned int sz = 0; + + perf_config_scan("itrace.debug-log-buffer-size", "%u", &sz); + return sz ?: ITRACE_DFLT_LOG_ON_ERROR_SZ; +} + /* * Please check tools/perf/Documentation/perf-script.txt for information * about the options parsed here, which is introduced after this cset, @@ -1532,6 +1543,8 @@ int itrace_do_parse_synth_opts(struct itrace_synth_opts *synth_opts, if (get_flags(&p, &synth_opts->log_plus_flags, &synth_opts->log_minus_flags)) goto out_err; + if (synth_opts->log_plus_flags & AUXTRACE_LOG_FLG_ON_ERROR) + synth_opts->log_on_error_size = itrace_log_on_error_size(); break; case 'c': synth_opts->branches = true; diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h index 6a4fbfd34c6b..cb8e0a01abb6 100644 --- a/tools/perf/util/auxtrace.h +++ b/tools/perf/util/auxtrace.h @@ -60,6 +60,7 @@ enum itrace_period_type { #define AUXTRACE_ERR_FLG_DATA_LOST (1 << ('l' - 'a')) #define AUXTRACE_LOG_FLG_ALL_PERF_EVTS (1 << ('a' - 'a')) +#define AUXTRACE_LOG_FLG_ON_ERROR (1 << ('e' - 'a')) #define AUXTRACE_LOG_FLG_USE_STDOUT (1 << ('o' - 'a')) /** @@ -110,6 +111,7 @@ enum itrace_period_type { * @log_plus_flags: flags to affect what is logged * @log_minus_flags: flags to affect what is logged * @quick: quicker (less detailed) decoding + * @log_on_error_size: size of log to keep for outputting log only on errors */ struct itrace_synth_opts { bool set; @@ -155,6 +157,7 @@ struct itrace_synth_opts { unsigned int log_plus_flags; unsigned int log_minus_flags; unsigned int quick; + unsigned int log_on_error_size; }; /** -- 2.25.1