s390/pai_crypto: use PERF_ATTACH_TASK define for per task detection
authorThomas Richter <tmricht@linux.ibm.com>
Tue, 10 Oct 2023 14:14:22 +0000 (16:14 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Wed, 25 Oct 2023 13:08:29 +0000 (15:08 +0200)
Use define PERF_ATTACH_TASK bit in event->attach_state to determine
system wide invocation or per task invocation in event initialization.
This bit is set in common code and before calling PMU device driver
specific event initialization.
It is set once and never changes. It is save to use and also in
sync with other PMU specific code.
No functional change.

Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/kernel/perf_pai_crypto.c
arch/s390/kernel/perf_pai_ext.c

index 19d53edf50d2c95cdd8783af44e7daf218e57516..85d7398ac2790c2b2bd1156a2d23d29ea636f7d7 100644 (file)
@@ -269,7 +269,7 @@ static int paicrypt_event_init(struct perf_event *event)
            a->config > PAI_CRYPTO_BASE + paicrypt_cnt)
                return -EINVAL;
        /* Allow only CPU wide operation, no process context for now. */
-       if (event->hw.target || event->cpu == -1)
+       if ((event->attach_state & PERF_ATTACH_TASK) || event->cpu == -1)
                return -ENOENT;
        /* Allow only CRYPTO_ALL for sampling. */
        if (a->sample_period && a->config != PAI_CRYPTO_BASE)
index e91c77155f08428f59281d20191224d00b4d7217..edceff2143b949bfc5529df51687637cbfa24672 100644 (file)
@@ -248,7 +248,7 @@ static int paiext_event_init(struct perf_event *event)
        if (rc)
                return rc;
        /* Allow only CPU wide operation, no process context for now. */
-       if (event->hw.target || event->cpu == -1)
+       if ((event->attach_state & PERF_ATTACH_TASK) || event->cpu == -1)
                return -ENOENT;
        /* Allow only event NNPA_ALL for sampling. */
        if (a->sample_period && a->config != PAI_NNPA_BASE)