Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1749314pxb; Thu, 14 Apr 2022 13:10:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7ybGd5vwcXQNurvSBhF+OVDiCPbxZ7GvnA60gZwB63ZGaFm3b6WVm7RhFp3/lrVLHeNlh X-Received: by 2002:a17:906:5418:b0:6df:a07f:764b with SMTP id q24-20020a170906541800b006dfa07f764bmr3596432ejo.27.1649967041451; Thu, 14 Apr 2022 13:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649967041; cv=none; d=google.com; s=arc-20160816; b=MsCZZ5dA7K0xs+g3rPiw0jJpL9/uEOrL8NmGvunWPTvIwn/w2v+g+e9/l8GqobpnXA AXEcbU+B/lVkHCrm+UwTXrc6B9XwWKI/RN/4w+bNzF1GbedXhkdckWCqGNkji48RRG6D 6j5DLOmxcO5Cg2avxmVjQZ/cEUTi+zK0PLLBdJZHir/HufWJqAUHKr1gPvkhEv9/r1IK QsiB2lZyUPkdTN5ZfFwqHTsE9NcBYbmSZtB4bxPGwlT1k5ghSWwLE6v3ss4zaeNONAGy ESqU62kY7+JduWswfkkMHpXvTXv3nUXGbzJuDWfvttlNY3ohv5GtPoJKRnqMTYkyW8ZI +rAw== 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=Lb2k1BEpSa/+z3XM1HtbDM6QVDJOM+So55d/9ulxPRs=; b=uRyQiz/DGpmFJsavEzWy8thY+V1iH1vx/uTOaoRlJQqi47LibSodacV5I6Mj+NQKk4 BWs62susnCtCeTCZ8WMNrMZBL4FVo57Ku7pMRj+HozfwhYK+qQa31Zn+Qj9lAHLtAy4a 5phI4RPszVVLnxTdApVuKYyxUKCQushJzEY8CwEP0/9lZkWOw3ogJ0QLWg1JPEc+tAU+ DGuJTWODdZiG/ZQd3SmWX6f7yM6Jqnt46zEXEPbYAkpokI8fseyZop/+nUeYmkyHIlK3 unNUyo0i4K/MM5eXk+18zS71MbwtqkotGbYgloEYz6MX5RqcbzPheWzyGEy9SJ3IOJCA G0qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zXucu3ux; 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 v19-20020a170906489300b006df76385e45si2506226ejq.741.2022.04.14.13.09.46; Thu, 14 Apr 2022 13:10:41 -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=zXucu3ux; 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 S243370AbiDNMew (ORCPT + 99 others); Thu, 14 Apr 2022 08:34:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243423AbiDNMet (ORCPT ); Thu, 14 Apr 2022 08:34:49 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 055AC9026F for ; Thu, 14 Apr 2022 05:32:18 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id j8so4496302pll.11 for ; Thu, 14 Apr 2022 05:32:18 -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=Lb2k1BEpSa/+z3XM1HtbDM6QVDJOM+So55d/9ulxPRs=; b=zXucu3uxOuHlgBIeFHXTZQcT0f1Nuj2wADtF8qNjEXDePKfd+pTSETelEAYNVGGNqX cSNT0kjY+IZpN4B2azMgW2RVYC4oSo3VKi8nuBDzDfMTMVfzo6/LE1A09jYRYZeibCv+ C2sP2CL8XuyNyF5b3tt4E+w3JLurTe6nyqV4xnvVHw3q1LCBhtj2AT5ggSX6ked/ABq5 D7shBoM4tTHCpbzmYwilmV14zXLYn/gNKV5PTHSQ7bHjRrnhzjLJ7NJTyCm0TQHvU0MG 6x/1dVPvbCIYfWS4Z0gseji7+oynCbJzF34yLOKo+OjQSbpbCY2KwDmIY3MDsLRdXFrx KN3w== 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=Lb2k1BEpSa/+z3XM1HtbDM6QVDJOM+So55d/9ulxPRs=; b=WLbeVh7PQa4GW8dhlYi5NUNDuOzJp6opOVmC4xaTs+R96J01YtHHXVzZBy+GzBfcBG 1n5QxY6qsxAEcYf5tqcydJAAPa2zLx1Q073Nq8Le0FOQZdPlRY3n1anxMQXf9OefAbwo wvo+Rr9ffm23IkkQqA8eY6gaB2FWMalYbq4UgVFmnmp3zcw8jWay4LMdPhEYJAVU5G3Y uKtiWYCaiAmDyoK41RFh8fIQ00TrYoNSS3pjQuqG7GYII8Tlqk2cbAQEteMARvq/IO4g bDEOXXRAh8oHktz3CJQgkt+T0dK8+7Cu1gMmQzPi3hnTYGItzV+zb/DSbvrKPRD4pO1b nYmA== X-Gm-Message-State: AOAM5316ytQdYZcAeAAJZ3SKtjSny1+AcPlb1k6YnFZIwxqpCR3/69sF ds7iRNbrvAFwK7vv/RHfTs3e66llWQBn3lO+H+VFkA== X-Received: by 2002:a17:90a:dd46:b0:1b8:8:7303 with SMTP id u6-20020a17090add4600b001b800087303mr4035808pjv.197.1649939537353; Thu, 14 Apr 2022 05:32:17 -0700 (PDT) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id t184-20020a625fc1000000b004fa3bd9bef0sm2160580pfb.110.2022.04.14.05.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Apr 2022 05:32:16 -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 v3] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event Date: Thu, 14 Apr 2022 20:32:01 +0800 Message-Id: <20220414123201.842754-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 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 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