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=1796313992; b=E7e3upDCo8XmjNT6ULRfx3MoOvpDqZyQtkpBJfTkQXmP6mn7DtmlSJ1NK7kfWXo1nryn OG5y/objXV9cS8JW+ZQIoGcRtorvjEYr7sqUXHQIhs07TnNL7qxVAzS75NjAPyu6DUvQI WxveHk6eTa8j+l7fu0KfruE0CxvlZ2eQMAc5mXkIr7TY8ffuPLN6p1GtqajDz1/qMw2IC GYqxKs6Jw2hL8KxCJrrf8YQhGKKzhfyzVtpUtLE+pScGpHJLlD8oKpAoxQcskGvk6zS4M lWA4QZLF57sM9+7g2ap7YmjoAOQsY3wK7Ouke2fIsZ2e1YCD7mgRBC6iT9q3V/caojA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796313992; h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received: Received:Received:Received:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To: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=Mv/pt7aW6k25k0Ao1PkcmBZWKDyWMv1bU28UszGRLyQ=; b=qsJBsTqKdtRW5Lt7sc/sEmyqe+8rxJypmQTBRZAsjRo2fqc+dX444Th8ptoU6LWfZdlE mp3PYDzj31ElZhYqu07wXSHquNpKP3iJoBIOXE9MuXzI4alCvE1SJ/jxE6ImGNLKRgpVx MLDEVSuxF9jRe4jvvgQ0AXhWWnQGiBdJ3Occi5dfTYU4+hLn4WQmNBn22Pzn9sgSTDOf1 6d3i3hruNLuw5LvrgHWJ+qCXgvlrEgQ3oL+5tHAMqTwmKI2xj4aPdP8wCtJ2WkXz1wrw9 5aKibeR+bSTU70kiRO5yMLAOaiaj28WfQAcqLy+TdRQ1VtKDbgIhLGXGqz+0S0mCceQ== 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=gr1qY+fJ; 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 B40E2606A322 for ; Thu, 3 Dec 2026 16:06:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B40E2606A322 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, unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=gr1qY+fJ 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 6B3G4Vaf3847816 for ; Thu, 3 Dec 2026 16:06:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=pp1; bh=Mv/pt7aW6k25k0Ao1PkcmBZWKDyWMv 1bU28UszGRLyQ=; b=gr1qY+fJZNa1aYzEhoa7oIDQKzdMf4c7dZEfcoRYa8zxEW tGZs0nc5ZBucSe5vr0pV9o8G9yTbzWUUWGwy4A3fjytHk0q9uSqxDB8FmwHw/jFH CIfZ9BFd9VZFsLxJP7mdJnTlniUjW0TplwJQ8eQU2ShjRFnQ+knjmnA1DuPzHUnv eJGQt3KkEwZz4qakFrxGcFgnsGRho3eGVcEkTNPQZoXqmIF6y262SgMqN0Km/bHz iKWDjVh7DzC8dXuqxTvP5d9HXUrf41FIfOzY/4ThkwTE11CLmb3+0v6/kvvoDvU9 Anzou7q7+atzj9IFXn7/7RGJu3zZ1ckZ4Vk/5f7A== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7pp67swm-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 03 Dec 2026 16:06:30 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B3Fp1Sw771439 for ; Thu, 3 Dec 2026 16:06:30 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4jb7h98x2s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 03 Dec 2026 16:06:29 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B3G6Qfj39584062 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Dec 2026 16:06:26 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0798320043; Thu, 3 Dec 2026 16:06:26 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D8A6420040; Thu, 3 Dec 2026 16:06:25 +0000 (GMT) Received: from osiris (unknown [9.68.31.201]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTPS; Thu, 3 Dec 2026 16:06:25 +0000 (GMT) Date: Thu, 3 Dec 2026 17:06:23 +0100 From: Heiko Carstens To: Mikhail Zaslonko Cc: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , linux-s390@vger.kernel.org Subject: Re: [PATCH] s390/mm: Skip holes in identity mapping in set_memory() Message-ID: <20261203160623.138477B09-hca@linux.ibm.com> References: <20261129165327.1188117-1-hca@linux.ibm.com> <0daa2309-42fe-4a5c-8a1e-0d50f1b07164@linux.ibm.com> <2069634b-edc3-4484-bc7a-e296d5366086@linux.ibm.com> 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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2069634b-edc3-4484-bc7a-e296d5366086@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: OdIi87mZ2ayLhiEs-lnnlagGhmP28hdk X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDA2NCBTYWx0ZWRfX5sN/27+bc/vh qknLa6ZwsTN/eVymcbISQHfDAXtR+3hNaZw/Yh/INHBR2YCufF0NRzO5SjQyY60gThiXK5OYwuU gCEhn6p4accVxjG9a7cHx1USINqZmzg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAzMDA2NCBTYWx0ZWRfXysPIkzoz0Pj3 apiri/kTIWfjC9gEsYw/qLbVzNoYgxnvOADj0ht5lWwK7iQIh0pn6/9/0WCBUhv0NYeoaqoPiT+ Z7NQ2R7AFvVaFV9pcCq95TRVYpcphbdJ0UX9GwN/lUOGHrAb3YBh2i9ZPWNK2F3llfn+E60qV9C z8lkqIDHGR8YHchXd+E66sazTpRl0QkdFKy/KZF1GVYIBbG0Ym6bCMZ9VK26I7zP8wiURZSmuZN scLEqOFDamdHRcTVV1zNNtGSsLMiSv0DW3NiaNcPGIPE9bPYQ2nJT9ngBUCUQC1TY6bjjj67Mz/ hEOMATkkRsRT7iIFb3NUvu0PdOztrsLkFd5RMy9DyUWt37x06Mwe7POdFV0Mt1vFgP7zu3uzrSO cRcjYv6JV+LZwgXbg8wn/VufQUrOW6M7Vpxcmqf0FF/+v/E6yELWaFGp+Z8m60Y2DbFWywxCA1R zrzNIK43wIfb6aZGi/g== X-Authority-Analysis: v=2.4 cv=Ae8kjHXG c=1 sm=1 tr=0 ts=6b119386 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=kj9zAlcOel0A:10 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=5Oo7GHwabinUgHOi7qkA:9 a=CjuIK1q_8ugA:10 X-Proofpoint-ORIG-GUID: OdIi87mZ2ayLhiEs-lnnlagGhmP28hdk 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_04,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-2612030064 On Thu, Dec 03, 2026 at 04:38:22PM +0100, Mikhail Zaslonko wrote: > 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) Oh, cool, nice to see that the new markers in disassembly actually do work :) > 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 Yes, I thought it wasn't worth to backport it, since nobody is using debug_pagealloc, but you have proven me wrong. Alexander, it might make sense to add the tags from Mikhail, and adjust the Fixes tag.