From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796312310; b=xC+vGbLVzQthXssUvaqiE/NSbmurINy9NHsLzbiJWcoYPMyYGchJsauBIV0T/jSyCWu/ 0qWO+6JF0iBQiJuhtCh8MOh6/8CsgDHnpKoCVUabesnI3YacGVHuR7659mdLQyKfBiYs3 7sRHO8eFzo/QVME12yLd4aCydqG1uOUVh0tUX6zfQoBbuWUxnRE17+FUEVq2F6/GozSG2 vZnKFkwn1rnuaXA0VfmkLnUGOC3AtZx1SRyWZP0LH2WuZzhdr7LQ1PBC4uB4lif52wb2l zJpdLV17q1+T8HYaVDV3fK8Oz4PJ5WcuwdfIkVRmP5UqJbhG2ZQlrzhohGAu5lqTiSQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796312310; h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received: Received:Received:Received:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:From:To:Cc:References:Content-Language:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-TM-AS-GCONF: X-Proofpoint-GUID:X-Proofpoint-Spam-Info: X-Proofpoint-Spam-Details-Enc:X-Authority-Analysis: X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=/QRAdqDtC6rc/Z9LCKHX5HwvavTzu3mKgURvPovArVc=; b=CbbJh0Rhu81b354FwwmTzEU7Rcwsj+/2Y8wm+G58Ccz2X3IJ1LvtvoRz59Fhez+Z295O 2tmQf3GrCsf0Pzmly8HlAKCBmBJP1m3TB/tv+ztDdUoZQ2Eyn3F3VfrLij+HxYo3GgSae /N/0lKYBAFQZTbJHAAKAjrYla3x2/1npZM+9CD1xxUq42LDv0PAOUSRMjmSqZEz30ug35 LBikcL8Taj4bHWGijUoUEs5L/YemFuZgvLMQ9JljbbZO6WPIWspzQh2Hz2g6h1vJCzwUZ v7FZAWwOvIBXo6uFqbPrlmvVlSBut9aYt13Qpd5/WCcig6hkxNFbruvBavX2vro1k4Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=RWKm31WU; arc=none smtp.remote-ip=148.163.156.1 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8ED8606A322 for ; Thu, 3 Dec 2026 15:38:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B8ED8606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=RWKm31WU Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B3F4UP13721951 for ; Thu, 3 Dec 2026 15:38:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=/QRAdq DtC6rc/Z9LCKHX5HwvavTzu3mKgURvPovArVc=; b=RWKm31WU1XP4Kj3OkEFwte o+AQJEyeVJb0qvgtyOnJWN3nW3b8yaoQXb8LkSFN4P7XOi2VnUR1MO+Z1JrHSym5 m1nPPy5L/tDcqRjpkf3ZxkDuuPRnOUJXXMwTk9jveYyYU3KHlWYbuQlpyjUo8hjj jnpTxwn5IrEiMzWUYZnE/n6f8TemYGURu9bIuUz00ofj2F0xDnHbxYLs7se/8MW6 O975dxvDyf47GVj0qVxWZf/PCh/dlCI2R3zQgWva5QLRwVtuwbz6MtboHvuUxgYV jx61quIICFEKCo9JO96P7opy+jFWyGjZLMkx93roGuT3aanVPqOiqf07D8c5KOng == Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7pp67nnx-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 03 Dec 2026 15:38:28 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B3F4ZJ8604293 for ; Thu, 3 Dec 2026 15:38:28 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4jb5a1hbyj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 03 Dec 2026 15:38:28 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B3FcQBT16908960 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Dec 2026 15:38:26 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 26E8E5805E; Thu, 3 Dec 2026 15:38:26 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2BBE858052; Thu, 3 Dec 2026 15:38:25 +0000 (GMT) Received: from [9.68.13.112] (unknown [9.68.13.112]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTPS; Thu, 3 Dec 2026 15:38:25 +0000 (GMT) Message-ID: <2069634b-edc3-4484-bc7a-e296d5366086@linux.ibm.com> Date: Thu, 3 Dec 2026 16:38:22 +0100 X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] s390/mm: Skip holes in identity mapping in set_memory() From: Mikhail Zaslonko To: Heiko Carstens , Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger Cc: linux-s390@vger.kernel.org References: <20261129165327.1188117-1-hca@linux.ibm.com> <0daa2309-42fe-4a5c-8a1e-0d50f1b07164@linux.ibm.com> Content-Language: en-US In-Reply-To: <0daa2309-42fe-4a5c-8a1e-0d50f1b07164@linux.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: mZC60tGrB3r3j-KYxDfyIvebQlaCFVio X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDA2MiBTYWx0ZWRfXy8O55T0Dkciz TmGPyYQiGMe3kfBu40XN8wVzi1I/Lo0LYf/4LVDLm6AkBMtTIi3MnfSJ1rEkBWOXbFQ/rcXqDYm e/LcKor6KVb3wO5gNvCDBmaFfRYyfoo= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAzMDA2MiBTYWx0ZWRfXwd0s7sjWRImW BkOGjkuydQCO43N5UVgCMPfw6vk9ji5oavEPnLArWMez7qgBSRr96MOrp+C0adbLgVMMOStKjUU jGa2y/AphcDR1iQgVQ7sw5lhj1wpTSUySr+CzHo++lZ93k8/vdnatWFR/4ok/a5pBguDOw9w1Us X8kkt7ZoyA1jZlWO2IPCGRA/omt0gRyO9WuChZDgz9lm/xsEabjM0yStFnQdGA4Q6QvuecmeDKt md9MFtaWY48xmg3evaj73PJ1K1AGz7GmEUDh8RIlFFRnk/U1Iucy/d+f/d/N/b64DC1ihLveRjg zdbXHYN2eKOPrdVxydb4HVbgZDUgXYx7nUXRfL4wb6mvEhY0tqHbxP1hFtFLIEqt0VZIaN0wz// KHoSPUwh+UKtAvGN2PCumN89zjvqwO8K0CVGuGeKmeV0O5aJNfCaVLcyy8B19+C0AMZ9RAaQebX aI9yMCn9PI7Df02m6UQ== X-Authority-Analysis: v=2.4 cv=Ae8kjHXG c=1 sm=1 tr=0 ts=6b118cf4 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=48S65gpCzj2_9HmHnmkA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-ORIG-GUID: mZC60tGrB3r3j-KYxDfyIvebQlaCFVio X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-03_04,2026-12-03_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612030062 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 >> --- >> 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 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