Skip to content

Commit 85941af

Browse files
Thomas RichterAlexander Gordeev
authored andcommitted
s390/pai: Deny all events not handled by this PMU
Each PAI PMU device driver returns -EINVAL when an event is out of its accepted range. This return value aborts the search for an alternative PMU device driver to handle this event. Change the return value to -ENOENT. This return value is used to try other PMUs instead. This makes the PMUs more robust when the sequence of PMU device driver initialization changes (at boot time) or by using modules. Fixes: 39d6233 ("s390/pai: add support for cryptography counters") Acked-by: Sumanth Korikkar <[email protected]> Signed-off-by: Thomas Richter <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 57834ce commit 85941af

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

arch/s390/kernel/perf_pai_crypto.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,10 @@ static int paicrypt_event_init(struct perf_event *event)
285285
/* PAI crypto PMU registered as PERF_TYPE_RAW, check event type */
286286
if (a->type != PERF_TYPE_RAW && event->pmu->type != a->type)
287287
return -ENOENT;
288-
/* PAI crypto event must be in valid range */
288+
/* PAI crypto event must be in valid range, try others if not */
289289
if (a->config < PAI_CRYPTO_BASE ||
290290
a->config > PAI_CRYPTO_BASE + paicrypt_cnt)
291-
return -EINVAL;
291+
return -ENOENT;
292292
/* Allow only CRYPTO_ALL for sampling */
293293
if (a->sample_period && a->config != PAI_CRYPTO_BASE)
294294
return -EINVAL;

arch/s390/kernel/perf_pai_ext.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ static int paiext_event_valid(struct perf_event *event)
265265
event->hw.config_base = offsetof(struct paiext_cb, acc);
266266
return 0;
267267
}
268-
return -EINVAL;
268+
return -ENOENT;
269269
}
270270

271271
/* Might be called on different CPU than the one the event is intended for. */

0 commit comments

Comments
 (0)