From patchwork Thu Sep 26 14:48:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13813434 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E2CECDE00D for ; Thu, 26 Sep 2024 14:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=/nmo5sfzFJvh03XPWULjDAkriT3KqgWW1PyKr3ieQ8E=; b=fSVbLp0VnpTNgZL4thGTp8O0cF D4X6a7+SNfMkJDU9caBZaPECaodiCZuefAKLnWvawqJ1L2fmeLxhhCXnAnEF+w5nbaovKPp1yjb2U kz+21b7CARdqArYO2v0Pj+Y64NSaCelk7M/jjxHfI3S67jVitJyOtNvT8QWsoyGTWfBXFl4+3YL8r SuhywirBwiKkXv+Mhtl4bp2MOa/RCSiPdimfPtghdYxMmCYOGFx3PWNNsLOTZuiFvLyCPjby5wnOf p85paSHrCJ6osbQep3hKg0K6w0QYUyg6KEUtqdITN0whzaNVns8Wx41rywTVuMvDdOY80RMW8hRn/ oEkOg0cA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stpp9-00000008eWn-0TYW; Thu, 26 Sep 2024 14:50:31 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stpnr-00000008eC3-46yh for linux-arm-kernel@lists.infradead.org; Thu, 26 Sep 2024 14:49:13 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a8b155b5e9eso158112566b.1 for ; Thu, 26 Sep 2024 07:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727362150; x=1727966950; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/nmo5sfzFJvh03XPWULjDAkriT3KqgWW1PyKr3ieQ8E=; b=N2VJ1Zgpdz0GEJOqdhLruYPv7rA7kg26YIHPjwiTLq+kpvBn+AhpOAk4BAZ+jN/uCg KZB7YZ8wxr2h1moQ3dDkxaybIWBf7MJRNihjDnN4qcpTeQdFOAkxSfyjGSaQl7NiETbK hDw5P1n71b5gtAWd11aHHvCPO5/7UeXD0GkvUqSECLKK5WIivui2NP3GqPI2ZjENS5er py8+eiF2shpzXhVQMSm2f98ffe41EIyDykbRTZPxWekZO0ADwpADCGwtMugvFFg/og1h FL9vmTYx/FiXXWD95JO4PROQoY03sTFZr04UsSramA1ZpMEw/dnWii/SmblbwvSiLNVd 2dJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727362150; x=1727966950; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/nmo5sfzFJvh03XPWULjDAkriT3KqgWW1PyKr3ieQ8E=; b=ezg+yiz6341DD5yr5ANXqLfUnFvvASuWWrQRg4o2+5sTjeVGxuWOx/j7nPYB0Ckg29 FPrh5sMKCrmq1w/zzbZcXxHNI1h25W4Ru/aNHjHDE/PdJvORIkUU50W4WZr6G3fAtvDJ 86kFU3tOxrrn0QU062hbOy9JOxE74d/FN3EJt1dIDUnugY69y5ulBpbVvFb+XXfAgm7E DQqT8pElkUIDnhn+++xv7JtJr3GfpOeBTQzaiE0/i37r6+MdLtxtF4nK6QVwrxVJds9F 0M6U/0VQqAbJJsTlbAv/Rk3mHySaontNlmgs38ofKR5zeCl9s4HOjQlhmrpFUaLFHdxj m0NA== X-Forwarded-Encrypted: i=1; AJvYcCW9tyYqn7M8JXsnBhfhtGHlWVUHD4Pbklp7UcitnfWyvfZf9v0xfqYnmg+47l4RtIrcCwiSzjb9bzkulN2n1EoV@lists.infradead.org X-Gm-Message-State: AOJu0YyHLw+KuFlZp6RMka1r9D7/1eSJt+KuwFytp1NPZPa8buM7emCj Hot7G9XPjNlVsogYfbu1Wd6hWy44hB6CIZFZqNCamGTurmYGhfQ9vz+TUg1ZpPA= X-Google-Smtp-Source: AGHT+IEEXyvhJCDptdkfXlYuLzjr9lZI+o2LHFX4/RBpRoo60JvvnSuQQ77087WzgbwG59bASlVU1g== X-Received: by 2002:a17:906:dc8f:b0:a86:83f8:f5a2 with SMTP id a640c23a62f3a-a93a038c991mr608490966b.19.1727362150042; Thu, 26 Sep 2024 07:49:10 -0700 (PDT) Received: from localhost.localdomain ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c294833asm5589966b.98.2024.09.26.07.49.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2024 07:49:09 -0700 (PDT) From: James Clark To: irogers@google.com, linux-perf-users@vger.kernel.org, kan.liang@linux.intel.com, ak@linux.intel.com, namhyung@kernel.org Cc: James Clark , John Garry , Will Deacon , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Weilin Wang , Dominique Martinet , Athira Rajeev , Yang Jihong , Colin Ian King , Howard Chu , Ze Gao , Yanteng Si , Sun Haiyong , Jing Zhang , Yicong Yang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v9 0/7] Event parsing fixes Date: Thu, 26 Sep 2024 15:48:31 +0100 Message-Id: <20240926144851.245903-1-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240926_074912_061848_51819ED3 X-CRM114-Status: GOOD ( 20.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org I rebased this one and made some other fixes so that I could test it, so I thought I'd repost it here in case it's helpful. I also added a new test. But for the testing it all looks ok. There is one small difference where it now hides _all_ default events, when previously it would only hide some selected subset of events like "stalled-cycles-frontend". I think this is now more consistent across platforms because, for example, Apple M only has cycles and instructions, and the rest of the default events would always show as there. Tested on Raptor Lake, Kaby Lake, Juno, N1, Ampere (with the DSU cycles PMU) and I also faked an Apple M on Juno. Changes since v8: * Fix rebase by adding NULL check before perf_pmu__is_fake() * Keep 'cycles' default event as non-skippable so permissions errors are shown Changes since v7: * Resolve conflicts and rebase onto perf-tools-next 1de5b5dcb835 * Fix build error by using the new perf_pmu__is_fake() Changes since v6: * Fix empty PMU name in perf report * Rebase onto perf-tools-next 003265bb6f02 Changes since v5: * Test on x86 non hybrid * Assume 1 PMU in the test when no PMUs expose /cpus file Changes since v4: * Hide all default events when not verbose * Remove previous note about behavior from the cover letter and replace it with a new note about the new behavior Changes since v3: * Rebase onto perf-tools-next 6236ebe07 * Fix Intel TPEBS counting mode test * Fix arm-spe build * Add support for DT devices in stat test * Add a new test for hybrid perf stat default arguments Ian Rogers (5): perf evsel: Add alternate_hw_config and use in evsel__match perf stat: Uniquify event name improvements perf stat: Remove evlist__add_default_attrs use strings perf evsel x86: Make evsel__has_perf_metrics work for legacy events perf evsel: Remove pmu_name James Clark (2): perf test: Make stat test work on DT devices perf test: Add a test for default perf stat command tools/perf/arch/arm64/util/arm-spe.c | 4 +- tools/perf/arch/x86/util/evlist.c | 74 +---- tools/perf/arch/x86/util/evsel.c | 35 ++- tools/perf/builtin-diff.c | 6 +- tools/perf/builtin-stat.c | 297 +++++++----------- tools/perf/tests/parse-events.c | 2 +- tools/perf/tests/shell/stat.sh | 37 ++- .../perf/tests/shell/test_stat_intel_tpebs.sh | 11 +- tools/perf/util/evlist.c | 46 +-- tools/perf/util/evlist.h | 12 - tools/perf/util/evsel.c | 28 +- tools/perf/util/evsel.h | 22 +- tools/perf/util/metricgroup.c | 4 +- tools/perf/util/parse-events.c | 60 ++-- tools/perf/util/parse-events.h | 8 +- tools/perf/util/parse-events.y | 2 +- tools/perf/util/pmu.c | 8 +- tools/perf/util/pmu.h | 3 +- tools/perf/util/stat-display.c | 109 +++++-- tools/perf/util/stat-shadow.c | 14 +- tools/perf/util/stat.c | 2 +- 21 files changed, 369 insertions(+), 415 deletions(-)