Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp432469lqp; Wed, 12 Jun 2024 06:13:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVu70w4p9LSySdpmtmnZlNTakVf6VfqE5WYIVjBQ8x7zccXvm7UxZthi73N6uPUFAZeCdgrl7GUuHODFuK5JbfIPvofz1pnRQoe0pcrQA== X-Google-Smtp-Source: AGHT+IEttIJRpehML0SfX9cFbsqA4mOyIqzvhVU4YJ65Nj5FZW5JpDtmPJ/fEg1aVe/EZew5MGDK X-Received: by 2002:a17:90a:ac16:b0:2c3:cc6:636e with SMTP id 98e67ed59e1d1-2c4a76018e7mr1745595a91.2.1718198036624; Wed, 12 Jun 2024 06:13:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718198036; cv=pass; d=google.com; s=arc-20160816; b=03sgj96fSRcaI8LuiECzVbI3oQY+Nrfej9OeZZ+k5qnl3urbUo3HHRstXidzR+7uZe iU23VPqTOH8BkPetjpIN2DaQUtKPHJioDi/WmEEmoqipVfEI6rIuBitzBiSenxOg3GKh hGdLVtrdcyt3x1GaXuz28gTlApZa85mb3KSfBludHPGAvMnVqvl857nIcx2meDVFBKEx d7/hO5vMd4viFBN07UCYQPt5yyWUP1HJJD4vGPIhPTDSs2BtjojOxiknXvjYVohTydNX 16CP8vbv/+99wOVK/fmckN6DSfWQ87Xp8q6YOrNO02iVVkSPAVcKxFEWWy/+5lD9x9OB /B2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=Cy5J9QzsFxsCZZ1lLK1U4uOTzBsrk6pxCNaYMRpkk98=; fh=f9lhM1pJcTZhWu7LiWU+hZWWsU/jusJXcNyNAo94mxw=; b=Aa34Hq1tQhvu4y2B9YkNHqBVuAoVii+htbPN+xz0Xs8evLIwVaaDGHqVaGN8Gr6C8x NC8BrRXBQq3/SjF+N9tB6i/BBbzkhjgRA/mL5D7rWoF2QONz67JnKV3I0T+UzqLTgR9G O03mTNZ7H0B2CnyXj2/gpEcj1Q7Y0VTtbLywYt3Bis7uXTTjPE/6Af645XU26L1sM/Ko quCymetIefCDL+bA18OKpjjTeBN3sdNccU8dx2OWo223tsvkkAO3z5LcQVgWInZBfHkf op7T8lLvSL+A+QJOPlqw4IFIscHk/DXobNVNIrp0Diha+colKu8klQsZHReN6xzvS2/4 hDvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-211540-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211540-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e7aea976desi8322457a12.257.2024.06.12.06.13.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 06:13:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211540-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-211540-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211540-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1C75EB23073 for ; Wed, 12 Jun 2024 13:13:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 245AB17A930; Wed, 12 Jun 2024 13:12:55 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6D071D54B; Wed, 12 Jun 2024 13:12:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718197974; cv=none; b=l88rF2rvGnTxMfWtFdx7sEh8+TfOLNQpip7dB4n6npjgqsz1D8QeJSd0kCwxLQIRQskcd4Kn2W1todUo8vyDr7x5W1Bu2wdes4671jYPAmGeEUAcnvdp+u4TzQfXMhqzMGFAVGSLBpfG6ZyTsAari0wPKgjABYxghHiFNKCKOQI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718197974; c=relaxed/simple; bh=ekNK4exzHp7lebJSpQMmW+/s1FCkhYSD5M/Z+yOzaW8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=oxGXbUmz0ljMqA6hRHZrNJ+mKX5/r10tFFMrLyfxQXirVqbn+3LyNsEevdgCtv4Rlm87Lpd9ua0NH+t6Vl5YeUrW+N3MYw4W2SzGD+aScjhZO9avYyM5sm/O5doNs409br0tSbZVIGovCFPLinpov0OB+nIhnwLWn5FJQGAEBPo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 B88771595; Wed, 12 Jun 2024 06:13:16 -0700 (PDT) Received: from [192.168.1.100] (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 69C143F64C; Wed, 12 Jun 2024 06:12:49 -0700 (PDT) Message-ID: <27bd8527-4dfb-4078-8027-211dec1bc007@arm.com> Date: Wed, 12 Jun 2024 14:12:37 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 1/2] perf pmus: Sort/merge/aggregate PMUs like mrvl_ddr_pmu To: Ian Rogers , Aishwarya TCV Cc: Tuan Phan , Robin Murphy , Thomas Richter , Bhaskara Budiredla , Bharat Bhushan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Kan Liang , Ravi Bangoria , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Will Deacon , Stephane Eranian , Mark Brown , Naresh Kamboju References: <20240515060114.3268149-1-irogers@google.com> <20240515060114.3268149-2-irogers@google.com> Content-Language: en-US From: James Clark In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 12/06/2024 13:32, Ian Rogers wrote: > On Wed, Jun 12, 2024 at 4:19 AM Aishwarya TCV wrote: >> >> >> >> On 15/05/2024 07:01, Ian Rogers wrote: >>> The mrvl_ddr_pmu is uncore and has a hexadecimal address suffix while >>> the previous PMU sorting/merging code assumes uncore PMU names start >>> with uncore_ and have a decimal suffix. Because of the previous >>> assumption it isn't possible to wildcard the mrvl_ddr_pmu. >>> >>> Modify pmu_name_len_no_suffix but also remove the suffix number out >>> argument, this is because we don't know if a suffix number of say 100 >>> is in hexadecimal or decimal. As the only use of the suffix number is >>> in comparisons, it is safe there to compare the values as hexadecimal. >>> Modify perf_pmu__match_ignoring_suffix so that hexadecimal suffixes >>> are ignored. >>> >>> Only allow hexadecimal suffixes to be greater than length 2 (ie 3 or >>> more) so that S390's cpum_cf PMU doesn't lose its suffix. >>> >>> Change the return type of pmu_name_len_no_suffix to size_t to >>> workaround GCC incorrectly determining the result could be negative. >>> >>> Signed-off-by: Ian Rogers >>> --- >>> tools/perf/util/pmu.c | 33 +++++++++++++-------- >>> tools/perf/util/pmus.c | 67 ++++++++++++++++++++++++------------------ >>> tools/perf/util/pmus.h | 7 ++++- >>> 3 files changed, 65 insertions(+), 42 deletions(-) >>> >> >> Hi Ian, >> >> Perf test "perf_all_PMU_test" is failing when run against >> next-master(next-20240612) kernel with Arm64 on JUNO in our CI. It looks >> like it is failing when run on JUNO alone. Verified by running on other >> boards like RB5 and Ampere_altra and confirming that it does not fail on >> these boards. Suspecting that the suffixed 'armv8_pmuv3_0' naming could >> be the reason of test failure. >> >> Reverting the change (3241d46f5f54) seems to fix it. >> >> This works fine on Linux version v6.10-rc3 >> >> Failure log >> ------------ >> 110: perf all PMU test: >> --- start --- >> test child forked, pid 8279 >> Testing armv8_pmuv3/br_immed_retired/ >> Event 'armv8_pmuv3/br_immed_retired/' not printed in: >> # Running 'internals/synthesize' benchmark: >> Computing performance of single threaded perf event synthesis by >> synthesizing events on the perf process itself: >> Average synthesis took: 1169.431 usec (+- 0.144 usec) >> Average num. events: 35.000 (+- 0.000) >> Average time per event 33.412 usec >> Average data synthesis took: 1225.698 usec (+- 0.102 usec) >> Average num. events: 119.000 (+- 0.000) >> Average time per event 10.300 usec >> >> Performance counter stats for 'perf bench internals synthesize': >> >> 3263664785 armv8_pmuv3_0/br_immed_retired/ >> >> >> 25.472854464 seconds time elapsed >> >> 8.004791000 seconds user >> 17.060209000 seconds sys >> ---- end(-1) ---- >> 110: perf all PMU test : >> FAILED! > > Hi Aishwarya, > > Thanks for reporting an issue. The test should be pretty self > explanatory: it is doing a `perf stat -e > armv8_pmuv3/br_immed_retired/` and then looking for that in the > output. The event armv8_pmuv3/br_immed_retired/ comes from running > perf list. As you can see in the output the event did work, so perf > stat is working so nothing is actually broken here. What isn't working > is the perf stat output matching the command line event and this is > because of the unnecessary suffix on ARM's PMU name. > > We have a problem that ARM have buggy PMU drivers, either from > introducing new naming conventions or by just being broken: > https://lore.kernel.org/lkml/CAP-5=fWNDkOpnYF=5v1aQkVDrDWsmw+zYX1pjS8hoiYVgZsRGA@mail.gmail.com/ > I've also asked that ARM step up their testing, for example in the > event parsing testing the PMU is hardcoded to the x86 PMU name of > 'cpu': > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/tests/parse-events.c?h=perf-tools-next#n2317 > On a cortex A53, then PMU is named 'armv8_cortex_a53': > ``` > $ ls /sys/devices/armv8_cortex_a53/ > caps cpus events format perf_event_mux_interval_ms power > subsystem type uevent > ``` > This name appears better, so what's up with ARM's core PMU name? > Anyway, I'm tempted to fix this by just skipping the test on ARM given > ARM's overall broken state. > No need to skip the test, I'll take this one [1]. I think we're on the same page that it's probably a test or cosmetic issue rather than anything being broken in Perf. [1]: https://lore.kernel.org/linux-perf-users/8112b2bf-3950-4889-96bf-2317fbfb4bee@arm.com/ > Further, can we escalate matters? It isn't right that these ARM issues > are coming back to me. ARM aren't stepping up to fix not just the 2 I wouldn't read into it too much, I think this is just a courtesy email pointing out that we're aware of an issue and tracked it back to a particular commit. I don't think there is any expectation that it has to be you that makes the fix and I'm happy to look into it. > issues above but: > 1) the broken Apple M? issue (ARM asked I fix this as it regressed due > to my fixes for the Intel hybrid code): > https://lore.kernel.org/lkml/20240525152927.665498-1-irogers@google.com/ > 2) opening events on BIG.little doesn't open the event on all core PMU types: > https://lore.kernel.org/lkml/20240510053705.2462258-4-irogers@google.com/ As I mentioned in that thread I'll fix that one too at some point, I'm just finishing off some other stuff first. > 3) the broken 'cycles' event name in the arm_dsu PMU: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/perf/arm_dsu_pmu.c#n177 > 4) the ARM memory controller PMUs lacking cpumask causing events > opened on them to be opened on every CPU and thereby induce > multiplexing.. > and so on.. > > Thanks, > Ian > >> Thanks, >> Aishwarya