From patchwork Thu Jan 23 16:03:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Gordeev X-Patchwork-Id: 13948422 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85031C02182 for ; Thu, 23 Jan 2025 16:04:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0C4DA6B008A; Thu, 23 Jan 2025 11:04:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 074BC6B008C; Thu, 23 Jan 2025 11:04:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E58166B0092; Thu, 23 Jan 2025 11:04:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C4ECD6B008A for ; Thu, 23 Jan 2025 11:04:12 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 61270499C2 for ; Thu, 23 Jan 2025 16:04:12 +0000 (UTC) X-FDA: 83039188344.09.450DBFA Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf27.hostedemail.com (Postfix) with ESMTP id 0F8DB40012 for ; Thu, 23 Jan 2025 16:04:09 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=qtxkJeZa; spf=pass (imf27.hostedemail.com: domain of agordeev@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=agordeev@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737648250; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=YaKfF8QWfZZOVyjwI4WO9vZg3BNftS8xatpcQW7vef8=; b=fVgM8soHumiXoUtjtfaEtW7L0akNYzi+t9qFOiRBc6AaSqr6gEnEB0rKWl024SN7aTmCH2 kQxPDJvTCJafHNS3HikmgRPj6799OyXHaeZv9kHkRSd2G7dKEAT1hr46ajjCURezNF2vYk ioLdyhXz9M5E1n/+HHwek/DpJNmX/ZE= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=qtxkJeZa; spf=pass (imf27.hostedemail.com: domain of agordeev@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=agordeev@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737648250; a=rsa-sha256; cv=none; b=onyHCLYDcBv2sqNHz8zBQ7WOx0Mj2dSLAYFRP2XsiF3FD/JNMcyTVR0vpa7pH6z7VB9IIW Hy+xXImKMxfqTCUg8HL6dmwECOQNh0wWetyXzqAuh22hlwjcQdfCt7pRT5Y5ExVxpdrGPJ 35GWhi03prFRFSUW8Z8vTNyTtQZHc+E= Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50NFDZw2026932; Thu, 23 Jan 2025 16:03:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=pp1; bh=YaKfF8QWfZZOVyjwI4WO9vZg3BNftS8xatpcQW7ve f8=; b=qtxkJeZao5LvE0jSrD2oUSOuVzfPgwTkWpQriUX20cul73f3kuWYpka52 xluV1SE868RiTQesich0bC1+wpFrcM31epPHi6YM6xlg1rodbafYod9UucRvJwOQ VySNsvk47P74z0lsPw3sxaa6C6uBzRrvMtNdL7BKz/N6y/XeRw90n1ykMSke5Z7/ 5cS64g8sP3SLEYXw4ez9EFDq9+WDk+od8l7DeHup2kNf1IsmjEX6mC2qyTIrE7pW CW5JfHc1dl0bCM++V9q7N5DvqPknT7QaN/0SI1RBuc7uQUTQt0LYkOl3cbDz/6bz 6Vd8XMxvJ5hUTDKa/xbvlgzVs/y9A== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 44bfk7u09m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jan 2025 16:03:55 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 50NEBO0x024252; Thu, 23 Jan 2025 16:03:54 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 448q0yed6x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jan 2025 16:03:54 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 50NG3olX35258966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jan 2025 16:03:50 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 60B4E20043; Thu, 23 Jan 2025 16:03:50 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 50A7520040; Thu, 23 Jan 2025 16:03:50 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTPS; Thu, 23 Jan 2025 16:03:50 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 55669) id E3698E030C; Thu, 23 Jan 2025 17:03:49 +0100 (CET) From: Alexander Gordeev To: Kevin Brodsky , Qi Zheng , Gerald Schaefer , Heiko Carstens Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton Subject: [PATCH] s390/mm: Add missing ctor/dtor on page table upgrade Date: Thu, 23 Jan 2025 17:03:49 +0100 Message-ID: <20250123160349.200154-1-agordeev@linux.ibm.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: gmGbBPBMfKdUhbbs6F0NDqvs4fciIxjO X-Proofpoint-ORIG-GUID: gmGbBPBMfKdUhbbs6F0NDqvs4fciIxjO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-23_06,2025-01-23_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=739 adultscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 spamscore=0 malwarescore=0 suspectscore=0 bulkscore=0 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501230119 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 0F8DB40012 X-Stat-Signature: j3du4d6zeiemeijjgqcxue6q9wg5rmim X-Rspam-User: X-HE-Tag: 1737648249-503821 X-HE-Meta: U2FsdGVkX182bAN8v+e3vK3y+gWGYAnlD9sqLpCSy0Ek+KJJXcsyDv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xqBh1wxGj41Mo6uPBaTnfVQjidLD8QBJrJYXI5UhBe3Sr7nFwaDagsgEERLQI75gfBh5Qy X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Commit 78966b550289 ("s390: pgtable: add statistics for PUD and P4D level page table") misses the call to pagetable_p4d_ctor() against a newly allocated P4D table in crst_table_upgrade(); Commit 68c601de75d8 ("mm: introduce ctor/dtor at PGD level") misses the call to pagetable_pgd_ctor() against a newly allocated PGD and the call to pagetable_dtor() against a newly allocated P4D that is about to be freed on crst_table_upgrade() PGD upgrade fail path. The missed constructors and destructor break (at least) the page table accounting when a process memory space is upgraded. Reported-by: Heiko Carstens Closes: https://lore.kernel.org/all/20250122074954.8685-A-hca@linux.ibm.com/ Suggested-by: Heiko Carstens Fixes: 78966b550289 ("s390: pgtable: add statistics for PUD and P4D level page table") Fixes: 68c601de75d8 ("mm: introduce ctor/dtor at PGD level") Signed-off-by: Alexander Gordeev Reviewed-by: Gerald Schaefer --- The patch is against: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git next-20250123 git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm mm-stable --- arch/s390/mm/pgalloc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c index a4e761902093..d33f55b7ee98 100644 --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -88,12 +88,14 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end) if (unlikely(!p4d)) goto err_p4d; crst_table_init(p4d, _REGION2_ENTRY_EMPTY); + pagetable_p4d_ctor(virt_to_ptdesc(p4d)); } if (end > _REGION1_SIZE) { pgd = crst_table_alloc(mm); if (unlikely(!pgd)) goto err_pgd; crst_table_init(pgd, _REGION1_ENTRY_EMPTY); + pagetable_pgd_ctor(virt_to_ptdesc(pgd)); } spin_lock_bh(&mm->page_table_lock); @@ -130,6 +132,7 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end) return 0; err_pgd: + pagetable_dtor(virt_to_ptdesc(p4d)); crst_table_free(mm, p4d); err_p4d: return -ENOMEM;