Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp474210rdf; Tue, 21 Nov 2023 07:40:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtP7hiRfQ8x9i2dZL/VVT4e9RpfvCRyrxVyV5/37eY6HRB5WTqzcXaH52VXYPNsVLHudUe X-Received: by 2002:a05:6a00:ad1:b0:68f:b5cb:ced0 with SMTP id c17-20020a056a000ad100b0068fb5cbced0mr14085153pfl.34.1700581241715; Tue, 21 Nov 2023 07:40:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700581241; cv=none; d=google.com; s=arc-20160816; b=Eep2q5QLG+02uyL5aPTVWQzWYTukS29UOzBh3T7bsRi8vaXGiMCT9Q/knykzrnH0tP +xpIWNC4gEaC0hyQeLD6Z1Y357Zwyi6xMahUx1MOGht/PIzEavIyu76Lc9I+NUmrZ3Fl 5QbmAB/h8XeOU91syi6PxekSvG5cuvarZuT6qLAdIdXmVK97xDzfUOE+W/Gx7ISLmmOo oU4Yi7uV6EQ7TZ2yTRlb+wTuWnY1TdL3j1d9xTPAouT5G8R+tUHFUDf2G/K8luONfvSh kQ64qPXW4rM17evD4B0utVuqYqQB2UaPYbVjHGK2HHbLdnlZ/AnBaRuofuaEpqbmxY8e 6pAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=FYifsbSd1UEEy/onHoE+znK9haji7ZNApo9bDFjZ+tI=; fh=HDuNbNAgBgkCJnKT+yBslPArmOxTJcBC7g78cZZ07H4=; b=gljyrMteKxmuR+gcWCT1EYp0rBWQNiADCfGbQ0fc0TyZYv/46C+XTG9IgvBGDKqgi0 nCEyE+PrpqmccXmHRWcCDzn34N+eEyFeLdrb1HXEkR3B0eCFx06oABXEFXP5VfBqT5k4 6g6cr5aNRgeBj3AS68bOEACIOnlxyOI+sbbEeq2KNvuA4UbJ4bFxU5qIJbTeezPDRX6o 8WVeOVhdzkVmI1D5XX3Hr1gx8Uz5iVu7y/64QavxG4vVmJUaSoI9WMWVburWWrveJyG9 ziONAmGEaNlWhyBm2yM/+ff4iv3eZNOS8SWiwCl3tJ7wKHIAFF1U4DeNwuMk2btRGAsx 69jg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id o11-20020a056a0015cb00b0068a557febfcsi10642923pfu.111.2023.11.21.07.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 07:40:41 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id DF3EB802E83F; Tue, 21 Nov 2023 07:40:37 -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 S234390AbjKUPkN (ORCPT + 99 others); Tue, 21 Nov 2023 10:40:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230307AbjKUPkL (ORCPT ); Tue, 21 Nov 2023 10:40:11 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB8B612F; Tue, 21 Nov 2023 07:40:06 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 74D6FFEC; Tue, 21 Nov 2023 07:40:53 -0800 (PST) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.34.196]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 882C33F7A6; Tue, 21 Nov 2023 07:40:05 -0800 (PST) Date: Tue, 21 Nov 2023 15:40:02 +0000 From: Mark Rutland To: Marc Zyngier 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 Message-ID: References: <08f1f185-e259-4014-9ca4-6411d5c1bc65@marcan.st> <86pm03z0kw.wl-maz@kernel.org> <86o7fnyvrq.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86o7fnyvrq.wl-maz@kernel.org> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, 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]); Tue, 21 Nov 2023 07:40:38 -0800 (PST) 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): IIUC the tool is doing the wrong thing here and overriding explicit ${pmu}/${event}/ events with PERF_TYPE_HARDWARE events rather than events using that ${pmu}'s type and event namespace. Regardless of the *new* ABI that allows PERF_TYPE_HARDWARE events to be targetted to a specific PMU, it's semantically wrong to rewrite events like this since ${pmu}/${event}/ is not necessarily equivalent to a similarly-named PERF_COUNT_HW_${EVENT}. Mark. > > 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.