* [PATCH] s390/pai: Reduce excessive debug feature size
@ 2026-08-25 9:49 Heiko Carstens
2026-08-25 9:51 ` Thomas Richter
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Heiko Carstens @ 2026-08-25 9:49 UTC (permalink / raw)
To: Thomas Richter, Jan Polensky, Sumanth Korikkar, Alexander Gordeev,
Sven Schnelle, Vasily Gorbik, Christian Borntraeger
Cc: linux-s390
The pai debug feature is registered with 256 areas, where each area
contains 32 pages. This sums up to a total of 32MiB. The code does not use
any debug exceptions, which means that 255 of those areas are never
used. In addition all existing debug feature calls have a lower level (5)
than the default level (3).
This in turn means that without user interaction the debug feature is
unused.
Reduce the number of areas to 1, and also reduce the number of pages for
the remaining area to 1. Since user interaction is required, the user can
also increase the size of the remaining area, instead of wasting memory by
default.
This reduces the total size of the debug feature to 4KiB.
Fixes: a3f8423622ef ("s390/pai_crypto: Add PAI crypto characteristics table for parameters")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
arch/s390/kernel/perf_pai.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kernel/perf_pai.c b/arch/s390/kernel/perf_pai.c
index cdb8006220ca..ab76ed7ad791 100644
--- a/arch/s390/kernel/perf_pai.c
+++ b/arch/s390/kernel/perf_pai.c
@@ -1221,7 +1221,7 @@ static int __init paipmu_setup(void)
static int __init pai_init(void)
{
/* Setup s390dbf facility */
- paidbg = debug_register("pai", 32, 256, 128);
+ paidbg = debug_register("pai", 1, 1, 128);
if (!paidbg) {
pr_err("Registration of s390dbf pai failed\n");
return -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] s390/pai: Reduce excessive debug feature size
2026-08-25 9:49 [PATCH] s390/pai: Reduce excessive debug feature size Heiko Carstens
@ 2026-08-25 9:51 ` Thomas Richter
2026-08-25 9:59 ` sashiko-bot
2026-08-26 23:05 ` Vasily Gorbik
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Richter @ 2026-08-25 9:51 UTC (permalink / raw)
To: Heiko Carstens, Jan Polensky, Sumanth Korikkar, Alexander Gordeev,
Sven Schnelle, Vasily Gorbik, Christian Borntraeger
Cc: linux-s390
On 8/25/26 11:49, Heiko Carstens wrote:
> The pai debug feature is registered with 256 areas, where each area
> contains 32 pages. This sums up to a total of 32MiB. The code does not use
> any debug exceptions, which means that 255 of those areas are never
> used. In addition all existing debug feature calls have a lower level (5)
> than the default level (3).
>
> This in turn means that without user interaction the debug feature is
> unused.
>
> Reduce the number of areas to 1, and also reduce the number of pages for
> the remaining area to 1. Since user interaction is required, the user can
> also increase the size of the remaining area, instead of wasting memory by
> default.
>
> This reduces the total size of the debug feature to 4KiB.
>
> Fixes: a3f8423622ef ("s390/pai_crypto: Add PAI crypto characteristics table for parameters")
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
> arch/s390/kernel/perf_pai.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/s390/kernel/perf_pai.c b/arch/s390/kernel/perf_pai.c
> index cdb8006220ca..ab76ed7ad791 100644
> --- a/arch/s390/kernel/perf_pai.c
> +++ b/arch/s390/kernel/perf_pai.c
> @@ -1221,7 +1221,7 @@ static int __init paipmu_setup(void)
> static int __init pai_init(void)
> {
> /* Setup s390dbf facility */
> - paidbg = debug_register("pai", 32, 256, 128);
> + paidbg = debug_register("pai", 1, 1, 128);
> if (!paidbg) {
> pr_err("Registration of s390dbf pai failed\n");
> return -ENOMEM;
Reviewed-by: Thomas Richter <tmricht@linux.ibm.com>
--
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] s390/pai: Reduce excessive debug feature size
2026-08-25 9:49 [PATCH] s390/pai: Reduce excessive debug feature size Heiko Carstens
2026-08-25 9:51 ` Thomas Richter
@ 2026-08-25 9:59 ` sashiko-bot
2026-08-26 23:05 ` Vasily Gorbik
2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-08-25 9:59 UTC (permalink / raw)
To: Heiko Carstens
Cc: Christian Borntraeger, Heiko Carstens, Alexander Gordeev,
Vasily Gorbik, linux-s390
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing CPU hotplug handling causes uninitialized per-CPU pointers to be dereferenced when task-bound perf events migrate to newly onlined CPUs.
--
--- Patch [1]: [PATCH] s390/pai: Reduce excessive debug feature size ---
commit 07fb6d75462afb53888116fff8b2fe4b2e6d8db6
Author: Heiko Carstens <hca@linux.ibm.com>
s390/pai: Reduce excessive debug feature size
The pai debug feature is registered with 256 areas, where each area
contains 32 pages. This sums up to a total of 32MiB. The code does not use
any debug exceptions, which means that 255 of those areas are never
used.
> diff --git a/arch/s390/kernel/perf_pai.c b/arch/s390/kernel/perf_pai.c
> index cdb8006220ca0..ab76ed7ad791e 100644
> --- a/arch/s390/kernel/perf_pai.c
> +++ b/arch/s390/kernel/perf_pai.c
> @@ -1221,7 +1221,7 @@ static int __init paipmu_setup(void)
> static int __init pai_init(void)
> {
> /* Setup s390dbf facility */
> - paidbg = debug_register("pai", 32, 256, 128);
> + paidbg = debug_register("pai", 1, 1, 128);
[Severity: High]
This is a pre-existing issue, but does the PAI PMU code handle CPU
hotplugging correctly?
If pai_alloc() only allocates PMU tracking structures for currently online
CPUs:
arch/s390/kernel/perf_pai.c:pai_alloc() {
...
for_each_online_cpu(cpu) {
rc = pai_alloc_cpu(event, cpu);
if (rc) {
...
}
And a task with an active PAI event migrates to a newly onlined CPU where
structures were not allocated, won't mp->mapptr be NULL here:
arch/s390/kernel/perf_pai.c:pai_add() {
...
struct pai_map *cpump = mp->mapptr;
struct paiext_cb *pcb = cpump->paiext_cb;
unsigned long ccd;
if (++cpump->active_events == 1) {
...
}
Could this lead to a NULL pointer dereference when accessing
cpump->paiext_cb or cpump->active_events?
> if (!paidbg) {
> pr_err("Registration of s390dbf pai failed\n");
> return -ENOMEM;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260825094925.1791807-1-hca@linux.ibm.com?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] s390/pai: Reduce excessive debug feature size
2026-08-25 9:49 [PATCH] s390/pai: Reduce excessive debug feature size Heiko Carstens
2026-08-25 9:51 ` Thomas Richter
2026-08-25 9:59 ` sashiko-bot
@ 2026-08-26 23:05 ` Vasily Gorbik
2 siblings, 0 replies; 4+ messages in thread
From: Vasily Gorbik @ 2026-08-26 23:05 UTC (permalink / raw)
To: Heiko Carstens
Cc: Thomas Richter, Jan Polensky, Sumanth Korikkar, Alexander Gordeev,
Sven Schnelle, Christian Borntraeger, linux-s390
On Tue, Aug 25, 2026 at 11:49:25AM +0200, Heiko Carstens wrote:
> The pai debug feature is registered with 256 areas, where each area
> contains 32 pages. This sums up to a total of 32MiB. The code does not use
> any debug exceptions, which means that 255 of those areas are never
> used. In addition all existing debug feature calls have a lower level (5)
> than the default level (3).
>
> This in turn means that without user interaction the debug feature is
> unused.
>
> Reduce the number of areas to 1, and also reduce the number of pages for
> the remaining area to 1. Since user interaction is required, the user can
> also increase the size of the remaining area, instead of wasting memory by
> default.
>
> This reduces the total size of the debug feature to 4KiB.
>
> Fixes: a3f8423622ef ("s390/pai_crypto: Add PAI crypto characteristics table for parameters")
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
> arch/s390/kernel/perf_pai.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thank you!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-26 23:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 9:49 [PATCH] s390/pai: Reduce excessive debug feature size Heiko Carstens
2026-08-25 9:51 ` Thomas Richter
2026-08-25 9:59 ` sashiko-bot
2026-08-26 23:05 ` Vasily Gorbik
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.