Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3470818pxb; Tue, 19 Apr 2022 03:22:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/2BcYtEB2Gc5wbAVK44sj2nLYIrrdDTlMJmzRg9GSBeHjqSGMT6ejadg5SvSoBBdf/C7/ X-Received: by 2002:a17:90b:4a09:b0:1d2:de49:9be8 with SMTP id kk9-20020a17090b4a0900b001d2de499be8mr1862668pjb.68.1650363779321; Tue, 19 Apr 2022 03:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650363779; cv=none; d=google.com; s=arc-20160816; b=uqQktQM/vH2EDjjSq2dSpx+18BtdHxRyeBmAqpRWw4+dLbAw5k0DaqfoJD2jxC+bKh BfLZ1EdSKu16z0JkHmWQPM8Wc1UQiikc+xe6Vs9SaMzaw96xBSXA4l2d4Lq3ERU7PBYy 8TDL1lBmY5XElr3DlUb4Ko68DWR0AgP3gGKO64WCoqvRf2bBLtIcJfS8nMnl4Oi3mPA7 R3WjMYJwtHQNZNM0k8nbGtjr601PoNNC87sH8KymcVUvt0Z142bXzpE3v5eXO93Onlrc Gwu8Jt3Yc6rcdTv6hSvDTYMbBpPT9WYd8RrQXqUVw6dWA2xfzeI/tZSyQ+mWUBeCD/Ie Z47w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=s3D+0SUKSAhqbEU+uwQ7dY8JQvQxzRagKCElDPyTjsk=; b=OyJzt4U1aWA2iX12bj5iY6KUBrzK8NjxhSBZxPryFpT4e2Fs34rLkaCiw8s1UHx5w2 PGtaesx1gY9vvhBR4LjzrFhTJEmMqSCD6HahICMNHKxsnoxH3ySB8a4PWoD9Ba53rLwQ 1lXiVo+/cWiS0jRh/u9+MMuPEAyndu/uzJuSJ64Lj4VOS4bVbLOMzxkZzLzC/JbhUNC9 46oQ8JV6EAOO+Y//pfdI9TwcnwTkGFH/bQTExP2P6iZuP/h5v5JSMpyP4jnyj3LAnBGS SM7nWVqicRg3nFJVeoDYJsM7A0CLeC4NW7UVbRYADwOBdtmxPUo8U/efXV5JUJYTxUM/ zSKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aEtAOzgR; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a17090a64c700b001d0aa8594besi1800465pjm.25.2022.04.19.03.22.45; Tue, 19 Apr 2022 03:22:59 -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=@kernel.org header.s=k20201202 header.b=aEtAOzgR; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229823AbiDRV7P (ORCPT + 99 others); Mon, 18 Apr 2022 17:59:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbiDRV7N (ORCPT ); Mon, 18 Apr 2022 17:59:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE6D21EC70; Mon, 18 Apr 2022 14:56:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6C675B8111D; Mon, 18 Apr 2022 21:56:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D78F5C385A1; Mon, 18 Apr 2022 21:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650318990; bh=Ort/FNyu5RR5bPKO5SkmLIei1JMdx3sTNHFkvt4S1T0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aEtAOzgRcoloXKlQhxJTzAhf/Q9xQsf+Kg/Pya/yy9CvwaqgLzNF+xyqjOKZG/t9P HCpJMkSbIM3Xs/SHQ7BMwc0WY3vEmca7VRtU4tIz7fR2FWVIC4DLVze08PiEYbMj0f AD6/XNm8tGPDuw1ZXU59Hu2m0ybh7om2jO788Fr1qPDTjQuiDlod9387ZDzT1lRQ2X AHG8OTQWwt76sTcCF6x8N5PPGnpM0Y8jjbf6N9gjys4Wk3Bm+Ht4OtjtkFPX9kFOSD 3bysGTUbtvWvmVA0/yjn9rt3s73MBPs3TczIEr04iNVyJu6/qYVpDgkljwZXeSklrP waDI7LAKc8Dpg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 7120F40407; Mon, 18 Apr 2022 18:56:26 -0300 (-03) Date: Mon, 18 Apr 2022 18:56:26 -0300 From: Arnaldo Carvalho de Melo To: Leo Yan Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ravi Bangoria , James Clark , German Gomez , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event Message-ID: References: <20220414123201.842754-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220414123201.842754-1-leo.yan@linaro.org> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 Em Thu, Apr 14, 2022 at 08:32:01PM +0800, Leo Yan escreveu: > Since commit bb30acae4c4d ("perf report: Bail out --mem-mode if mem info > is not available") "perf mem report" and "perf report --mem-mode" > don't report result if the PERF_SAMPLE_DATA_SRC bit is missed in sample > type. > > The commit ffab48705205 ("perf: arm-spe: Fix perf report --mem-mode") > partially fixes the issue. It adds PERF_SAMPLE_DATA_SRC bit for Arm SPE > event, this allows the perf data file generated by kernel v5.18-rc1 or > later version can be reported properly. > > On the other hand, perf tool still fails to be backward compatibility > for a data file recorded by an older version's perf which contains Arm > SPE trace data. This patch is a workaround in reporting phase, when > detects ARM SPE PMU event and without PERF_SAMPLE_DATA_SRC bit, it will > force to set the bit in the sample type and give a warning info. Thanks, applied. - Arnaldo > Fixes: bb30acae4c4d ("perf report: Bail out --mem-mode if mem info is not available") > Signed-off-by: Leo Yan > Tested-by: German Gomez > Reviewed-by: James Clark > --- > v3: Remove warning log, add James' review tag. > v2: Change event name from "arm_spe_" to "arm_spe"; > Add German's test tag. > > tools/perf/builtin-report.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c > index 1ad75c7ba074..afe4a5539ecc 100644 > --- a/tools/perf/builtin-report.c > +++ b/tools/perf/builtin-report.c > @@ -353,6 +353,7 @@ static int report__setup_sample_type(struct report *rep) > struct perf_session *session = rep->session; > u64 sample_type = evlist__combined_sample_type(session->evlist); > bool is_pipe = perf_data__is_pipe(session->data); > + struct evsel *evsel; > > if (session->itrace_synth_opts->callchain || > session->itrace_synth_opts->add_callchain || > @@ -407,6 +408,19 @@ static int report__setup_sample_type(struct report *rep) > } > > if (sort__mode == SORT_MODE__MEMORY) { > + /* > + * FIXUP: prior to kernel 5.18, Arm SPE missed to set > + * PERF_SAMPLE_DATA_SRC bit in sample type. For backward > + * compatibility, set the bit if it's an old perf data file. > + */ > + evlist__for_each_entry(session->evlist, evsel) { > + if (strstr(evsel->name, "arm_spe") && > + !(sample_type & PERF_SAMPLE_DATA_SRC)) { > + evsel->core.attr.sample_type |= PERF_SAMPLE_DATA_SRC; > + sample_type |= PERF_SAMPLE_DATA_SRC; > + } > + } > + > if (!is_pipe && !(sample_type & PERF_SAMPLE_DATA_SRC)) { > ui__error("Selected --mem-mode but no mem data. " > "Did you call perf record without -d?\n"); > -- > 2.25.1 -- - Arnaldo