Re: [PATCH] perf print-events: make is_event_supported() more robust
From: Mark Rutland <mark.rutland@arm.com>
Date: 2024-01-26 14:36:28
Also in:
linux-perf-users, lkml
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:quoted
However, I'm seeing some slightly odd behaviours:
I believe that this is a separate issue; info dump below.
quoted
$ 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': <not supported> apple_firestorm_pmu/cycles:k/ <not supported> 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': | | <not counted> 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': | | <not supported> armv8_pmuv3_0/cycles:k/ | <not supported> 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': | | <not counted> 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/ | <not counted> 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/ | <not counted> 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 | <not counted> 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': | | <not supported> armv8_pmuv3_0/cycles/k | <not supported> 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 | <not counted> 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