From: Mikhail Zaslonko <zaslonko@linux.ibm.com>
To: Heiko Carstens <hca@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: linux-s390@vger.kernel.org
Subject: Re: [PATCH] s390/mm: Skip holes in identity mapping in set_memory()
Date: Thu, 3 Dec 2026 16:38:22 +0100 [thread overview]
Message-ID: <2069634b-edc3-4484-bc7a-e296d5366086@linux.ibm.com> (raw)
In-Reply-To: <0daa2309-42fe-4a5c-8a1e-0d50f1b07164@linux.ibm.com>
On 03-Dec-26 12:55, Mikhail Zaslonko wrote:
>
>
> On 29-Nov-26 17:53, Heiko Carstens wrote:
>> With debug_pagealloc=on, vmem_map_init() panics with "Failed to set
>> kernel mapping permissions" if the identity mapping contains holes, e.g.
>> standby memory. __set_memory_4k() is called for [0, ident_map_size),
>> which may include holes, and change_page_attr() returns -EINVAL for the
>> first empty page table entry, which was silently ignored before [1].
>>
>> Fix this by skipping empty entries if the range is within the identity
>> mapping, similar to x86.
>>
>> Note: the fixes tag points to the commit which reveals this bug, but it
>> exists since much longer. Nobody noticed so far, since hardly anybody
>> uses debug_pagealloc, and also hardly anybody has configurations with
>> holes within the identity mapping.
>>
>> Fixes: 4634f260683b ("s390/mm: Add error handling to vmem_map_init()") [1]
>> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
>> ---
>> arch/s390/mm/pageattr.c | 53 +++++++++++++++++++++++++++++++----------
>> 1 file changed, 41 insertions(+), 12 deletions(-)
>
> Hello Heiko,
>
> it seems I was fixing the same issue within my crashkernel CMA series for s390:
> a kdump kernel that uses the CMA memory of the crashed kernel always has a
> hole in its identity mapping, so the series depends on this fix.
> I used the approach that splits each memory range separately in vmem_map_init().
> But this approach seems better. I will drop my fix from crashkernel CMA v2
> series and refer to this one.
>
> Acked-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
I tested the patch on master. Without it, a z/VM guest defined with
DEF STOR CONFIG 0.2G 4G.4G and debug_pagealloc=on panics during boot
when it frees the first page above the hole:
00: [ 0.228998] addressing exception: 0005 ilc:2 [#1]SMP DEBUG_PAGEALLOC
00: [ 0.229218] Modules linked in:
00: [ 0.229448] CPU: 0 UID: 0 PID: 0 Comm: swapper Not tainted 7.4.0-rc5-master-00103-gd06ce6f1eb5e #34 PREEMPT(undef)
00: [ 0.229683] Hardware name: IBM 3931 A01 703 (z/VM 7.4.0)
00: [ 0.229919] Krnl PSW : 0404c00180000000 0000031f94fd4e52 (__kernel_map_pages+0x2c2/0x330)
00: [ 0.230168] R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
00: [ 0.230404] Krnl GPRS: 0000031f94e84000 0000000100400000 0000029500000000 0000000100400000
00: [ 0.230620] 0000000100000100 0000000000000080 0000000100400000 0000031f9695d270
00: [ 0.230855] 0000031f9695d290 0000000000000000 0000029504010000 0000000000000400
00: [ 0.231088] 0000000000001000 0000031f96815f00 0000031f95378576 0000031f96723c10
00: [ 0.231330] Krnl Code:
00: [ 0.231581] 0000031f94fd4e44: b9e90063 sgrk %r6,%r3,%r0
00: [ 0.231806] 0000031f94fd4e48: e36070080008 ag %r6,8(%r7)
00: [ 0.232025] PGM >0000031f94fd4e4e: b2210061 ipte %r6,%r1,%r0,0
00: [ 0.232269] PSW >0000031f94fd4e52: e30070000004 lg %r0,0(%r7)
00: [ 0.232523] 0000031f94fd4e58: 41303008 la %r3,8(%r3)
00: [ 0.232750] 0000031f94fd4e5c: a71b1000 aghi %r1,4096
00: [ 0.232989] 0000031f94fd4e60: b9040063 lgr %r6,%r3
00: [ 0.233239] 0000031f94fd4e64: ec3000084065 clgrj %r3,%r0,4,0000031f94fd4e74
00: [ 0.233586] Call Trace:
00: [ 0.234212] [<0000031f94fd4e52>] __kernel_map_pages+0x2c2/0x330
00: [ 0.234652] [<0000031f95378576>] __free_pages_ok+0x1b6/0x670
00: [ 0.235117] [<0000031f9698690a>] free_low_memory_core_early+0x22a/0x2b0
00: [ 0.235676] [<0000031f969874cc>] memblock_free_all+0x5c/0x80
00: [ 0.235968] [<0000031f969834e4>] mm_core_init+0x174/0x1a0
00: [ 0.236368] [<0000031f9695f536>] start_kernel+0x41e/0x6f8
00: [ 0.237093] [<0000031f94f8402e>] startup_continue+0x2e/0x40
The cause is the same one you described: __set_memory_4k() stops at the first
hole and the result is ignored, so everything above it keeps its large
mappings. __kernel_map_pages() then treats a large mapping as a page
table.
But I think the Fixes tag should have this commit instead (4634f260683b
is not in master):
Fixes: edc1e4b6e265 ("s390/vmem: split pages when debug pagealloc is enabled")
With your patch applied on master the same guest boots fine with
debug_pagealloc=on.
Tested-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
next prev parent reply other threads:[~2026-12-03 15:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 16:53 [PATCH] s390/mm: Skip holes in identity mapping in set_memory() Heiko Carstens
2026-11-29 16:59 ` sashiko-bot
2026-12-01 11:02 ` Mike Rapoport
2026-12-01 12:41 ` Alexander Gordeev
2026-12-03 11:55 ` Mikhail Zaslonko
2026-12-03 15:38 ` Mikhail Zaslonko [this message]
2026-12-03 16:06 ` Heiko Carstens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2069634b-edc3-4484-bc7a-e296d5366086@linux.ibm.com \
--to=zaslonko@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=svens@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox