Re: [PATCH 19/19] perf: Garbage-collect event_init checks
Robin Murphy <[email protected]>
| Newsgroups | gmane.comp.freedesktop.xorg.drivers.intel,gmane.linux.kernel.perf.user,gmane.linux.kernel,gmane.linux.ports.alpha,gmane.linux.kernel.arc,gmane.linux.ports.arm.kernel,gmane.linux.ports.mips,gmane.linux.ports.ppc64.devel,gmane.linux.ports.sh.devel,gmane.linux.ports.sparc,gmane.linux.power-management.general,gmane.linux.ports.arm.rockchip,gmane.comp.freedesktop.amd-gfx,gmane.comp.video.dri.devel,gmane.linux.ports.arm.msm,gmane.linux.ports.riscv |
|---|---|
| Message-ID | <[email protected]> |
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;