Commit 85941afd authored by Thomas Richter's avatar Thomas Richter Committed by Alexander Gordeev
Browse files

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: 39d62336 ("s390/pai: add support for cryptography counters")
Acked-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
parent 57834ce5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -285,10 +285,10 @@ static int paicrypt_event_init(struct perf_event *event)
	/* PAI crypto PMU registered as PERF_TYPE_RAW, check event type */
	if (a->type != PERF_TYPE_RAW && event->pmu->type != a->type)
		return -ENOENT;
	/* PAI crypto event must be in valid range */
	/* PAI crypto event must be in valid range, try others if not */
	if (a->config < PAI_CRYPTO_BASE ||
	    a->config > PAI_CRYPTO_BASE + paicrypt_cnt)
		return -EINVAL;
		return -ENOENT;
	/* Allow only CRYPTO_ALL for sampling */
	if (a->sample_period && a->config != PAI_CRYPTO_BASE)
		return -EINVAL;
+1 −1
Original line number Diff line number Diff line
@@ -265,7 +265,7 @@ static int paiext_event_valid(struct perf_event *event)
		event->hw.config_base = offsetof(struct paiext_cb, acc);
		return 0;
	}
	return -EINVAL;
	return -ENOENT;
}

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