Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1621634pxb; Thu, 14 Apr 2022 10:10:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJNTchHNpW1p62AI+OaZZY9+aqPBzyNIn92WH0WnoLKbEStxtn/HG6UNyqLOxA+2B4e8Bu X-Received: by 2002:a17:906:fc03:b0:6e8:9192:f6ce with SMTP id ov3-20020a170906fc0300b006e89192f6cemr3224688ejb.36.1649956225285; Thu, 14 Apr 2022 10:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649956225; cv=none; d=google.com; s=arc-20160816; b=teYdaOo6rI9MJm+OYUbdBsAHnWwIayxJxsMifkRNuZUTPi2kljJl5Uo3KXxkJc94oR FSDaJm4dyyAX/lKAANsj4C4NnSlFtIE1zIVkH5ibHtYJc2o8BwpB3f5G8nGRzvOaszyo 7o2Y3Ibq/UoArGY2ncRu9e/Ck0z58+U/C6nSg+IPUndc9s6ceMNkMi27N3X2BTP5vvYK pKi2zr3JOuBN60dM8tVaF/IUy4uUOqIfJzGcAE/ssy4EDUi9x0Gd78en0TmgTWxiXILY Y9PQLo8BX3KNVVf1I/OsvVKpeMKnWSgwddWycZb0vMppVpNWooat69++9ufJY/yD6mnl WrqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=viUl0yO42bplAv2DZyKx9JdDNFE5dlgIXxAIDx8R7VE=; b=THg/+HFTz+wHzFylTWPc4ipl9AOu4bMDUrhcG/VD2+GqqQz/fwBConauQ2i8AhPLKc AYyc04AD/WmJnmh6N1gEHCqgwirZR8u3tCD7ftMxBFV+02j/qngjPG44D+WbwADgA7a9 VhR/9E7KrjZ+09pgvTmxyynOdaTN8hetyh/nH5SwdmVMx1OHQTCtJ53qunhwFvCzoro5 VEliw07O9WERVcmRbvckiGbdz/JZBfvXKpAAxDlmIMwqLRK5/QtFVI7np5q/sbO/XVKe bvK/eIRa/42Pf4CPeJ40/frtizLCs9T0tIIfdbnDbPEJVdmKIC6WTHrDCKCejCtZBFMY rWuw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kx18-20020a170907775200b006e846927214si2531054ejc.466.2022.04.14.10.09.50; Thu, 14 Apr 2022 10:10:25 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242277AbiDNKcU (ORCPT + 99 others); Thu, 14 Apr 2022 06:32:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239652AbiDNKcS (ORCPT ); Thu, 14 Apr 2022 06:32:18 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0B93D3BA5F; Thu, 14 Apr 2022 03:29:53 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 71846139F; Thu, 14 Apr 2022 03:29:53 -0700 (PDT) Received: from [10.32.36.25] (e121896.Emea.Arm.com [10.32.36.25]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D8A723F5A1; Thu, 14 Apr 2022 03:29:50 -0700 (PDT) Message-ID: <9ad30442-41f8-6e17-cb4a-ab102b3ebd69@arm.com> Date: Thu, 14 Apr 2022 11:29:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v2] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event Content-Language: en-US To: Arnaldo Carvalho de Melo , Leo Yan Cc: 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 References: <20220413092317.756022-1-leo.yan@linaro.org> From: James Clark In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 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. 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 >> + 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 >