[PATCH 19/19] perf: Garbage-collect event_init checks
Robin Murphy
robin.murphy at arm.com
Tue Aug 19 23:25:45 AEST 2025
On 13/08/2025 6:01 pm, Robin Murphy wrote:
[...]
> diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
> index 297ff5adb667..98ffab403bb4 100644
> --- a/arch/x86/events/intel/uncore.c
> +++ b/arch/x86/events/intel/uncore.c
> @@ -731,24 +731,11 @@ static int uncore_pmu_event_init(struct perf_event *event)
> struct hw_perf_event *hwc = &event->hw;
> int ret;
>
> - if (event->attr.type != event->pmu->type)
> - return -ENOENT;
> -
> pmu = uncore_event_to_pmu(event);
> /* no device found for this pmu */
> if (!pmu->registered)
> return -ENOENT;
>
> - /* Sampling not supported yet */
> - if (hwc->sample_period)
> - return -EINVAL;
> -
> - /*
> - * Place all uncore events for a particular physical package
> - * onto a single cpu
> - */
> - if (event->cpu < 0)
> - return -EINVAL;
Oopsie, I missed that this isn't just the usual boilerplate as the
comment kind of implies, but is also necessary to prevent the
uncore_pmu_to_box() lookup going wrong (since the core code won't reject
a task-bound event until later). I'll put this back with an updated
comment for v2 (and double-check everything else again...), thanks LKP!
Robin.
> box = uncore_pmu_to_box(pmu, event->cpu);
> if (!box || box->cpu < 0)
> return -EINVAL;
More information about the Linuxppc-dev
mailing list