Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp464164rdf; Tue, 21 Nov 2023 07:26:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMWZkAfzdfWn0tniwvrUG/Xnxk7p/sgxjcA+0V5ETxs1kwajUVf00FQafvX4UI4cQtHAyd X-Received: by 2002:a05:6a20:12c4:b0:187:9f15:bfd1 with SMTP id v4-20020a056a2012c400b001879f15bfd1mr11692333pzg.38.1700580383749; Tue, 21 Nov 2023 07:26:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700580383; cv=none; d=google.com; s=arc-20160816; b=AVKOU7Ehy38S0z+twYzXVEc8B8c9ZQfVa2S0qP+nUdZVT4Z/havV4SBGVny7Ra+BV9 +6yA7LfcSy3WMUhu6Twqvn8QvLK/VKQB+LYlX/GPTrBmvhAOTB1xSCtz/T8kW9GV/I3e +SSrTJ356L+W9xEHDNJULl08WVPjSM6sNogO164MtQVz+0HgI4VogQ0UObe0nb61Xdpy pM0lDveVQcW7P0DNOT4zyAFHkY6e9S4VUVC9ql/6HtPMZKNkDJljWhWxPZX54fqkE8od jOWc4ZJiWfMlPH/w4Ye4lU7Zfibpfv7rTxCj/pQv00hjqfKD+zUrIbscWNiL/2zAoV3C 4IHg== 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=q/N3wPJuLallRCqX5NFCNUjsFLyzQGh9SyFAmv7JorA=; fh=xzKSM8g4vf5c1PRcR3sDy91O8C0wj3g+fbnP/YxmrBY=; b=X9SXekTBPqDsVuzLMYdzMKeA8SIY1UUVS8sEtaPtISiV8LJvkMGthCHtMuJdaCZP/D 941vhNSv9g6Qrt8IJXt7rkfGB05Bj+g99Hgmj0vrQWtf0/IVW2pCqF22FAbnkSCCxTdB IPjCmB181EG+/UG3+WOLNrrwJSmoo7S25vl1RFeC3sC7y/KY8YpmqyO+PznktwY5aGpL D6Hr9h9yQ5nGTEWFXm64w/WFIz6H22b/j9klG95Cap2jWKsJONYM8u4GIgYYQu9uoiV2 zbP1FwNRP2EU8kMYcMhISEoIZrY4jLq/bfaGQzZCZd2SZmfHpLLIV5cclnAINdrm2RMC kFBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZMyfE2Px; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id j21-20020a635515000000b005b8ddb9c305si9956452pgb.30.2023.11.21.07.26.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 07:26:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZMyfE2Px; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 73D6A80C2540; Tue, 21 Nov 2023 07:25:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234274AbjKUPYf (ORCPT + 99 others); Tue, 21 Nov 2023 10:24:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234308AbjKUPYd (ORCPT ); Tue, 21 Nov 2023 10:24:33 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3242C100 for ; Tue, 21 Nov 2023 07:24:29 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7702C433C8; Tue, 21 Nov 2023 15:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700580268; bh=FHSRXrO0Yfw9vDw/yW+guLOeuDCv8w0Xl7JslG6as/0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ZMyfE2PxSBMM9cAAljWOoj5yQKmfYy9Ff6/Nd4h2FPRcK+UgiEEIrYRfQnY0xf/KT A8Y7/Iys9utpmrEa4cUvnvdgLz/qOgH8Ju6qO3ubwiRaT0XUU5Fmn6W5WQKcZoMHTS ZDpuWdwTzAuFCs7ooisFN66GHv9s2oVj03ySlpYbNdwn+n/2UwkEIkjNNs1yv5HDhv aS9WK1NNcAl4ICEIdDwALs4t7QauDTn+DJ4HX09pYL6Gd+lwW5z+9fLuGFMYHlA5/o n0YJgkR24pEuau76rf4Q2Q53yh1gVp35nDkjtixX+nm71GIJ7BbIYOD9vn2I3fEz0m RHyeWEFupwnNQ== 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 1r5Sby-00F8Q5-7L; Tue, 21 Nov 2023 15:24:26 +0000 Date: Tue, 21 Nov 2023 15:24:25 +0000 Message-ID: <86o7fnyvrq.wl-maz@kernel.org> From: Marc Zyngier To: Mark Rutland , Hector Martin , Arnaldo Carvalho de Melo , Ian Rogers , James Clark Cc: 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: <86pm03z0kw.wl-maz@kernel.org> References: <08f1f185-e259-4014-9ca4-6411d5c1bc65@marcan.st> <86pm03z0kw.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.2 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 groat.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 (groat.vger.email [0.0.0.0]); Tue, 21 Nov 2023 07:25:11 -0800 (PST) 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): maz@valley-girl:~/hot-poop/arm-platforms/tools/perf$ sudo taskset -c 0 ./perf stat -vvv -e apple_icestorm_pmu/cycles/ -e apple_firestorm_pmu/cycles/ -e cycles ls Using CPUID 0x00000000612f0280 Attempt to add: apple_icestorm_pmu/cycles=0/ ..after resolving event: apple_icestorm_pmu/cycles=0/ Opening: unknown-hardware:HG ------------------------------------------------------------ perf_event_attr: type 0 (PERF_TYPE_HARDWARE) config 0xb00000000 disabled 1 ------------------------------------------------------------ sys_perf_event_open: pid 0 cpu -1 group_fd -1 flags 0x8 sys_perf_event_open failed, error -95 Attempt to add: apple_firestorm_pmu/cycles=0/ ..after resolving event: apple_firestorm_pmu/cycles=0/ Control descriptor is not initialized Opening: apple_icestorm_pmu/cycles/ ------------------------------------------------------------ perf_event_attr: type 0 (PERF_TYPE_HARDWARE) size 136 config 0 (PERF_COUNT_HW_CPU_CYCLES) 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 1045843 cpu -1 group_fd -1 flags 0x8 = 3 Opening: apple_firestorm_pmu/cycles/ ------------------------------------------------------------ perf_event_attr: type 0 (PERF_TYPE_HARDWARE) size 136 config 0 (PERF_COUNT_HW_CPU_CYCLES) 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 1045843 cpu -1 group_fd -1 flags 0x8 = 4 Opening: cycles ------------------------------------------------------------ perf_event_attr: type 0 (PERF_TYPE_HARDWARE) size 136 config 0 (PERF_COUNT_HW_CPU_CYCLES) 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 1045843 cpu -1 group_fd -1 flags 0x8 = 5 arch builtin-diff.o builtin-mem.o common-cmds.h perf-completion.sh bench builtin-evlist.c builtin-probe.c CREDITS perf.h Build builtin-evlist.o builtin-probe.o design.txt perf-in.o builtin-annotate.c builtin-ftrace.c builtin-record.c dlfilters perf-iostat builtin-annotate.o builtin-ftrace.o builtin-record.o Documentation perf-iostat.sh builtin-bench.c builtin.h builtin-report.c FEATURE-DUMP perf.o builtin-bench.o builtin-help.c builtin-report.o include perf-read-vdso.c builtin-buildid-cache.c builtin-help.o builtin-sched.c jvmti perf-sys.h builtin-buildid-cache.o builtin-inject.c builtin-script.c libapi PERF-VERSION-FILE builtin-buildid-list.c builtin-inject.o builtin-script.o libperf perf-with-kcore builtin-buildid-list.o builtin-kallsyms.c builtin-stat.c libsubcmd pmu-events builtin-c2c.c builtin-kallsyms.o builtin-stat.o libsymbol python builtin-c2c.o builtin-kmem.c builtin-timechart.c Makefile python_ext_build builtin-config.c builtin-kvm.c builtin-top.c Makefile.config scripts builtin-config.o builtin-kvm.o builtin-top.o Makefile.perf tests builtin-daemon.c builtin-kwork.c builtin-trace.c MANIFEST trace builtin-daemon.o builtin-list.c builtin-version.c perf ui builtin-data.c builtin-list.o builtin-version.o perf-archive util builtin-data.o builtin-lock.c check-headers.sh perf-archive.sh builtin-diff.c builtin-mem.c command-list.txt perf.c apple_icestorm_pmu/cycles/: -1: 0 873709 0 apple_firestorm_pmu/cycles/: -1: 0 873709 0 cycles: -1: 0 873709 0 apple_icestorm_pmu/cycles/: 0 873709 0 apple_firestorm_pmu/cycles/: 0 873709 0 cycles: 0 873709 0 Performance counter stats for 'ls': apple_icestorm_pmu/cycles/ (0.00%) apple_firestorm_pmu/cycles/ (0.00%) cycles (0.00%) 0.000002250 seconds time elapsed 0.000000000 seconds user 0.000000000 seconds sys If I run the same thing on another CPU cluster (firestorm), I get this: maz@valley-girl:~/hot-poop/arm-platforms/tools/perf$ sudo taskset -c 2 ./perf stat -vvv -e apple_icestorm_pmu/cycles/ -e apple_firestorm_pmu/cycles/ -e cycles ls Using CPUID 0x00000000612f0280 Attempt to add: apple_icestorm_pmu/cycles=0/ ..after resolving event: apple_icestorm_pmu/cycles=0/ Opening: unknown-hardware:HG ------------------------------------------------------------ perf_event_attr: type 0 (PERF_TYPE_HARDWARE) config 0xb00000000 disabled 1 ------------------------------------------------------------ sys_perf_event_open: pid 0 cpu -1 group_fd -1 flags 0x8 sys_perf_event_open failed, error -95 Attempt to add: apple_firestorm_pmu/cycles=0/ ..after resolving event: apple_firestorm_pmu/cycles=0/ Control descriptor is not initialized Opening: apple_icestorm_pmu/cycles/ ------------------------------------------------------------ perf_event_attr: type 0 (PERF_TYPE_HARDWARE) size 136 config 0 (PERF_COUNT_HW_CPU_CYCLES) 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 1045925 cpu -1 group_fd -1 flags 0x8 = 3 Opening: apple_firestorm_pmu/cycles/ ------------------------------------------------------------ perf_event_attr: type 0 (PERF_TYPE_HARDWARE) size 136 config 0 (PERF_COUNT_HW_CPU_CYCLES) 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 1045925 cpu -1 group_fd -1 flags 0x8 = 4 Opening: cycles ------------------------------------------------------------ perf_event_attr: type 0 (PERF_TYPE_HARDWARE) size 136 config 0 (PERF_COUNT_HW_CPU_CYCLES) 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 1045925 cpu -1 group_fd -1 flags 0x8 = 5 arch builtin-diff.o builtin-mem.o common-cmds.h perf-completion.sh bench builtin-evlist.c builtin-probe.c CREDITS perf.h Build builtin-evlist.o builtin-probe.o design.txt perf-in.o builtin-annotate.c builtin-ftrace.c builtin-record.c dlfilters perf-iostat builtin-annotate.o builtin-ftrace.o builtin-record.o Documentation perf-iostat.sh builtin-bench.c builtin.h builtin-report.c FEATURE-DUMP perf.o builtin-bench.o builtin-help.c builtin-report.o include perf-read-vdso.c builtin-buildid-cache.c builtin-help.o builtin-sched.c jvmti perf-sys.h builtin-buildid-cache.o builtin-inject.c builtin-script.c libapi PERF-VERSION-FILE builtin-buildid-list.c builtin-inject.o builtin-script.o libperf perf-with-kcore builtin-buildid-list.o builtin-kallsyms.c builtin-stat.c libsubcmd pmu-events builtin-c2c.c builtin-kallsyms.o builtin-stat.o libsymbol python builtin-c2c.o builtin-kmem.c builtin-timechart.c Makefile python_ext_build builtin-config.c builtin-kvm.c builtin-top.c Makefile.config scripts builtin-config.o builtin-kvm.o builtin-top.o Makefile.perf tests builtin-daemon.c builtin-kwork.c builtin-trace.c MANIFEST trace builtin-daemon.o builtin-list.c builtin-version.c perf ui builtin-data.c builtin-list.o builtin-version.o perf-archive util builtin-data.o builtin-lock.c check-headers.sh perf-archive.sh builtin-diff.c builtin-mem.c command-list.txt perf.c apple_icestorm_pmu/cycles/: -1: 1035101 469125 469125 apple_firestorm_pmu/cycles/: -1: 1035035 469125 469125 cycles: -1: 1034653 469125 469125 apple_icestorm_pmu/cycles/: 1035101 469125 469125 apple_firestorm_pmu/cycles/: 1035035 469125 469125 cycles: 1034653 469125 469125 Performance counter stats for 'ls': 1,035,101 apple_icestorm_pmu/cycles/ 1,035,035 apple_firestorm_pmu/cycles/ 1,034,653 cycles 0.000001333 seconds time elapsed 0.000000000 seconds user 0.000000000 seconds sys which doesn't make any sense either. I really don't understand what this PERF_TYPE_HARDWARE does here (the *real* types are 10 and 11), nor what this 'cycle=0' stuff is. /puzzled M. -- Without deviation from the norm, progress is not possible.