From mboxrd@z Thu Jan 1 00:00:00 1970 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 49F6CC7115B for ; Mon, 23 Jun 2025 18:43:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC1EA6B00C3; Mon, 23 Jun 2025 14:43:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D71086B00C5; Mon, 23 Jun 2025 14:43:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C60C06B00C6; Mon, 23 Jun 2025 14:43:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B46C76B00C3 for ; Mon, 23 Jun 2025 14:43:48 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5D78B104B88 for ; Mon, 23 Jun 2025 18:43:48 +0000 (UTC) X-FDA: 83587539336.03.1FDFC12 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf10.hostedemail.com (Postfix) with ESMTP id 35768C0005 for ; Mon, 23 Jun 2025 18:43:46 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=jmmS8Pfk; spf=pass (imf10.hostedemail.com: domain of gerald.schaefer@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=gerald.schaefer@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=1750704226; 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=zTPAnkeyXq83jKKhUTn665Cm5SJI14tYrKV0aZ2QLXU=; b=E/etRawsM1rKmcKne3dP0ppOLvzL5SbjLquia/zIb/0F/1C07bvER5t9B5YMQq/pItEZxx 0LP01eBkFgucPAQbs4hxty34jQb9RTZD1NPGLa1KNL0j0YKe5hsjnOyhu0arDNg776HBMR q0ktQQ4dZkogWbzF7wOB4dHTuHlugW4= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=jmmS8Pfk; spf=pass (imf10.hostedemail.com: domain of gerald.schaefer@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=gerald.schaefer@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750704226; a=rsa-sha256; cv=none; b=5LaisJIF07kjfiwEBwXQmcA1CbcgoXH8IXK8il6+vStla+2euD2TkE8d7GvUInPwFSd478 P2x+HlDdi/+QAHnjoD2l7iQIvoHlMf7Yib3GXJlKbfrdklacBvHHuu21KTV65VuYkYF3El UrdvR4s6r39xRa9/9TYfTsXBSzXk9QU= Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55ND4FtV021411; Mon, 23 Jun 2025 18:43:38 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=zTPAnkeyXq83jKKhUTn665Cm5SJI14tYrKV0aZ2QL XU=; b=jmmS8Pfk6o63HBGVsdGLlNwCPvJBZAzdvEXl+4K+rHM+EI4PaPo1LXKqO RhCLkxXBwUZcaDPusL4/atgcEgs2aA0eQ0kc4BQY3l228VpsnJmomaKYcny+gu3Y Btn8RJ4N/iGMe593wvsUS8PRzPJ46bZtDyejYpQ6KTYfAsSYFO0xj5sbrVEnE1Bc Oj+02VsoohbD330XCoNa/TJV4IzAGLBvnMIdwaZ+L6ZdG1VVeTKgPa0jOxBTZ/Eh FHevfKd3OuD63KIghpMycYDmV9PEipl2Ey8KT+BM0YshaXdE/VSqIgBfNd1IOqsN 6C4Njiv4WH5deypLUKUX9t8D5f57w== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 47dj5tm5mc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 18:43:38 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 55NHitC6002467; Mon, 23 Jun 2025 18:43:37 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 47e8jm03sd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 18:43:37 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 55NIhZWg29229624 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jun 2025 18:43:35 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A5E8620043; Mon, 23 Jun 2025 18:43:35 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6625D20040; Mon, 23 Jun 2025 18:43:35 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 23 Jun 2025 18:43:35 +0000 (GMT) From: Gerald Schaefer To: Andrew Morton , Anshuman Khandual Cc: Matthew Wilcox , David Hildenbrand , LKML , linux-mm Subject: [RFC PATCH 0/1] mm/debug_vm_pgtable: Use a swp_entry_t input value for swap tests Date: Mon, 23 Jun 2025 20:43:20 +0200 Message-ID: <20250623184321.927418-1-gerald.schaefer@linux.ibm.com> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: sxpMR6GufTBHXZDBrpyzjz85ESll-pDF X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjIzMDExNSBTYWx0ZWRfX9919fYtj2GhT fw6Ffia+T5O/sWlNDC0rUHC+pglXAusWQoIba3D4wxVhn2P69W4COPvFN4qtWCI9go1sduF4zKp CoaS/OJO9cx1rmR6RIZtLvZSgBsJUvqxMQQSYE0nvXNtHDeeEF+jCuNQzrpRMnrrzaBT1BYai4p g0r6e5dt+iHiJisoKyfC7eI6k7MUQjbHWPw1ZwlW2QnVMQq/OX44XKwAtlVlXvEUD9KFpCL7a75 rlNIPk/asogAzgQQ3EYOy45Iwb0+B+LPQvFjo4kQmQnsX8eZ2QFfStOeSj+uCCPqLijCsAMfnSX Oqo43tyFMUYjY1P1KFapCDbvxfv9GPWmFfJeNi1un2MFYLl+nm/rMpEzuD72rNQRMyLUyZ7yiCB KOCryqsPpUi9nUUy/83y9l+Mnn8g6d5Jjb0S0jDShWQXDmp8XbvDEQeUJrvrDAZpjRssAzGT X-Authority-Analysis: v=2.4 cv=MshS63ae c=1 sm=1 tr=0 ts=6859a05a cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=6IFa9wvqVegA:10 a=CZB7Um9bMwATt2O9lgkA:9 X-Proofpoint-GUID: sxpMR6GufTBHXZDBrpyzjz85ESll-pDF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-06-23_05,2025-06-23_07,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 mlxlogscore=622 impostorscore=0 clxscore=1011 phishscore=0 malwarescore=0 suspectscore=0 adultscore=0 priorityscore=1501 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506230115 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 35768C0005 X-Stat-Signature: u6ugsq7sgytyyqoax3944a17bfxhga8k X-Rspam-User: X-HE-Tag: 1750704225-78082 X-HE-Meta: U2FsdGVkX1+jbCIIqiBej1pFXbnw/zuwR1L8b/Oki91H5np9tfkYHXzh5dIbz18L9nSM9+ucSIrt3F8nzN/FeIsiKDIqEM4WkWUyJqFjvKDRgRqTXilNeTc7zgkcQA8g7QEvYrY9Erag4xskxNQPPP+ioZInZBsQ/IO3Q4w/+a2p2DLvlOBATdeVmvIX97nJsd1BPLO+FU7LWXbSNAg8VCirvdsam1ASC/FZ4YoEsE0yADw0cH4clDzbM9EoO8WlLMgu2eODx2jAPdWBgByomlWjQ5SyAPBkibKL6L+9nlMbv1+SMWTGT3yqjXGP6hJ84ppCxkrrXBgRurL7Wa+7Rq1ygaBiy88hgeKrNyEltlzydoDknRtDz6JFpD/zOOWZXJHiRQcTAW/UcqrgdVYgvK0cP6QH5pCkDUB8SRipCYjCpZ5DvRsCnJUs4zS3hpegQ9eMldEyyl0vxyms4F9k6KyrmEOAz4rwMbcs+lBmW/jsNgvBnfvEN4jqJpgOZLjLACJmEtoEFikOq5/hzlzI9XjKHMbzG8xjjiLXIG5Mwn46xddPbLDBVw5+RheolI3+UXav/2gUIRyy8r+9nCmCpiWoAzxxBPU7DJ6QcB9lDAdP7i1u3bD6BPXwpeEqytR5fUXdefbcxbXwfP2MN/j5AcXH5c/G5rSab9p2JVrEQDJbwQJM5fLfDdyt0NoeoZYMpp8y4KQvcFiXFiJwK1jb2x9ztfH4g46L1lZIULAsmdqPC0rm2Ae5JFUNln0joHrbsjtULG1jhl1kfajjX40df/Oa7c+Q6oZUj7xAyga+WHWKEkzva51+wCuCuXWxPMm76712RgHg0vrjSh3eu5pIYnh7IaBLeT8n40Gm1yFW2v8jkM1TgIoMK0q8nDhPfp/iCtacdHCvM0WcjnOhVrWV5iqtOcQVo9Z0vqZLt4oKyRZn06PJACE0fM92kAitFpp5gSPNOeqxTLYi8hdAZp+ WN/0iLs2 CGPTKHKDgSt3yLxFzecGdjkADj3lSKuXh1JGeBRA6lhjf67o0FzyKQde4A7Cnm/XmaWc3JlV16eUyKXPiWUVhKaPz/6HzKWcdnd2prwJ+LMfNJRM2q6KLjMfyxsF9wJN0zc/RVbHGFBM+pGyF842kPitkk5tyycCHxE/ZGEpwtZdbeIWgGfqLFJV8VFh/IgY6Vdgbm1Em+JFVur4f7VsPMXFR2llgr97SElER 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: Hi, currently working on enabling THP_SWAP and THP_MIGRATION support for s390, and stumbling over the WARN_ON(args->fixed_pmd_pfn != pmd_pfn(pmd)) in debug_vm_pgtable pmd_swap_tests(). The problem is that pmd_pfn() on s390 will use different shift values for leaf (large) and non-leaf PMDs. And when used on swapped PMDs, for which pmd_leaf() will always return false because !pmd_present(), the result is not really well defined. I think that pmd_pfn() is not safe or ever meant to be called on swapped PMD entries, and it doesn't seem to be used in that way anywhere else but debug_vm_pgtable. Also, the whole logic to test the various swap helpers on normal PTE/PMD entries seems wrong to me. It just works by chance, because e.g. __pmd_to_swp_entry() and __swp_entry_to_pmd() are just no-ops on other architectures (also on s390, but only for PTEs), and also pmd_pfn() does not have any dependency on leaf/non-leaf entries there. So, I started with a small patch to make pmd_swap_tests() use a proper swapped PMD entry as input value, similar to how it is already done in pte_swap_exclusive_tests(), and not use pmd_pfn() for compare but rather compare the whole entries, again similar to pte_swap_exclusive_tests(). But then I noticed that such a change would probably also make sense for the other swap tests, and also a small inconsistency in Documentation, where it says e.g. __pte_to_swp_entry | Creates a swapped entry (arch) from a mapped PTE I think this is wrong, those helpers should never operate on present and mapped PTEs, and they certainly don't create any swapped entry from a mapped entry, given that they are just no-ops on most architectures. Instead, in this example, it just returns the arch-dependent representation of a swp_entry_t, which happens to be just the entry itself on most architectures. See also pte_to_swp_entry() / swp_entry_to_pte() in include/linux/swapops.h. Now it became a larger clean-up, and I hope it makes sense. This is all rather new common code for me, so maybe I got things wrong, feedback is welcome. Gerald Schaefer (1): mm/debug_vm_pgtable: Use a swp_entry_t input value for swap tests Documentation/mm/arch_pgtable_helpers.rst | 8 ++-- mm/debug_vm_pgtable.c | 55 ++++++++++++++--------- 2 files changed, 38 insertions(+), 25 deletions(-) -- 2.48.1