Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp391496rdh; Thu, 23 Nov 2023 06:47:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEF5reGgPOuuvwp++vaFD26rXsrMfSflDD63iDlCrPJzvlaAqqmyYeQSqtbrQXMTbPiMZtr X-Received: by 2002:a05:6808:18a:b0:3ae:3d0:d74a with SMTP id w10-20020a056808018a00b003ae03d0d74amr5696900oic.52.1700750856570; Thu, 23 Nov 2023 06:47:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700750856; cv=none; d=google.com; s=arc-20160816; b=orWTkmKCw9bw4XrUtYlRVvDKUHMMaE6/uK4qhgPZ/KZWSgKnaYeTqSBjrpyTXAl3LI GuZ+45o4vhsWkm/7WkW9qQB5Gl6gD6OrmGaatQTA0gS8CXLRNJHkeTaf5BkA+HtqWLx5 3cpLxngppv4YMVZTpKl+0QD48CxkqQIS81facdHboahNdEhmCRoDlHwnj03tBZ6a+fNT SgqVQzuL3r6LrArTvst+Eq8vgqM62uQ+FnssmRqZsKY4J4tR86/kdbASRyHmU2rAt1b6 i5f6C0Z/jlsBoJ2IeU0BGmCuYXgprREpcNPL0Jv+IKO2oiJotaNPl5gHwqY2qRhKEaKd W6cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=LPAJpq6uq4MJBhYvHC5HWTTTnvfUuLZmjo8sUf2dPs8=; fh=zoMhPievbhRGn8ycaABqLnHpFYLqFJ6NwrOkMb+n51Q=; b=N0kUVVLXv9oI2UT04Otr7r4minQ98fKOyG7UhxYbk80AP9mly6AUg6+6o7qBGwzSgy zMjgExqFKybej59Mz/QBf4V2vp2+BaOrrA1m/tQwjAgN8pp+SHvUCwiB69sAXjcTfhbD JbRRyjyq6+MMb0EZyIsZPd8HshC4HlccSonLnxVfyOPvt6tVcdV/F5z+uDhwZjApfaqf 7M/SAbF6HscCHR04toN2MkUimANydIyJkHlu92f3eW8l5RuFcVmhoE+IekrZ27VeVM2C lKy9uoNx8xct2HY24mdxjCWIXnuD/sNrycKc/Oqi7/syOceGQYz6qtJcrUZo/33ADAyM 0AYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ej3Rnqfe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id x7-20020a634847000000b005c2060c72fbsi1448072pgk.166.2023.11.23.06.47.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 06:47:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ej3Rnqfe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5AF43809C182; Thu, 23 Nov 2023 06:45:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345902AbjKWOpb (ORCPT + 99 others); Thu, 23 Nov 2023 09:45:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345889AbjKWOp1 (ORCPT ); Thu, 23 Nov 2023 09:45:27 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CCACD6E for ; Thu, 23 Nov 2023 06:45:34 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF182C433C7; Thu, 23 Nov 2023 14:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700750733; bh=bT1natgUHAV2pltSpzU6DgaFw0V6aahioLBO9kKzbsU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ej3RnqfeBl+f6bLnJjWWYFn8ddrzuIPVkK/wqbJHEIUT64Mw/R09gU/aY3IK8XdzP sFBL1uH4h61JolXRU0jNV78Yeq7NAVe+OrNll5cJbjYtK9FusW+jy3o7aNJblqA3Wp JbSodm8CqOHYWGzykCBg3snxLcW+JrQ7GUBt+Ev+QUqAFBo15KqQR0/R+H4hm9kNdb KFWUueEpA/otchr1rfHCEQSeaOFXamntLA10tQd9SdNW90FP3inMGOglgo1nHs1nBf bkeaTBPdOHGiP1kUaA/w8vy2wI/EKECRJp1zKqFX2VpBeqjBvbjRarXDcmWPL+hpOz R3f9L3LknuV4g== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1r6AxP-00Fnv3-Cw; Thu, 23 Nov 2023 14:45:31 +0000 Date: Thu, 23 Nov 2023 14:45:30 +0000 Message-ID: <86edggzfxx.wl-maz@kernel.org> From: Marc Zyngier To: Mark Rutland Cc: Hector Martin , Arnaldo Carvalho de Melo , Ian Rogers , James Clark , linux-perf-users@vger.kernel.org, LKML , Asahi Linux Subject: Re: [REGRESSION] Perf (userspace) broken on big.LITTLE systems since v6.5 In-Reply-To: References: <08f1f185-e259-4014-9ca4-6411d5c1bc65@marcan.st> <86pm03z0kw.wl-maz@kernel.org> <86o7fnyvrq.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: mark.rutland@arm.com, marcan@marcan.st, acme@redhat.com, irogers@google.com, james.clark@arm.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 23 Nov 2023 06:45:57 -0800 (PST) On Thu, 23 Nov 2023 14:23:10 +0000, Mark Rutland wrote: > > On Tue, Nov 21, 2023 at 03:24:25PM +0000, Marc Zyngier wrote: > > On Tue, 21 Nov 2023 13:40:31 +0000, > > Marc Zyngier wrote: > > > > > > [Adding key people on Cc] > > > > > > On Tue, 21 Nov 2023 12:08:48 +0000, > > > Hector Martin wrote: > > > > > > > > Perf broke on all Apple ARM64 systems (tested almost everything), and > > > > according to maz also on Juno (so, probably all big.LITTLE) since v6.5. > > > > > > I can confirm that at least on 6.7-rc2, perf is pretty busted on any > > > asymmetric ARM platform. It isn't clear what criteria is used to pick > > > the PMU, but nothing works anymore. > > > > > > The saving grace in my case is that Debian still ships a 6.1 perftool > > > package, but that's obviously not going to last. > > > > > > I'm happy to test potential fixes. > > > > At Mark's request, I've dumped a couple of perf (as of -rc2) runs with > > -vvv. And it is quite entertaining (this is taskset to an 'icestorm' > > CPU): > > Looking at this with fresh(er) eyes, I think there's a userspace bug here, > regardless of whether one believes it's correct to convert a named-pmu event to > a PERF_TYPE_HARDWARE event directed at that PMU. > > It looks like the userspace tool is dropping the extended type ID after an > initial probe, and requests events with plain PERF_TYPE_HARDWARE (without an > extended type ID), which explains why we seem to get events from one PMU only. > > More detail below... > > Marc, if you have time, could you run the same commands (on the same kernel) > with a perf tool build from v6.4? Here you go: $ sudo taskset -c 0 ./perf stat -vvv -e apple_icestorm_pmu/cycles/ -e apple_firestorm_pmu/cycles/ -e cycles ls >/dev/null Using CPUID 0x00000000610f0280 Attempting to add event pmu 'apple_icestorm_pmu' with 'cycles,' that may result in non-fatal errors After aliases, add event pmu 'apple_icestorm_pmu' with 'event,' that may result in non-fatal errors Attempting to add event pmu 'apple_firestorm_pmu' with 'cycles,' that may result in non-fatal errors After aliases, add event pmu 'apple_firestorm_pmu' with 'event,' that may result in non-fatal errors Control descriptor is not initialized ------------------------------------------------------------ perf_event_attr: type 10 size 136 config 0x2 sample_type IDENTIFIER read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING disabled 1 inherit 1 enable_on_exec 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid 1624462 cpu -1 group_fd -1 flags 0x8 = 3 ------------------------------------------------------------ perf_event_attr: type 11 size 136 config 0x2 sample_type IDENTIFIER read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING disabled 1 inherit 1 enable_on_exec 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid 1624462 cpu -1 group_fd -1 flags 0x8 = 4 ------------------------------------------------------------ perf_event_attr: size 136 sample_type IDENTIFIER read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING disabled 1 inherit 1 enable_on_exec 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid 1624462 cpu -1 group_fd -1 flags 0x8 = 5 apple_icestorm_pmu/cycles/: -1: 1492180 724333 724333 apple_firestorm_pmu/cycles/: -1: 0 724333 0 cycles: -1: 0 724333 0 apple_icestorm_pmu/cycles/: 1492180 724333 724333 apple_firestorm_pmu/cycles/: 0 724333 0 cycles: 0 724333 0 Performance counter stats for 'ls': 1,492,180 apple_icestorm_pmu/cycles/ apple_firestorm_pmu/cycles/ (0.00%) cycles (0.00%) 0.000001917 seconds time elapsed 0.000000000 seconds user 0.000000000 seconds sys and on the other cluster: $ sudo taskset -c 2 ./perf stat -vvv -e apple_icestorm_pmu/cycles/ -e apple_firestorm_pmu/cycles/ -e cycles ls >/dev/null Using CPUID 0x00000000610f0280 Attempting to add event pmu 'apple_icestorm_pmu' with 'cycles,' that may result in non-fatal errors After aliases, add event pmu 'apple_icestorm_pmu' with 'event,' that may result in non-fatal errors Attempting to add event pmu 'apple_firestorm_pmu' with 'cycles,' that may result in non-fatal errors After aliases, add event pmu 'apple_firestorm_pmu' with 'event,' that may result in non-fatal errors Control descriptor is not initialized ------------------------------------------------------------ perf_event_attr: type 10 size 136 config 0x2 sample_type IDENTIFIER read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING disabled 1 inherit 1 enable_on_exec 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid 1624466 cpu -1 group_fd -1 flags 0x8 = 3 ------------------------------------------------------------ perf_event_attr: type 11 size 136 config 0x2 sample_type IDENTIFIER read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING disabled 1 inherit 1 enable_on_exec 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid 1624466 cpu -1 group_fd -1 flags 0x8 = 4 ------------------------------------------------------------ perf_event_attr: size 136 sample_type IDENTIFIER read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING disabled 1 inherit 1 enable_on_exec 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid 1624466 cpu -1 group_fd -1 flags 0x8 = 5 apple_icestorm_pmu/cycles/: -1: 0 593209 0 apple_firestorm_pmu/cycles/: -1: 1038247 593209 593209 cycles: -1: 1037870 593209 593209 apple_icestorm_pmu/cycles/: 0 593209 0 apple_firestorm_pmu/cycles/: 1038247 593209 593209 cycles: 1037870 593209 593209 Performance counter stats for 'ls': apple_icestorm_pmu/cycles/ (0.00%) 1,038,247 apple_firestorm_pmu/cycles/ 1,037,870 cycles 0.000001500 seconds time elapsed 0.000000000 seconds user 0.000000000 seconds sys For the record, this is on a 6.6-rc6 kernel, userspace perf as of v6.4.0. M. -- Without deviation from the norm, progress is not possible.