Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH] s390/pai: Prevent ioctl(PERF_EVENT_IOC_REFRESH)
@ 2026-08-27  6:46 Thomas Richter
  2026-08-27  6:57 ` sashiko-bot
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Richter @ 2026-08-27  6:46 UTC (permalink / raw)
  To: linux-s390; +Cc: Thomas Richter

Prevent this ioctl(fd, PERF_EVENT_IOC_REFRESH, XXX) to take effect.
PAI PMU events CRYPTO_ALL and NNPA_ALL are designed to read out the
changed counter values at schedule out time, when these events
have been installed system wide. Then they use CPU-context.

If an application issues ioctl(fd, PERF_EVENT_IOC_REFRESH, XXX)
it expects to read out samples after XXX hits. The PAI PMUs do
that read operation and then reset the values because it expects
a context switch out. This contradicts the readout at next schedule
out time. The reported result is too low.
Therefore prevent this call ioctl(PERF_EVENT_IOC_REFRESH) right now.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 arch/s390/kernel/perf_pai.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/s390/kernel/perf_pai.c b/arch/s390/kernel/perf_pai.c
index 05f74d74fad1..3e972d940100 100644
--- a/arch/s390/kernel/perf_pai.c
+++ b/arch/s390/kernel/perf_pai.c
@@ -666,6 +666,8 @@ static void pai_have_sample(struct perf_event *event, struct pai_map *cpump)
 
 	if (!event)		/* No event active */
 		return;
+	event->pending_kill = 0;	/* prevent ioctl(IOC_REFRESH) */
+	atomic_set(&event->event_limit, 0);
 	pp = &pai_pmu[PAI_PMU_IDX(event)];
 	rawsize = pai_copy(cpump->save, cpump->area, pp,
 			   (unsigned long *)PAI_SAVE_AREA(event),
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-31 13:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27  6:46 [PATCH] s390/pai: Prevent ioctl(PERF_EVENT_IOC_REFRESH) Thomas Richter
2026-08-27  6:57 ` sashiko-bot
2026-08-31  9:45   ` Thomas Richter
2026-08-31 13:49     ` Heiko Carstens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox