Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp490653rdh; Thu, 23 Nov 2023 09:16:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+eLcAcsIk8Us2UXXN/VFokqlFZA8E6+jAk0iLSonGl5GjUGyLygEZfzMn3YWJ/yQetjIh X-Received: by 2002:a05:6a00:1ca6:b0:6cb:a60c:2143 with SMTP id y38-20020a056a001ca600b006cba60c2143mr140093pfw.9.1700759777836; Thu, 23 Nov 2023 09:16:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700759777; cv=none; d=google.com; s=arc-20160816; b=Z8HXI6doCUeKeVpE9OkNgNRicDgbkcSsikWde7hx+czfvqhtro2SESVQ2qV1V4iNIf CfDUEzNteeJnnh2HqUJInaZovD9lcd7EskNx/yL0Y1a6zdM76Lws7T6bnoNLNzgp1lyD 9XMRlVqeX9/lcOE2JF80LAWvFWdC34BRpabDN3b6TOErELQ3Lob1n0R6XTZXEfFCWkOu vDUFZjDhA9uh8nbFEDoqgMajZ0Xq8yyOmsHwFSP7/3awg4xklllhoG+Ia3d3LO1A5rvq S5mudDbnpI+pJsCfcK27hg+XaXmePBTbZSgYcmGfZCN9iqH4c1ZUATEXCm+3J77PdGwE UJnQ== 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=jJzT4fYCxgfPNBoIRrvBh0MX25m/yqcbT3Uk0rhDp88=; fh=WzNEGc0V0gvGIlnBCtNgawb/moKf1FtflEnN7RidYYE=; b=WDwlmAeMQmj3cyP+gY9Sk+sL18q5JEKsNO/HzO9s0mh/PrfW8rGVrGL+FF7rtY5pKL +w7PtCRjCwDVwrhagP6NMlsxTPta5AAlAiSsdMqwQQMhp34UItO8mZEMybMkc/spDxCW H0954/Pffaya8W7NgR0JwOGHNxdtETXnxhrY6GhlvZ1JqNOcnkCVKH/ws6dEA6W7UIV5 +SWWtienEMf80ZvMyokqIAi7s+IjkqJjPderm2IstfU95zUlDcDpep1BkpOGNPWVw5RL tytLUCWbMIlCNUBFmps3jvmqNmuHLX3GYMIqxJkoAwNrdRka8598aPqidkIJsplgWXJ0 yvHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id g22-20020a056a000b9600b006c4d43097b8si1621592pfj.328.2023.11.23.09.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 09:16:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 31D9D82909BF; Thu, 23 Nov 2023 09:16:01 -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 S1345172AbjKWRPh (ORCPT + 99 others); Thu, 23 Nov 2023 12:15:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229930AbjKWRPg (ORCPT ); Thu, 23 Nov 2023 12:15:36 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 93220D46; Thu, 23 Nov 2023 09:15:42 -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 C8A9B1042; Thu, 23 Nov 2023 09:16:28 -0800 (PST) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.26.148]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3B38C3F7A6; Thu, 23 Nov 2023 09:15:41 -0800 (PST) Date: Thu, 23 Nov 2023 17:15:33 +0000 From: Mark Rutland To: James Clark Cc: Ian Rogers , Marc Zyngier , Hector Martin , Arnaldo Carvalho de Melo , 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> <96fa7b1a-9f64-315b-c767-e582db55c7a4@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <96fa7b1a-9f64-315b-c767-e582db55c7a4@arm.com> 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]); Thu, 23 Nov 2023 09:16:01 -0800 (PST) On Thu, Nov 23, 2023 at 05:08:43PM +0000, James Clark wrote: > On 23/11/2023 16:48, Mark Rutland wrote: > > Ah, so IIUC what's happening is: > > > > 1) Userspace tries to detect extended type support, with a cycles event > > directed to one of the CPU PMUs. The attr for this does not have > > exclude_guest set. > > > > 2) In the kernel, the core perf code sees the extended hw type id, and directs > > this towards the correct PMU (apple_icestorm_pmu). > > > > 3) The PMU driver looks at the attr, sees exclude_guest is not set, and returns > > -EOPNOTSUPP, exactly as it would regardless of whether the extended hw type > > is used. > > > > Note: this happens to be a difference between x86 PMUs and the apple_* PMUs, > > but this is a legitimate part of the perf ABI, not an arm-specific quirk or > > bug. > > > > 4) Userspace receives -EOPNOTSUPP, and so decide the extended hw_type is not > > supported (even though the kernel does support the extended hw type id, and > > the event was rejected for orthogonal reasons). > > It sounds like we need to make (4) more robust? I'm not immediately sure how, > > given the rats nest of returns in perf_event_open(), but I'm happy to try to > > help with that. > > It might be worth reporting extended HW ID support in the caps folder of > the PMU so that Perf can look there instead of trying to open the event. > It's something that we know will always be on or always be off so it > doesn't make sense to try to discover it by opening an event. Yep, I'm open to that idea. I'm more than happy to expose something that indicates "this PMU supports the extended HW ID" and/or "this kernel supports the extended HW ID". Given that the actual PMU drivers don't see the extended cap, and that's handled by the core, I'd like to make the core logic unconditional and remove the kernel-internal PERF_PMU_CAP_EXTENDED_HW_TYPE cap. So I'd lean towards the "this kernel supports the extended HW ID" option. Thanks, Mark.