From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 2/2] perf test: Add filtered event enabled time tests to event-times
Date: Wed, 25 Nov 2026 05:14:01 +0000 [thread overview]
Message-ID: <sashiko-outbox-232604@kernel.org> (raw)
In-Reply-To: <c41f98313862f6545863598dcde871cfb80aba59.1795582691.git.irogers@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] perf test: open_core_pmu_event() skips PERF_TYPE_HARDWARE on
non-hybrid PMUs
--
commit fe121646fb71356672075f12505ef2224215b814
Author: Ian Rogers <irogers@google.com>
perf test: Add filtered event enabled time tests to event-times
This commit extends the event-times perf test suite with subtests for task
and CPU filtered events, hybrid PMU filtered events, and multiplexed or
grouped filtered events, while updating the CPU affinity helpers.
> diff --git a/tools/perf/tests/event-times.c b/tools/perf/tests/event-times.c
> index 56dd37ca760ec..4c265f7918525 100644
> --- a/tools/perf/tests/event-times.c
> +++ b/tools/perf/tests/event-times.c
[ ... ]
> @@ -239,4 +251,475 @@ static int test__event_times(struct test_suite *test __maybe_unused, int subtest
> return ret;
> }
>
> -DEFINE_SUITE("Event times", event_times);
[ ... ]
> +static int open_core_pmu_event(const struct perf_pmu *pmu, pid_t pid, int cpu,
> + int group_fd, bool disabled)
> +{
> + struct perf_event_attr attr = {
> + .size = sizeof(attr),
> + .read_format = PERF_FORMAT_TOTAL_TIME_ENABLED |
> + PERF_FORMAT_TOTAL_TIME_RUNNING,
> + .disabled = disabled ? 1 : 0,
> + .exclude_kernel = 1,
> + .exclude_hv = 1,
> + };
> + unsigned long flags = perf_event_open_cloexec_flag();
> + int fd;
> +
> + if (!pmu) {
> + attr.type = PERF_TYPE_HARDWARE;
> + attr.config = PERF_COUNT_HW_CPU_CYCLES;
> + return sys_perf_event_open(&attr, pid, cpu, group_fd, flags);
> + }
> +
> + if (perf_pmus__supports_extended_type()) {
> + attr.type = PERF_TYPE_HARDWARE;
> + attr.config = ((__u64)pmu->type << PERF_PMU_TYPE_SHIFT) |
> + PERF_COUNT_HW_CPU_CYCLES;
> + fd = sys_perf_event_open(&attr, pid, cpu, group_fd, flags);
> + if (fd >= 0)
> + return fd;
> + }
> +
> + attr.type = pmu->type;
> + attr.config = 0x3c;
> + fd = sys_perf_event_open(&attr, pid, cpu, group_fd, flags);
> + if (fd >= 0)
> + return fd;
> +
> + attr.config = 0;
> + return sys_perf_event_open(&attr, pid, cpu, group_fd, flags);
> +}
[Severity: Low]
Does open_core_pmu_event() ever try PERF_TYPE_HARDWARE on non-hybrid
systems?
Both callers check that pmu is non-NULL before calling
open_core_pmu_event(), and perf_pmus__supports_extended_type() returns
false when perf_pmus__num_core_pmus() <= 1. As a result, non-hybrid
systems skip PERF_TYPE_HARDWARE and fall through to attr.type = pmu->type
(PERF_TYPE_RAW) with raw configs 0x3c and 0. On architectures where those
raw events are unsupported or rejected (for example, s390 rejects
PERF_TYPE_RAW when exclude_kernel or exclude_hv is set),
test__event_times_mux_migration() skips even though standard
PERF_COUNT_HW_CPU_CYCLES is available.
Trying PERF_TYPE_HARDWARE with PERF_COUNT_HW_CPU_CYCLES unconditionally
(and only ORing in pmu->type << PERF_PMU_TYPE_SHIFT when
perf_pmus__supports_extended_type() is true) would allow non-hybrid
systems to use the generic hardware cycles event before falling back to
raw configs.
--
Sashiko AI review · https://sashiko.dev/#/patchset/80d983c5713537f5743b69e9b35ced1177e4732e.1795582691.git.irogers@google.com?part=2
next prev parent reply other threads:[~2026-11-25 5:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 5:00 [PATCH v2 1/2] perf/core: Add PERF_EVENT_STATE_ON to fix filtered event enabled time Ian Rogers
2026-11-25 5:00 ` [PATCH v2 2/2] perf test: Add filtered event enabled time tests to event-times Ian Rogers
2026-11-25 5:14 ` sashiko-bot [this message]
2026-11-25 5:18 ` [PATCH v2 1/2] perf/core: Add PERF_EVENT_STATE_ON to fix filtered event enabled time sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-232604@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=irogers@google.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox