From patchwork Fri Jan 3 19:35:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13925828 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 67737E7718F for ; Fri, 3 Jan 2025 19:36:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EE68F6B0088; Fri, 3 Jan 2025 14:36:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E96E46B008A; Fri, 3 Jan 2025 14:36:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC2B26B008C; Fri, 3 Jan 2025 14:36:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A21BC6B0088 for ; Fri, 3 Jan 2025 14:36:00 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5A8AE1C56DD for ; Fri, 3 Jan 2025 19:36:00 +0000 (UTC) X-FDA: 82967146080.07.B2B7AE1 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf15.hostedemail.com (Postfix) with ESMTP id 1D1D9A0006 for ; Fri, 3 Jan 2025 19:35:56 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Bmbz3S5N; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=zVmpoD8H; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf15.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735932957; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=c2WjhySACBeXB7z8D7NKGHGIEB5qqb6s3UVXoVRvKg8=; b=cgg31Eyprg44vCLJnJ0p51JOBgdwDN6j68I3Dx36vE1+x6jMaOnwg9dlobvGyxIXvv+aAu 6GV1WyZjg32si2dtPIDCgeSy7Yslx5wf4xKge2KIfuGcCcf78dcByLfOYy+lrxKbCpuhlf 3Qroq9FnLikwOP8o6R7yfngyxujQTRA= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1735932957; a=rsa-sha256; cv=pass; b=lfaMBvn1Hu7q6G4kpaJq4c9MglMR+QABv9yNtvcH57LJMlQVAU27Hc8gEeGF3vx20Uei5A ESxv1d0mVl+0oy/HbZvixGRfPZkeF9oKY8tWZ9KFF3R/H8W2xx55I3Ef82dVtFKXWshDed fkYdo8laMFA/AOBZDc9yUlFb5avtiZ4= ARC-Authentication-Results: i=2; imf15.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Bmbz3S5N; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=zVmpoD8H; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf15.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 503Id2wk004061; Fri, 3 Jan 2025 19:35:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=c2WjhySACBeXB7z8D7NKGHGIEB5qqb6s3UVXoVRvKg8=; b= Bmbz3S5NEurjfxJn0EOZq+fH146C619lQE1x+MJ1dKRvTref07pDzNsXAXBKRlxy LhSh4GJ6exROoFteACvwHtZrfGeLo70M6cwBEA6ahppLNgowxm5Uh2Ggy1bzBSBH fUu1MrB5HuyNZhc9b8kTQGMpmVyLNfyNZblzJcRcnguBr4xAjLwo7T2W2yBpccce dlFrfK8oHeX912AIAqDZaG/qBaeLUhHier8r26B3kUldSW7zoaYFgVjeg9e6PVWs ZBDukdT51u5UEfXZs5/JITUuKEhnU/N3MlhylT/bqkEQNazJpjF6MhaVTF83TvSG DlgOaSGneK+Uy6IjdPA8aw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 43t8420mtu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 03 Jan 2025 19:35:53 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 503HIbjQ011925; Fri, 3 Jan 2025 19:35:52 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 43t7sa2g90-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 03 Jan 2025 19:35:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a7FQkYj8S/XaQKM7AEBmGJ725ryCw3q6Hyma1ue4919lh/Tu9J/DaQKkRcoi+iO0UNfPCMQ5+3Vy2yiY23WevT/xJcGxXKT6EzDkvV6tN2dv6gPKlua0o4Gx3F5IjFHZwIUpLDpLLMeG3t/xlsJ1U2J4xSJoXWvxanv27Rsntbhf6UbDttS17Xa5xtl4ZYpuux7JGh/abpRtxSdLor+vWYcJ98OHiSgB4cOfOI2F4BDiSlSPewBnK4bPO8ohZ5eAX84zOUHCP/sfHU83wEubkTDu21AOfS4+zifrvvEvc43j8JRRTC0WbDS2HT5eEC4QwHyPpsqnINMKlN0jBbq/Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=c2WjhySACBeXB7z8D7NKGHGIEB5qqb6s3UVXoVRvKg8=; b=GDSNlZyZpV1a8zp58hPCP6ll7Xq/yroQXd0FBPT+roLQ4Pvw2jfDgwpBepnVLqT9yOT4tJ4bfiDaiRpVZytQaMXw+MVg6ij7nkoJBe0jI9z/ibR/wrVPU9mD2BOB2yG72yKJs5bmYUxJbJoWcHnfFv0nBIhOlPTtR4ab9x6YmctY79U1azVmpGSIt09ZrNoG0AIqP1a5vHAHhmmVafcsUo1+Hw/khMRaCk1BLgvYCxnyA/H5FrAptH3QhYKA6bAPcZQlicQVREaw30qXmUZpE1vMIoxD74PSXnpesFfXZiwGZZiJTQWTzWVXVwwHLHxRooMIDkJtuDhl+m5lG/pHYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c2WjhySACBeXB7z8D7NKGHGIEB5qqb6s3UVXoVRvKg8=; b=zVmpoD8H09egmlcCO9ZsNq7tsH0v+Beoi6cf5Iul/HPjwy7vImfUBMF+QR3fmuwsoLtu47thaDPIHROBzkZP8s0SWN9+hx9Uu1JvpCADeXpdDnvfJJpjxJzFDA9v8aX7hP7BZTCT2pJiko5rJGQoo+RDU+JDYAqpnR2+rvSv67Q= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by CH0PR10MB5163.namprd10.prod.outlook.com (2603:10b6:610:dd::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.14; Fri, 3 Jan 2025 19:35:46 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%4]) with mapi id 15.20.8314.012; Fri, 3 Jan 2025 19:35:46 +0000 From: Lorenzo Stoakes To: Andrew Morton , "Liam R . Howlett" Cc: Vlastimil Babka , Jann Horn , David Hildenbrand , Matthew Wilcox , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/2] mm/debug: introduce VM_WARN_ON_VMG() to dump VMA merge state Date: Fri, 3 Jan 2025 19:35:35 +0000 Message-ID: <13b09b52d4d103ee86acaf0ae612539648ae29e0.1735932169.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: X-ClientProxiedBy: LO2P123CA0106.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:139::21) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|CH0PR10MB5163:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f313c39-f7d4-4d78-84f9-08dd2c2dd18c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: 6b5J+XHmHAe3LUY2PPmmzOTia3u3KC+JynAa+4/LJPM3jbEqCBb62hoSb7I56LKW7qXUeK3EL+6C9Ms0RH29+w0d52CFkHgg/3ZolWg22EuIENu2pLVbD0HRT20iC2dXKKEIxiISRNTQZcnntnI861R8VcCNt+9HauBZ1Ns3MGYZyvnpMTc8z1j50NcWnLHrgutSfqJKzrxM6u/6+YywoFQxfnTz8RfTSsODG6FjQBinAJ9jzKIk1RsCLy8o4Y7BzmiAFrqWARjCQBfstDL1zIfZqeuKrgO3zy65VT0dR8Wkda4jM6P5KcUZ4eUe73idx15hYazqjrFmIv1KsOezqCV0MnUaTBB1ryEzMBhe9ONnEED2VihfstjcfI6WkkyXkFDrmTrLdN7Y1i/9g/b16mZ7ciTtXH9l5QudUhT9nc9nI6kUCH/9WGlZcQvc72d0aOajgrLUkB8wS0OdMp3bo9CW3YsHF2MiuAyQXWG17b18jLNNSIKNEoouqScpX++rRbGNEYOYUjifcIsI5n7Ny2tEm3AynzKdgizvmpBEy77BGY3/E0t1bbtaM19wb6fz1fkxhWOUgoIIPKbULP6TttTqKcxEtRMaK9qJATqAwEqM6A7cfwNO7Kc8+RHXcYT+3ITPWnN2P6R+irmLrQq5hlNB630MJNHgap7xMitiS8E2ko+LkyARtbOa+Gf7e9TUr2/MldcgG0v3vRRuNogVFbqtISEuQB0u0F8k+WZUPHfXu2qYKa13HYTaI+PGmhufcsICgqKjWVH6KcCFmv9fn3pWX4J8QNLmSabJCagB1v6MJCQJXt+BL2eNk81abkmrPWFeKunWjy+sf8qToOhTk0rQo8SE05SkRjCYUNB+PyU7nX+TYjOTUsJP7g4P34Vhq6Ofz5OHPVmUmYwFpldDeF3RtUwzO8gXJ4xpQ3oI4PqsA+K3Ce7BFG+iBBaeh98HqIzQuglt9wZvLv4hW8K1JJJa0/88HERL0pEGK8dZ+lbhXqzsn7TKitBWXxcX2ktnWoGcO6ucH3x5+3F/mZXvf6AHRsLUSAHfo+8Zl9a/LoNPGDIQl+PpRkEQ2ilQ9Dfm5MlvDQl3gKhsjQSIcuBgIrJfc9G1mkV/VnB49T0oV4w7vjnThii/BiUoyTmxTSgiR4zfMvCBGdhDpVpsYa3YFl8ABklG+ieuxRm+LKkwOJs+4BVAcMmgfodNPy5H8g+F/P27KLG9wAxBc/WKvX2CxrGNKX+JzZlV3ZDo7Hj+qPCg1b05qJOyh7stFFJgtQArk1Pf6hTFPtn46FQFyrc2BCbSlFnr6vMS0Kvn52CmwNC5DarHNRW0PXyRAONmECtvmiOH80Ys/doOzZuTgSnnUZLUa+/AcFXT+1klOJmbxD4FlvjugqLQgTbPwpbBQxMM X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3366.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qsWPZs86yAJDirWTguqYSX+rtMbPQdMhMc6qI3dmQxO3m1ZlCaKeBhlx9DXR5ZKRxNTHPwp7XBvTch7wXcJMA4Xick6xwoJL2v4krp4Tnbz7UawGLgBoK1mAZLMrvIoDonCeglkxW5WL+gua6sEfgU1m4dYHs7YMYlFVX55BsWjkvjfvEVtzqf2ThNIbj+BH8tS3+DGVvbTm0D7jL5AlZ3eDN7UbbZOGPrYphnPD9hZL3WbeZQW0vrFvVHPXT1nOTAoKtROUUZJjdCY8E4YtlSluRnNACOy25Jmrq0ZEwAPc4QcXSpto+buhG6iSKJuq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x7zP88nJeXvdyr/a+7BRcnbFy+7DA7qgWMNc060gYb7xpmWynHZAK3Ouo4l2Al1jJyinz3VxQnOUzaZLxuqF+VoW93aeIjvOq7ikr+dGW6NHbTrcr0n/cJxQzTTN7jUpUUJJekm+RGBS5HiCkMlgRG2M5OFmX3tTziHdT7Rp6Vs+CkKfXuOnFu5fq+d9AT2+DqN7R+6LLSgBOpk/5yzEeDA0SQPGNw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: /m61Gh3l+WYN3Ij2Gycke2GFL46dgWhDBTv/FHICsoQgxMG4/WXTv2YI8veWL/3OselsOdSdBHAIrdAunvAtMqpAbK2sDwYFSRl6pwFBVImSB0mSgrX3XtAksJNNoYCL9WcbwJCRFD7SyL6RK2Ut3MTMsct4++HIafTM4jAgsJnbMdxVUdHpGsVa9jJomV9CMDshF8CV0SJ/MxMmJusi99H6VBqkJuUmXziH48AY6wR/G18QovwQpcplV0grASX3grdFsm2btgjxeljUxIf5WL+5lE8TYSJFdNgvtN022y5WuGBKnqOyN/xa2dfO8ShiZ/S87M3Bzp3pibsQwK4kp1tZIVgknE3/E9gbj5riAaMPPIPV34AvHqqEu2xNGhas0T96uFbFYdZrEszYlFGKx2ajW8ySoe8Dk30Y6QSdtdlyV1zxBslTRjNjxpQhbG1gAGv/RNTV/jpb3x3s19Sn3UHMl2sj4OCZ7oN63knGn6a4ogNdd8va/ZYsmu66EbhAifPVHGuYk44O+SALCgRxzSTT6lkW/NoE26HRQ23j6b76Y8sQvir2nqjFPfW2TcXqInCHszBKoxTaaCZqcjqJlKw5C4YOBEWfabWRqspNdUw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f313c39-f7d4-4d78-84f9-08dd2c2dd18c X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2025 19:35:45.9960 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xQprYC4+vX6PVdwEIilBAILyZAuYjIaqs7YsDlQwcdKJiLeI76GnVeaEyA1OU6uLNSgSs7uCnpjvbwdCUt3Y1P7fVLbmWdqTLp+AE+HxtXE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5163 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-02_03,2025-01-02_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 spamscore=0 malwarescore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501030173 X-Proofpoint-ORIG-GUID: dn772wSWCMdt8OY2f4a3TJJ__Ewqa51G X-Proofpoint-GUID: dn772wSWCMdt8OY2f4a3TJJ__Ewqa51G X-Rspamd-Queue-Id: 1D1D9A0006 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: ar9hp4joxi4ihoi67g6tp7dn4dfi655e X-HE-Tag: 1735932956-499912 X-HE-Meta: U2FsdGVkX19I4amA47SR4xqmKbeg4vvA/0UkYlecAJOKzDJ/7oZkYlTeclRn/CVJY1XD3jnqi/wud6ZAhrXokf8Z5lM4fDzTckGZ3VeZpw4s9WyXSJyenm3Mxevc31mmVI07SBDaFWFud3cNmbfyJQwu115rLFGbiX/OoXHkqRTWSAAjZ8BHBUaDoMQCvvJJ+DdTHW/qDRDvh0sDFHKDY8p09sQQXtONMS4eGRGdnIuSmyY+LBXd+YlZZBW6ecEGg3E+uubttY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5f4vcYFXqwMPSb2y7n4XYdz2groaRZfaaVU70LluCn/aadQXG1OVAIdBW0RYWbM1sv+LWROtsBox46NYEXgr6D1u1Hk09CaTXu1KSRIqTYueB2t5dGUbcsyLGxyrFKAn6Vl1Uoe2Ah2GqShuckyWgmYFpdY9aLemqxrgCpl+jVdaL6ReA7zxIjMoHGk6KKQYFTY1Eit4yB+bz1fq2jIgpXWRWxcm//8PbMYtst+QPwMFAzTFmSFswi9oXFyZxPAgp4mTcnUhQezC8B/o9cZckOQAqS1XNiv4DHCXzcLxu9kQUjePZ13469IF4 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: We use a number of asserts, enabled only when CONFIG_DEBUG_VM is set, during VMA merge operations to ensure state is as expected. However, when syzkaller or the like encounters these asserts, often the information provided by the report is insufficient to narrow down what the problem is. This might not be so much of an issue if the reported problem is reproducible, but if it is a rarely encountered race or some other case which precludes a repro, it is a very big problem (see [0] for the motivating case). It is therefore sensible to provide a means by which we can easily and conveniently dump a lot more information in these circumstances. The aggregation of merge state into a single struct threaded through the operation makes this trivial - we can simply introduce a variant on VM_WARN_ON() which takes the VMA merge state object (vmg) and use that to dump information. This patch therefore introduces VM_WARN_ON_VMG() which provides this functionality. It additionally dumps full mm state, VMA state for each of the three VMAs the vmg contains (prev, next, vma) and if CONFIG_DEBUG_VM_MAPLE_TREE is enabled, dumps the maple tree from the provided VMA iterator if non-NULL. This patch has no functional impact if CONFIG_DEBUG_VM is not set. [0]:https://lore.kernel.org/all/6774c98f.050a0220.25abdd.0991.GAE@google.com/ Signed-off-by: Lorenzo Stoakes --- include/linux/mmdebug.h | 14 +++++++- mm/debug.c | 71 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index d7cb1e5ecbda..a0a3894900ed 100644 --- a/include/linux/mmdebug.h +++ b/include/linux/mmdebug.h @@ -9,10 +9,12 @@ struct page; struct vm_area_struct; struct mm_struct; struct vma_iterator; +struct vma_merge_struct; void dump_page(const struct page *page, const char *reason); void dump_vma(const struct vm_area_struct *vma); void dump_mm(const struct mm_struct *mm); +void dump_vmg(const struct vma_merge_struct *vmg, const char *reason); void vma_iter_dump_tree(const struct vma_iterator *vmi); #ifdef CONFIG_DEBUG_VM @@ -87,6 +89,15 @@ void vma_iter_dump_tree(const struct vma_iterator *vmi); } \ unlikely(__ret_warn_once); \ }) +#define VM_WARN_ON_VMG(cond, vmg) ({ \ + int __ret_warn = !!(cond); \ + \ + if (unlikely(__ret_warn)) { \ + dump_vmg(vmg, "VM_WARN_ON_VMG(" __stringify(cond)")"); \ + WARN_ON(1); \ + } \ + unlikely(__ret_warn); \ +}) #define VM_WARN_ON(cond) (void)WARN_ON(cond) #define VM_WARN_ON_ONCE(cond) (void)WARN_ON_ONCE(cond) @@ -104,9 +115,10 @@ void vma_iter_dump_tree(const struct vma_iterator *vmi); #define VM_WARN_ON_FOLIO(cond, folio) BUILD_BUG_ON_INVALID(cond) #define VM_WARN_ON_ONCE_FOLIO(cond, folio) BUILD_BUG_ON_INVALID(cond) #define VM_WARN_ON_ONCE_MM(cond, mm) BUILD_BUG_ON_INVALID(cond) +#define VM_WARN_ON_VMG(cond, vmg) BUILD_BUG_ON_INVALID(cond) #define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond) #define VM_WARN(cond, format...) BUILD_BUG_ON_INVALID(cond) -#endif +#endif /* CONFIG_DEBUG_VM */ #ifdef CONFIG_DEBUG_VM_IRQSOFF #define VM_WARN_ON_IRQS_ENABLED() WARN_ON_ONCE(!irqs_disabled()) diff --git a/mm/debug.c b/mm/debug.c index 9c4cbc3733b0..325d7bf22038 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -261,6 +261,77 @@ void dump_mm(const struct mm_struct *mm) } EXPORT_SYMBOL(dump_mm); +void dump_vmg(const struct vma_merge_struct *vmg, const char *reason) +{ + if (reason) + pr_warn("vmg %px dumped because: %s\n", vmg, reason); + + if (!vmg) { + pr_warn("vmg %px state: (NULL)\n", vmg); + return; + } + + pr_warn("vmg %px state: mm %px pgoff %lx\n" + "vmi %px [%lx,%lx)\n" + "prev %px next %px vma %px\n" + "start %lx end %lx flags %lx\n" + "file %px anon_vma %px policy %px\n" + "uffd_ctx %px\n" + "anon_name %px\n" + "merge_flags %x state %x\n", + vmg, vmg->mm, vmg->pgoff, + vmg->vmi, vmg->vmi ? vma_iter_addr(vmg->vmi) : 0, + vmg->vmi ? vma_iter_end(vmg->vmi) : 0, + vmg->prev, vmg->next, vmg->vma, + vmg->start, vmg->end, vmg->flags, + vmg->file, vmg->anon_vma, vmg->policy, +#ifdef CONFIG_USERFAULTFD + vmg->uffd_ctx.ctx, +#else + (void *)0, +#endif + vmg->anon_name, + (int)vmg->merge_flags, (int)vmg->state); + + if (vmg->mm) { + pr_warn("vmg %px mm:\n", vmg); + dump_mm(vmg->mm); + } else { + pr_warn("vmg %px mm: (NULL)\n", vmg); + } + + if (vmg->vma) { + pr_warn("vmg %px vma:\n", vmg); + dump_vma(vmg->vma); + } else { + pr_warn("vmg %px vma: (NULL)\n", vmg); + } + + if (vmg->prev) { + pr_warn("vmg %px prev:\n", vmg); + dump_vma(vmg->prev); + } else { + pr_warn("vmg %px prev: (NULL)\n", vmg); + } + + if (vmg->next) { + pr_warn("vmg %px next:\n", vmg); + dump_vma(vmg->next); + } else { + pr_warn("vmg %px next: (NULL)\n", vmg); + } + +#ifdef CONFIG_DEBUG_VM_MAPLE_TREE + if (vmg->vmi) { + pr_warn("vmg %px vmi:\n", vmg); + vma_iter_dump_tree(vmg->vmi); + } else { + pr_warn("vmg %px vmi: (NULL)\n", vmg); + } +#endif +} +EXPORT_SYMBOL(dump_vmg); + static bool page_init_poisoning __read_mostly = true; static int __init setup_vm_debug(char *str)