Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp664477pxb; Wed, 13 Apr 2022 09:41:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznHuwwP9aIE/7b3897WUvxR3C1soTtHaWZ/Lii42SBjZJarSClzWA73JSfXEvp/kCfe7Z+ X-Received: by 2002:a05:6402:1e90:b0:419:4cdc:8b05 with SMTP id f16-20020a0564021e9000b004194cdc8b05mr45057950edf.211.1649868093996; Wed, 13 Apr 2022 09:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649868093; cv=none; d=google.com; s=arc-20160816; b=iGlH9V9FtQ8gHcMRBnI0QdR8RetxX2Q0uRmCblcby7wh/GlefFG0WpIGFoXh7NsOz7 gQHThsXOTuApPiiOZve9xvHnTR6iH1baTm8o9GQnl9FUV9ty7jz7jYSpqbiVzJqnoWbV f1h+NGQvlmKXFJWmTmW+bsx9w35Xa0wWyTigw9Um2Y+9+aS2WcTRpRdbe5Y0DF7Rzr4q SNGdAek5uo3tTk7CliiEuLHa5uLHpPjeiRerdgvXZBmMQI8UKemMS31m/VaSOqaP53u8 vXBknbZyZkiCnp4ILXkbU/+mm3iOXx+OrPReq9Vr/0xNdz/bB2zxvrcwC3BRaKllbQwF vz2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/lSayVPsdaIcAWY+f+5xyOZsGygWFB8bqZXV5zFL3Io=; b=xARNKu1xg0r48Rw1zkj03AyMVoOyJPspZ8KBdYZEi59B4iCtpYbVH7PoT1D866XCVp R/37WwyZ9G9JOWh4aCzQC7vvI/L6xJkEB/HDPcblDlwtw+6rtY9hZB8qClx7LvTcfkgX Y88vYRke+iSroU4rHdNShnzAuHWjeRLMkdg+zwCk2El3WBhtiBW034w7/iQyhuHGtG4n W9AiTrLa7eQdmbOFjqWC2f7Hx0Njq87OWe8W2dOmwn+5/holzk6yAHSZmO2KN41lCANa uciz2MpPt+HDjf4HX4CBj/zbxvZTcR+W15ZGmUVHxMxf84O344Jy03j9ziI5sjokp57X mt0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y4XcoZfN; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n20-20020a17090695d400b006e87f57376bsi314828ejy.203.2022.04.13.09.41.07; Wed, 13 Apr 2022 09:41:33 -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=@linaro.org header.s=google header.b=y4XcoZfN; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233400AbiDMHyJ (ORCPT + 99 others); Wed, 13 Apr 2022 03:54:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233491AbiDMHyG (ORCPT ); Wed, 13 Apr 2022 03:54:06 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E767035ABF for ; Wed, 13 Apr 2022 00:51:45 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id c64so1316190edf.11 for ; Wed, 13 Apr 2022 00:51:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/lSayVPsdaIcAWY+f+5xyOZsGygWFB8bqZXV5zFL3Io=; b=y4XcoZfN/r7PCh4ltBhjmsoiZHDaSBYRYuN+dYYTnz0dfhgPUQ6RFeudoMmeZ6syBv moC6eYs1Xvff4ljD3tJdk7b82FscaAImj+DC/EbR+oa0yOEY1sTppOIuLg/yAGfJEeWc LqUFgrfcdPRGvdEZdn5+vwaU91NwW4YUIVFyccZUyoPk7gOfbS01o6Ggj9DIH+qNcaKR 4C8t/s6/aEl/lldPy6kkhUcU0v0xrlP6EOH1xfIBgOfthRfPmUmZml1G5MCVogls5vbF Whyac6B+ZFXjsLP0kxTrpnSjZF0dIDhEmRxSuE8l7/RvLtSKgVrzLPW0TOGMVAJoVxtL JTLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/lSayVPsdaIcAWY+f+5xyOZsGygWFB8bqZXV5zFL3Io=; b=hSkk0Xlqg3EHC0Tx0uTrxJTJQmHpC7H02ic87OlWnQXT/XRDo9xj3TIn3CJmJZIam+ uDSRfP87s+NsSsaV/M9TQekqcgZdYa/tLQa7eYAkLaQ+hHJ5/j1Tun3bUrBCictDygYd 8REnJf39HfWKP6D+9pcaR8rbFSk2yufZqXC89bJ/BiGoByutIvcEuraSQzMW9nj1NX40 9InyjQkESoApJMPlwCVSJ8tBISosj10M0rjo/eSFoD18UZNzCDWFlBe8KNhbhQPc4VMX Rh1vzPAWc391vKUUmMzpuacVlQlvY249dKpU1mTiK5tDGWwAA9m9nYKnU3uJLMkliBuh /paA== X-Gm-Message-State: AOAM530307+XQtOfFX0kASIdQyUK1yVhBo5+DnJqaIgVwXZYMAwXNsKf Yp29/w8+y5Ct73JjUHs2uoxyrQ== X-Received: by 2002:a05:6402:e96:b0:41d:1a0f:e70a with SMTP id h22-20020a0564020e9600b0041d1a0fe70amr27233192eda.411.1649836304304; Wed, 13 Apr 2022 00:51:44 -0700 (PDT) Received: from localhost.localdomain (111-250-44-108.dynamic-ip.hinet.net. [111.250.44.108]) by smtp.gmail.com with ESMTPSA id t14-20020a170906608e00b006d1455acc62sm14035390ejj.74.2022.04.13.00.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Apr 2022 00:51:43 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , 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 Cc: Leo Yan Subject: [PATCH] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event Date: Wed, 13 Apr 2022 15:51:24 +0800 Message-Id: <20220413075124.635589-1-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 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 --- 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..f26dd14eb852 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"); + 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