Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1468081pxb; Thu, 14 Apr 2022 06:57:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVOyqH04573YHftpW8zGR50EJtRXyMyv7rkGyj/2Ao4TvS9lqkWL5ys2KzQqh/Wdu7BmB/ X-Received: by 2002:a17:903:24c:b0:156:cc13:bfca with SMTP id j12-20020a170903024c00b00156cc13bfcamr48139319plh.114.1649944649634; Thu, 14 Apr 2022 06:57:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649944649; cv=none; d=google.com; s=arc-20160816; b=ZD+NamfV/5XRnWtlQCcNbbwFAdq33QU61d1GdQaIkM2KRjMgd91UAekVbAtYHmZ/91 +jCdfsa5W+fjNvUqTi2FlybN6L/a6bxp1b7GjTWmHEh3LJRxvq7lE2A80+LA/iR4dENs BKlyZ+skh74jaA1MG0IA/NPdVqCuhYaUWtoOFNxodfhv/vuWNJdCNOrioy7qBWCTY9HU d0s7y+S8YsGA2LJgHKbNLpEaa0fuyBjKXX4tUx58nt03cYL1A8py944rpQOFOt7EURIF IrCtWnyxJ84yc0+joOZ0S/T/ZFTQ1J0/WLKGv5V+h/F02Dh5dt4ESxF5AMRarTJ2qCKK cC1w== 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=PjY2QK3QVd/VfWF3ciroAhCUk4clLOPbeuib489tzi4=; b=yrw6114ryrseF3SR7ZnBNPTZb/R559l+/kj70gslf0NeC3SJRJhaHFbAkODh9gOwT7 Fk34kuAkk04pHz1Ud9pf9T85zFfJy8a6eIO972F0klmEbeZlRVBqkEm0kBJ9xx+4aWwa tAIgiVCHR/utxlsUrnCP856QQOkz0Z/Xv3YIDRYBcRzmlW8ihy7F3FyO2/C64/wg1v+2 Mcz1cTHgQl6XNLmQ8oklG1tjs2RwOFgXWTfAxWD8BuY1bPnjw2q9kXTKL5SMJ77k9J4+ A+RG/fi8zn0Vl+Ss7diLbV9kFajtMlwGXY55vg3lnrUvvRuF2UNf3HPUnQODybnJxrwt XPXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lOMredMo; 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 o18-20020a656a52000000b0038633e77da3si9296936pgu.71.2022.04.14.06.57.15; Thu, 14 Apr 2022 06:57:29 -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=lOMredMo; 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 S242813AbiDNLz3 (ORCPT + 99 others); Thu, 14 Apr 2022 07:55:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235031AbiDNLz1 (ORCPT ); Thu, 14 Apr 2022 07:55:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59B7C6211D; Thu, 14 Apr 2022 04:53:03 -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 03219B82921; Thu, 14 Apr 2022 11:53:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74976C385A1; Thu, 14 Apr 2022 11:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649937180; bh=CfAU/8BLQZf/z4UTLjwFtFdwDKxtlWOO615gu89IVos=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lOMredMovFi2z1Dq2qSiGbT066bYK7ftxLfE7AR+rclIpgNyyeXwZj28HnpI7M3x8 Q5Z5x7OjySsPRhaRmLjsJas8dFSyh+/yhmIAfcvMtp3HirnDMB04+hDjJw9jJMh6MO 6ur2Gti5yOGsoIA6hI5+Xrwzjq1F4NbZDSNju1WJcEJudR2igCSPqACALJJIURm6ht XMcWy9jiBX5OdJUYYhfwVJCAftMC9sgCJJKWp1j4oWjfDI+GeHqp4bIaOTuxHc81Ta RZHnRVaOzNHb5vN6DYV+I5sVKfBgWmmeSf1CHIp7f1X/2Y7YMiXgJnDHIUxL94NpNd Zml132wL19Fsg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id C655440407; Thu, 14 Apr 2022 08:52:57 -0300 (-03) Date: Thu, 14 Apr 2022 08:52:57 -0300 From: Arnaldo Carvalho de Melo To: Leo Yan Cc: James Clark , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ravi Bangoria , German Gomez , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event Message-ID: References: <20220413092317.756022-1-leo.yan@linaro.org> <9ad30442-41f8-6e17-cb4a-ab102b3ebd69@arm.com> <20220414110124.GB598831@leoy-ThinkPad-X240s> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220414110124.GB598831@leoy-ThinkPad-X240s> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 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 07:01:24PM +0800, Leo Yan escreveu: > On Thu, Apr 14, 2022 at 11:29:48AM +0100, James Clark wrote: > > On 14/04/2022 02:27, Arnaldo Carvalho de Melo wrote: > > > Em Wed, Apr 13, 2022 at 05:23:17PM +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. > > >> > > >> Fixes: bb30acae4c4d ("perf report: Bail out --mem-mode if mem info is not available") > > >> Signed-off-by: Leo Yan > > >> Tested-by: German Gomez > > >> --- > > >> v2: Change event name from "arm_spe_" to "arm_spe"; > > >> Add German's test tag. > > > > > > Tentatively applied, would be great to have James' and Ravi's > > > Acked-by/Reviewed-by, which I'll add before pushing this out if provided > > > in time. > > > > > > - Arnaldo > > > > > >> tools/perf/builtin-report.c | 16 ++++++++++++++++ > > >> 1 file changed, 16 insertions(+) > > >> > > >> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c > > >> index 1ad75c7ba074..acb07a4a9b67 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,21 @@ 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)) { > > >> + ui__warning("PERF_SAMPLE_DATA_SRC bit is not set " > > >> + "for Arm SPE event.\n"); > > > > Looks ok to me. Personally I would remove the warning, otherwise people are going to start > > thinking that they need to do something about it or something bad has happened. > > > > But because we've fixed it up there shouldn't really need to be a warning or any action. > > Understand. The warning is not bad for developers but it might > introduce confusion for users, and if we really want to check the sample > type then we can use 'perf evlist' command, so it's not very useful for > the warning. > > I will remove the warning and resend a new patch. Waiting then > > I don't feel too strongly about this though, so I will leave it up to Leo to make the > > final decision: > > > > Reviewed-by: James Clark > > Thanks a lot for reviewing. > Leo -- - Arnaldo