]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/cpum_cf: Deny all sampling events by counter PMU
authorThomas Richter <tmricht@linux.ibm.com>
Fri, 22 Aug 2025 12:05:57 +0000 (14:05 +0200)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Thu, 28 Aug 2025 14:47:58 +0000 (16:47 +0200)
Deny all sampling event by the CPUMF counter facility device driver
and return -ENOENT. This return value is used to try other PMUs.
Up to now events for type PERF_TYPE_HARDWARE were not tested for
sampling and returned later on -EOPNOTSUPP. This ends the search
for alternative PMUs. Change that behavior and try other PMUs
instead.

Fixes: 613a41b0d16e ("s390/cpum_cf: Reject request for sampling in event initialization")
Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/kernel/perf_cpum_cf.c

index 4d09954ebf49e88f10ba9d1807891af71815d8b9..04457d88e5892c35f267be70c24051648b37d5e0 100644 (file)
@@ -760,8 +760,6 @@ static int __hw_perf_event_init(struct perf_event *event, unsigned int type)
                break;
 
        case PERF_TYPE_HARDWARE:
-               if (is_sampling_event(event))   /* No sampling support */
-                       return -ENOENT;
                ev = attr->config;
                if (!attr->exclude_user && attr->exclude_kernel) {
                        /*
@@ -859,6 +857,8 @@ static int cpumf_pmu_event_init(struct perf_event *event)
        unsigned int type = event->attr.type;
        int err = -ENOENT;
 
+       if (is_sampling_event(event))   /* No sampling support */
+               return err;
        if (type == PERF_TYPE_HARDWARE || type == PERF_TYPE_RAW)
                err = __hw_perf_event_init(event, type);
        else if (event->pmu->type == type)