Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4458666ioa; Wed, 27 Apr 2022 04:27:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzb8FyHhAcTAUFYkQ/vobCl6i0MKEfpvUMnuCtdjthD/V7eYY6uTULtMGjqei8BYaNc9QT3 X-Received: by 2002:a17:902:d2c9:b0:15d:1f75:14af with SMTP id n9-20020a170902d2c900b0015d1f7514afmr12932594plc.148.1651058850696; Wed, 27 Apr 2022 04:27:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651058850; cv=none; d=google.com; s=arc-20160816; b=SnekV0FZoSyeQ+G9b8SN7JlgWZOjXEz+JBZStJvoT0kc9HK0BnVYfKSu4swZiGf670 iFiQ/wwbVtXWEnrz4PiTiB63sOCHcmrWt5+H17v8x7O8U3tdQEVD5NCMZNixrBTWBB6K CIcX/4dS9tdweuriiH7yl5M6OUQxebK+2SQbU+yrtSAV4KJxSJGIUjok6nGVJMriufEE Oss7ei4N7D/1V4Vnx5geJLrhGgcKO5gKfpifxhi+7XNcFtEJ1skoBUyIg/CGCxLF9ljf T1AW9msSJ+Ya1ExwIVkVT8RmBWgaP/eb4ZouYmWfa0tgV/2rbeI359gPoSGIdVMGbwV8 G7kg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qUWZDY0ZOmtqaKX6r3vW2L6A3QAZq9qUL0XVkVD9Jho=; b=WDCNq6cKK1CndCc2YIusY9n2ww2CdM23qeLKl7Vp3oogINoRMT5nET4oigkLr5c+q5 To4QCaP8H1gkk/O0d4aNnbzQkkT3TAaB0FUr4O68G5W8Uy1G8uGq0EMyjDRCfQxjTYnV dO3J+c47BDIMopBQKqq5dpwyuAT70r4kqWe7Q4q3K7pXCycYtX0srLxZI9IVAEN1+iTY hr/Wjw0Ag8jN4vv0EqGmzbnW67PFeeKAAcGTr8M32z93ZIS6aPyxjRYpVUMoxuAwaet+ SuSCvM5iXbz2aD4o7PA2nkH1pDwc1XzhvkYoO71DSg7KHPVWmi/A349SpHpV2Gf8FMY/ oucQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2wPvIy0P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y23-20020a17090aca9700b001cb133b45f3si1371149pjt.143.2022.04.27.04.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 04:27:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2wPvIy0P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6F35E27533C; Wed, 27 Apr 2022 03:24:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347037AbiDZJNp (ORCPT + 99 others); Tue, 26 Apr 2022 05:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344418AbiDZIv4 (ORCPT ); Tue, 26 Apr 2022 04:51:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD0A7D3AE7; Tue, 26 Apr 2022 01:40:52 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 233DF60C49; Tue, 26 Apr 2022 08:40:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02300C385A0; Tue, 26 Apr 2022 08:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962442; bh=4mFtDAy5yc/e9dUGPrNDYFYcOiFHuXZ4/OfamRyQG80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2wPvIy0PTIIuIXOqRFYIRcJhOgS6w6+fd/Rb6ZmtkE0/B8GzFu+KKCULNQBSDXjCm oWY6RGR1gHS/trINmSXgT2+r7QBgJDDnXvKC4KuL0JLSAuQbYhjm+M5qgdKirheTaM WauaalJ0oG9uEuYiMAuBmkABSePJKzx6jNUKdAj4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Clark , Leo Yan , German Gomez , Alexander Shishkin , Ingo Molnar , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , Ravi Bangoria , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.15 098/124] perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event Date: Tue, 26 Apr 2022 10:21:39 +0200 Message-Id: <20220426081750.085380367@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081747.286685339@linuxfoundation.org> References: <20220426081747.286685339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 From: Leo Yan [ Upstream commit ccb17caecfbd542f49a2a79ae088136ba8bfb794 ] Since commit bb30acae4c4dacfa ("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 ffab487052054162 ("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: bb30acae4c4dacfa ("perf report: Bail out --mem-mode if mem info is not available") Reviewed-by: James Clark Signed-off-by: Leo Yan Tested-by: German Gomez Cc: Alexander Shishkin Cc: Ingo Molnar Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Ravi Bangoria Link: https://lore.kernel.org/r/20220414123201.842754-1-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- 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 997e0a4b0902..6583ad9cc7de 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -349,6 +349,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 || @@ -403,6 +404,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.35.1