From mboxrd@z Thu Jan 1 00:00:00 1970 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 3500FC47422 for ; Fri, 26 Jan 2024 14:36:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xWGYWsc4IUxzY6tLLXOFyyCmqfCto1TNS5FarticWVE=; b=mmtWN01x6RX5EX Dzkx1Eu4xEAiRfRbwCt7VYnV4A+ln6dw1ICYH7hbl1TencnEEAYdrSn/6bWcV/1itBPqxZZc9M8lA zIgLnLH7zC0CM/yI1ILV2HMGlu4UkAevYRB+Y9izvfIU6phYRSN9cqn+o+aAlMNR7XBq2JzOpiws6 GYH08OscLiAXSE1kNgdfnvB4s0T2aNdIDSH4/55Ic8VabTVyDyBMJ+XyaaEkspEuSZeSehhrYIx1g 0dwvQqhRC925Axe2tu+OIQj1C4G5Pr/RbCClKuzwUBp/Ty/XxfTb760//HxqHhfB9+tB2hiUYdjHt 4ecVsqejR/V5hJf1zkkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTNJp-00000004Md0-2ivl; Fri, 26 Jan 2024 14:36:33 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTNJn-00000004Mc4-13V3 for linux-arm-kernel@lists.infradead.org; Fri, 26 Jan 2024 14:36:32 +0000 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 4205D1FB; Fri, 26 Jan 2024 06:37:12 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.47.163]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 644823F73F; Fri, 26 Jan 2024 06:36:25 -0800 (PST) Date: Fri, 26 Jan 2024 14:36:16 +0000 From: Mark Rutland To: Marc Zyngier Cc: linux-kernel@vger.kernel.org, Hector Martin , Ian Rogers , acme@redhat.com, james.clark@arm.com, john.g.garry@oracle.com, leo.yan@linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, mike.leach@linaro.org, namhyung@kernel.org, suzuki.poulose@arm.com, tmricht@linux.ibm.com, will@kernel.org Subject: Re: [PATCH] perf print-events: make is_event_supported() more robust Message-ID: References: <20240116170348.463479-1-mark.rutland@arm.com> <8734uwxrca.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240126_063631_469644_E9AA41AF X-CRM114-Status: GOOD ( 14.62 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jan 17, 2024 at 12:12:05PM +0000, Mark Rutland wrote: > On Wed, Jan 17, 2024 at 09:05:25AM +0000, Marc Zyngier wrote: > > However, I'm seeing some slightly odd behaviours: I believe that this is a separate issue; info dump below. > > $ sudo ./perf stat -e cycles:k ~/hackbench 100 process 1000 > > Running with 100*40 (== 4000) tasks. > > Time: 3.313 > > > > Performance counter stats for '/home/maz/hackbench 100 process 1000': > > > > apple_firestorm_pmu/cycles:k/ > > apple_icestorm_pmu/cycles:k/ > > > > 3.467568841 seconds time elapsed > > > > 13.080111000 seconds user > > 53.162099000 seconds sys > > > > I would have expected it to count, but it didn't. For that to work, I > > have to add the 'H' modifier: I gave that a spin with the aforementioned hacked-up PMUv3 driver, and I see the same: | # ./perf-after stat -e cycles true | | Performance counter stats for 'true': | | armv8_pmuv3_0/cycles/ (0.00%) | 1375271 armv8_pmuv3_1/cycles/ | | 0.001153070 seconds time elapsed | | 0.001204000 seconds user | 0.000000000 seconds sys | | | # ./perf-after stat -e cycles:k true | | Performance counter stats for 'true': | | armv8_pmuv3_0/cycles:k/ | armv8_pmuv3_1/cycles:k/ | | 0.000983130 seconds time elapsed | | 0.001037000 seconds user | 0.000000000 seconds sys | | | # ./perf-after stat -e cycles:kH true | | Performance counter stats for 'true': | | armv8_pmuv3_0/cycles:kH/ (0.00%) | 932067 armv8_pmuv3_1/cycles:kH/ | | 0.001090100 seconds time elapsed | | 0.001125000 seconds user | 0.000000000 seconds sys ... though interestingly 'cycles:u' works: | # ./perf-after stat -e cycles:u true | | Performance counter stats for 'true': | | 369753 armv8_pmuv3_0/cycles:u/ | armv8_pmuv3_1/cycles:u/ (0.00%) | | 0.001171980 seconds time elapsed | | 0.001245000 seconds user | 0.000000000 seconds sys Looking at the output with '-vvv' the perf tool implicitly sets exclude_guest for 'cycles', 'cycles:u', and 'cycles:kH', but does not set exclude_guest for 'cycles:k'. It looks like that's consistent with the behaviour of opening separate events prior to this patch: | # ./perf-before stat -e armv8_pmuv3_0/cycles/ -e armv8_pmuv3_1/cycles/ true | | Performance counter stats for 'true': | | 1407624 armv8_pmuv3_0/cycles/ | armv8_pmuv3_1/cycles/ (0.00%) | | 0.001179205 seconds time elapsed | | 0.001217000 seconds user | 0.000000000 seconds sys | | | # ./perf-before stat -e armv8_pmuv3_0/cycles/u -e armv8_pmuv3_1/cycles/u true | | Performance counter stats for 'true': | | 329212 armv8_pmuv3_0/cycles/u | armv8_pmuv3_1/cycles/u (0.00%) | | 0.001050550 seconds time elapsed | | 0.001081000 seconds user | 0.000000000 seconds sys | | | # ./perf-before stat -e armv8_pmuv3_0/cycles/k -e armv8_pmuv3_1/cycles/k true | | Performance counter stats for 'true': | | armv8_pmuv3_0/cycles/k | armv8_pmuv3_1/cycles/k | | 0.000944285 seconds time elapsed | | 0.000985000 seconds user | 0.000000000 seconds sys | | | # ./perf-before stat -e armv8_pmuv3_0/cycles/kH -e armv8_pmuv3_1/cycles/kH true | | Performance counter stats for 'true': | | 1016160 armv8_pmuv3_0/cycles/kH | armv8_pmuv3_1/cycles/kH (0.00%) | | 0.001179220 seconds time elapsed | | 0.001239000 seconds user | 0.000000000 seconds sys ... and per '-vvv', exclude_guest is set in the same cases. I agree it's a bit weird that the tool sets exclude_guest for unfilted and ':u' events, but not ':k' events, but it looks like that's separate from the way events get expanded. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel