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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8BF69E7E0D5 for ; Mon, 9 Feb 2026 19:59:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A05C66B00C1; Mon, 9 Feb 2026 14:59:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9888D6B00C5; Mon, 9 Feb 2026 14:59:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75F5E6B00C1; Mon, 9 Feb 2026 14:59:06 -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 4BDDC6B00C2 for ; Mon, 9 Feb 2026 14:59:06 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id EE9A3B73C5 for ; Mon, 9 Feb 2026 19:59:05 +0000 (UTC) X-FDA: 84425981850.02.1A4438A Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf27.hostedemail.com (Postfix) with ESMTP id 17CBE40006; Mon, 9 Feb 2026 19:59:01 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2025-04-25 header.b=dHy0o4MB; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wXpXpcZe; spf=pass (imf27.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1770667142; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Jf5XTdoXPxM9NkO9iQikReodhlfiuZtNKscDKPVSwV0=; b=wY5HpMAoQOfuptzg8SSa6NjcJbipQrYP6wjS1qjhdp9sgvB5BxnUUjAevoFTbvQlUjaK1I oFSwLfElY4X/7GZnz/9BVBepPpAsqN8qK93gOu/s9P2MyfKqV+7SRIseNJI8SlAvM8IzZd ioo/as2iefs4Bs7NTuE8lvLooAhGHnE= ARC-Authentication-Results: i=2; imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2025-04-25 header.b=dHy0o4MB; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wXpXpcZe; spf=pass (imf27.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1770667142; a=rsa-sha256; cv=pass; b=WoEoOutUTvJhrPwTMttOsMSZJso7mnQLQStt5z1NapV4XF5uBq4axgzICYB5228qlvDJ9M MW4JFrlrvlcGF/TyiAx2fVbLcP4ZrEnzQUQL0yzd70J9Shdqfe9XXWG75lDDwtp5I/90iu 6t6n1t2dFIV3lQQ5FbauhXDfPeZZYBU= Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 619ECi4J1822662; Mon, 9 Feb 2026 19:58:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=corp-2025-04-25; bh=Jf5XTdoXPxM9NkO9iQ ikReodhlfiuZtNKscDKPVSwV0=; b=dHy0o4MB1/EwRLZnCdl6P7/k0s/tPzBwBB SZnIGpigmgpCVpLXvjkSp5j38hf0uFeXa1bbLx0Y5gtLSot+E3WO0cPNU+ql11IW mPcHBW6X4pC5t5q6C+HEwgTGDFka+77icxqBQg7PS3TvNrxXMs2/H7OCUMM1Zvge GROGL9BNClaaRp9Niy/FuqCMv0y3ucHP4Q2tLzc3CHKoN2G+ukOflxLwOULz0KZq 31Y2v9dfA8gsczX9shlK1xS0Cfn/uE97GRaxPuDVu2M0FYX8GpWq1iPZqwugZPvx AppNn7U94izTGjtPtObX3Nwu3D/WjpbghFo3fx2Wlq4OhgEYchuQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4c5xk4tnn0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 09 Feb 2026 19:58:41 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 619J3fdx040824; Mon, 9 Feb 2026 19:58:40 GMT Received: from bn1pr04cu002.outbound.protection.outlook.com (mail-eastus2azon11010025.outbound.protection.outlook.com [52.101.56.25]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4c5uukf427-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 09 Feb 2026 19:58:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fsVhCLs/IQzE8ESeEm/5wdKCtXU9L4kFAcAv7W2nmL/pyF5WsN9XuA2cCwD+uFrWQluevYNMoC9KJBIuW5wvdeXgk2058wmOU4twh7bg9Kbc/Ac6juXdVM25HwptK57Pf36fWCDXO5X0WpKepew8rAwJfaankPjiE2Lu7GBy0LWfzn8u36IUuV9LlBmNyePCp+8l7HuMbZkS7GjeXtGSz/nk0zyiLR7dWLmgVXPKzUuUOzTwQWo6NyJdOK6EMsP0fTnus5GskP6ZdoEWLeg8DzL9oh8ZjV1O7M6Kc/ErojaQ2qAOtkwcJy51KNSu2Tdd/d5+ne9sv4mFjbclR0HUog== 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=Jf5XTdoXPxM9NkO9iQikReodhlfiuZtNKscDKPVSwV0=; b=I0rw8OC4IVLm18wZ2AogxlqDPw7Cb90AKtfD62/we3765qorf96Bv87+afDmCCRUZlv06lEVcBaiF09CHOW2f+TjjSKuDC0pajOgiiptPSw3qMM7Dq7ntFqBsX6rOyDDuwwPE1bNPZnbjNVTRDCRzrsTbR97LmdghFFwjzE7X+qzwJbVRJO+m4KbBVDoOXg/osxbo49+KImOzBtMoAAWqWGMaTuQPIPAqp0wxd44e56rO9wakWe+6Rk1uoKPZoJQKw5lFZMGCFVdsLYEfsh761nNwJqQmTiLET31UuNBwdsUN09OSdPFcVLtVY639YJMFxCfO5PN+kOyi0UE8lDeqg== 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=Jf5XTdoXPxM9NkO9iQikReodhlfiuZtNKscDKPVSwV0=; b=wXpXpcZekiZGL6hbJ53Lh+xEjm+C/wJZ1R9Mwd9E19Myqn+l6ktrg5Sw3eAEosiXofiMqc67XEe8GpxYlMgHXe1art7QkYwsH3GrCXvmj5oUyvdMylp9BRlCVvU5pRCe3cgc0PVzaXqfsPd259C9GE+QxYBnbl61PKjZD/47VbI= Received: from PH0PR10MB5777.namprd10.prod.outlook.com (2603:10b6:510:128::16) by SJ0PR10MB4752.namprd10.prod.outlook.com (2603:10b6:a03:2d7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9587.19; Mon, 9 Feb 2026 19:58:34 +0000 Received: from PH0PR10MB5777.namprd10.prod.outlook.com ([fe80::4b84:e58d:c708:c8ce]) by PH0PR10MB5777.namprd10.prod.outlook.com ([fe80::4b84:e58d:c708:c8ce%4]) with mapi id 15.20.9587.017; Mon, 9 Feb 2026 19:58:33 +0000 Date: Mon, 9 Feb 2026 19:58:22 +0000 From: "Liam R. Howlett" To: Lorenzo Stoakes Cc: Andrew Morton , Jarkko Sakkinen , Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , Arnd Bergmann , Greg Kroah-Hartman , Dan Williams , Vishal Verma , Dave Jiang , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Christian Koenig , Huang Rui , Matthew Auld , Matthew Brost , Alexander Viro , Christian Brauner , Jan Kara , Benjamin LaHaise , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Sandeep Dhavale , Hongbo Li , Chunhai Guo , Theodore Ts'o , Andreas Dilger , Muchun Song , Oscar Salvador , David Hildenbrand , Konstantin Komarov , Mike Marshall , Martin Brandenburg , Tony Luck , Reinette Chatre , Dave Martin , James Morse , Babu Moger , Carlos Maiolino , Damien Le Moal , Naohiro Aota , Johannes Thumshirn , Matthew Wilcox , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Hugh Dickins , Baolin Wang , Zi Yan , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Jann Horn , Pedro Falcato , David Howells , Paul Moore , James Morris , "Serge E . Hallyn" , Yury Norov , Rasmus Villemoes , linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-mm@kvack.org, ntfs3@lists.linux.dev, devel@lists.orangefs.org, linux-xfs@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, Jason Gunthorpe Subject: Re: [PATCH v2 11/13] tools/testing/vma: separate VMA userland tests into separate files Message-ID: Mail-Followup-To: "Liam R. Howlett" , Lorenzo Stoakes , Andrew Morton , Jarkko Sakkinen , Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , Arnd Bergmann , Greg Kroah-Hartman , Dan Williams , Vishal Verma , Dave Jiang , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Christian Koenig , Huang Rui , Matthew Auld , Matthew Brost , Alexander Viro , Christian Brauner , Jan Kara , Benjamin LaHaise , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Sandeep Dhavale , Hongbo Li , Chunhai Guo , Theodore Ts'o , Andreas Dilger , Muchun Song , Oscar Salvador , David Hildenbrand , Konstantin Komarov , Mike Marshall , Martin Brandenburg , Tony Luck , Reinette Chatre , Dave Martin , James Morse , Babu Moger , Carlos Maiolino , Damien Le Moal , Naohiro Aota , Johannes Thumshirn , Matthew Wilcox , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Hugh Dickins , Baolin Wang , Zi Yan , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Jann Horn , Pedro Falcato , David Howells , Paul Moore , James Morris , "Serge E . Hallyn" , Yury Norov , Rasmus Villemoes , linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-mm@kvack.org, ntfs3@lists.linux.dev, devel@lists.orangefs.org, linux-xfs@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, Jason Gunthorpe References: Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20250510 X-ClientProxiedBy: YT3PR01CA0150.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:83::18) To PH0PR10MB5777.namprd10.prod.outlook.com (2603:10b6:510:128::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5777:EE_|SJ0PR10MB4752:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f4ab9af-d411-4db7-0c15-08de68159ae6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?/++uqzhMPkluCcYGDkOmYhKy0uGiSNVGaFyH5ENJJGBGAuIHUGHQ5vwZF9I9?= =?us-ascii?Q?Xqb7wnOwFjb37PT+vjuWWSw2CZlEepTF3GYNv7h+NEcAE+sDqbkl1w/ytsB2?= =?us-ascii?Q?CPDWitobkiz2iCXVXfy3W2f2XJ1xWG2Od1eBE0hvBR+xVgVDZ+VBnkwyUv+D?= =?us-ascii?Q?NcoOcA7mr8S7tfKAShBiEjIxN6jhCt8docfyElPO3Lz53OX42IKLm4ZvIo5j?= =?us-ascii?Q?0a3+mFOdNvT++Oj+l8JIqRBmP0fBZ5rwS3UW0nXRdNkQEg3zpXyS+potKNz+?= =?us-ascii?Q?0CoNTVDOMzzoyRX/+3jQd3TEnK4OFLUM8IjQgyC1PPqjDMux38iMFoUdNbFZ?= =?us-ascii?Q?AfA2raCTt0cVvf+9eZLeKymYOjTIBRn3IT2iEqyhPwzYDgSS7eVbJQl2R5hY?= =?us-ascii?Q?yVsa5ZFX0X/03BLoHZtfbG1jY10XdpIfS4oUkaCJZEQ7x0qnlGcOeRtGBvEy?= =?us-ascii?Q?u+6nrP5/UpYia0DjsSxdk4YuVvTWHKJ5y5U9vmQwwqXHU/HLoVas2V81hflZ?= =?us-ascii?Q?wCEdM9yV3qH+3e9xgtteOzSdalcnnxdk0MnU0ku9qHD/8C1RnlHR/gcA7Bqu?= =?us-ascii?Q?R8X61WtPHIZ674RuU4xYHg/NvCvsbTK9uu4EyuQMDfk4GaWos0hqSBmz6SkM?= =?us-ascii?Q?LTinTQa2KhlgpO6uzKZ7ITK5o8FJs8/EkSEYhyWPA5DhPUy+NGDLG5zPF2q9?= =?us-ascii?Q?XCo60XBGwPvl1ZoY/n5nFi0gDej7eOOR0GVPIjsgwX5hHRNDYoy0/dUex3Qn?= =?us-ascii?Q?pGkMHASt9756dLd0Noe7A35dJ6Q9qoq/g6AkUEtosS1GEQjh/D1q4CaAPVUA?= =?us-ascii?Q?8FcdVzz0NwE37lpR5e01G2gU2rCab2xSu4JRsDyIUQ5hc/6mEI3c1BHdnIjO?= =?us-ascii?Q?4fnVxr/XIPC+UPOliMPPYKmSsXetZRhZofHxqJACK5p3WfpV156ZVd88aEdY?= =?us-ascii?Q?EkbOHEA08rTJ+STwYq+BdFiDKD7ZUjz/75D5Jb8Mb5wvI94D/PQbTjT3fM5E?= =?us-ascii?Q?9a7G1iZbkIsIKVAURNctEbIkQvdNK+TDtUqApvg6b8mmJrAWjzcqw1W8AYs1?= =?us-ascii?Q?XvHC91gcB7eX6oITGaElh8VA/u1nyPuV1/krWBz20E47M1IN9nyYDB7W5VbB?= =?us-ascii?Q?Q7FNWzV7Bvc4JGQU9bdupRDUUi4InAdCOyeng8v+9r8phsaadWSa2zwSi2qL?= =?us-ascii?Q?Bbk0er6ltIhJEjxfKRoJmPYiZG5oww1rZWfGx0FR36Syof60Jy1TNTVhZuHK?= =?us-ascii?Q?tJ4Bp4g98YkfaLmnm6MvABtS7tNm6blfBORua9OuIf7uKI6QMvTYYcvX1c7P?= =?us-ascii?Q?z4gSTyqTYMbXfeTY6jtwF2cgqm25TAJlwVBGrNc7jq2/NVdp7ghBN6fr+hwn?= =?us-ascii?Q?nQyPjAL/EmWRHtn34lex64LvSzzDekUIJ/a+3dCbxwE2OAd0depKNGccwcnv?= =?us-ascii?Q?4cUXOR+yutdE7zU3bAdVl/RlI3V5fOLKRIxFrVYLTk62holI2dpbQ8zThNDy?= =?us-ascii?Q?HAw2QPRdjbWTE3wNRcIfcCs1s1GnNAH2tCo0EMU5V/fluZF9CyTlr3EBcpip?= =?us-ascii?Q?twjv/05Ych0aEVZ3RQM=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5777.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?9SQ5gwFe1NYTEW0WJJl2JpZVCq6UisE8Z8KNPb65AN0b7qqppO9duRLw2i/w?= =?us-ascii?Q?niEMg/cRzQLtMWdMTk0MOCyraxBgAopN3lm3CCZT7MKV0I2qkgNvJPc3XK0a?= =?us-ascii?Q?tJvhIgn6AT1T+w3WPTu0Kv1SyJk8tLrFRBTK9Fc/XYGL+saPvjH8uIU17kcW?= =?us-ascii?Q?iyg0a6V/dvqUnpz5qL1Hut6YKl5l5UVRyvuNhgmAJ76PAqHvJDcfrWPk1Ifx?= =?us-ascii?Q?JTbGCmXzO4XFoGxc7rwvDY3/3m0bWq4KYv7JA1WkCNtCrZMWB4f8jNt00OHG?= =?us-ascii?Q?SnJKLg9QMn6R0Li5q+uaNPrgoK73wBeZT4OupQ8OCeilxuELO+dJIFJofA7t?= =?us-ascii?Q?NL4DvwLvxWZriLX1zPqK18F9mOOm+zKskPxXa2rDpCWigrL7CD+z20mI6eSU?= =?us-ascii?Q?wZxKAsroVOTpikYsJwXLXt9J+NAkq4zCfvYKhwC04g4snxu+sfksOd6ONqvQ?= =?us-ascii?Q?3DYcrcpoD94+aMvIvULPUlHu3Q4LlrdWJAPnA5R2mdFopVsKD597K/S8Mvq5?= =?us-ascii?Q?SIexK4wi3Voe0rAJxGbara46fddwq4FDZZj6MmjDpUBYLLGtmZUP+aM+ld+A?= =?us-ascii?Q?GajJKuUt9v6Sph0e5OluEl3PayRDvFlZK/HlhUrIwZ/05oyEh8CFVjj/a2HJ?= =?us-ascii?Q?Y+RriwNed695Jj46CuvcCfU7OV9ygoqBoD/4b+fxPUxfrVSw6Y9dHrrLUQ0X?= =?us-ascii?Q?XIiCuEiNtNROuhoFJzPcESqB2w+qV0fEkI39VSJaXipCCfGdaGoFmffWfyBc?= =?us-ascii?Q?zBQiIXcoV0qDlWioXTMPCcgnAMQXJ6p1JIqPJFuF00YfaggNnsvHIwc9Q0/l?= =?us-ascii?Q?pNeOUnGhbS1krtHhdcNb080HEY6nlw2ryoo+Rbdkn9gtXThM1iojXlPPzdCc?= =?us-ascii?Q?RJQYd3BAVjPI0DmaghKYyj/ZR5113jHQWIxJKUYZcvOzVrPHr3hwmB0BhHdV?= =?us-ascii?Q?IBBwQ8oslQr2qsX/I5lTk9foerM8qcjzSr+kXUKfulIsZjsv+/BSAm7c+UN/?= =?us-ascii?Q?3WUD9Mto+7EUbgnw2iZM2uEYB+DmSZtpSD5EVEvgP258HGxwuBquGQ6NP3o5?= =?us-ascii?Q?X3SjFnCYVYJB94EIZoKfo8/0zdmJl0G4QVPya5Oa6AsGFtTRK09R1kBKfERi?= =?us-ascii?Q?RsUBOBp7139t/X/mC56HiD5n4b2w27NsAjb2JuI8r2iC+vVrW6ZaqcqG7kNB?= =?us-ascii?Q?tD9hot6qeVJjRGpRG9ZqNc878ezlMqX2H5Gl/pQxuqEg/LJfoHB9v8GfFk3Q?= =?us-ascii?Q?viAQHF44Hhh8wAn9z6fLDRhVM7VGViYbfHmXFmMub7TpCqyUGtwhKkgrMIIh?= =?us-ascii?Q?yusZzDlEQfXqkCNeBm2wZsX0uHS2MonsT9hrSfvy6BTM7O+k9qcA5dY2GfwL?= =?us-ascii?Q?rK6hwrI8gM8xX83o+MbGCiArlElfJTqwOGZf+C07YngQrDjYWwzbibV+rRaP?= =?us-ascii?Q?CqvGuFKs0h5wuhGnM7qXDgjRoiL1gez/uD+3NZnpVz0snysGz74JjwsX1KkK?= =?us-ascii?Q?x0dA74+OX3RReQfatePuFeXtJoH6VEYXdNzmLvnm/GHmCNA/G7RHsrnns5hj?= =?us-ascii?Q?aUYrZa4zouP8NR/f7HKBOqQWo9l4lxXzL48/5PBsALCDriev1BUOkPSnqxxg?= =?us-ascii?Q?RXuBSQlICj/B5eIzf6FDyJK2xRsMcvjiiyxwyYD5y+b1s1OzxydUx9jiWCtE?= =?us-ascii?Q?JNMNq7OLVMwa96RKM71lrivkGnwTwdLM3LwFQTt7PlFeQqS1RYf1vKHNU099?= =?us-ascii?Q?Mu7rHl+qBw=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Td3Ss5MiZUiMq7GSkGQ8OTfqqpDRfDpGE2gpI+RDGDVjE6OogD6dxhq3HesGFYK45tMqTeIh+zvvkAhZt4fIJTy8mVK0Dsh2asDes56Tnb/QVuXXr79HKNcs9Q5Fw6ti/00PBHVNFkzISBkul6JtEIbyGtfwLGeF4m2XphXfdekH2PEUjP1NqF+FobUGHdDhNoGpcCm+uNdWwsKNXc1G3vphoaCn0B1j0IvcJbpucfWygsET46XFAEWdbFW/ErhsIMdaSovnC9BMUR9G/t7mqeLcxu+R9SxWPPpPsoIxyRKM8hXWSZHqu+mEn0xuJZU9hcS6dQWQkGBMAK6T8swZqsOc32nqcPXtwG/7uvmBKTy7RsrG/Oj+zCzr35qX6hV27cVOYsMy4rhnDEBN2PvfZU1QUVE9sFk0G5uoiGEi1WJQqqKiFj/118nZewT53qwaRfH0xW+w0TSD+u4dCMbH/7j3bKZ4+mgK+A82yYLvdAMj2IwwRsqTjif5YJl3mZeqmHMuQjQY8zQGkK8w42tXUzRX+MxrM7POPU4Lt1ag28s/6zGWThR+XipC+98ip3dP7rmoRFRSIZG5cLXKGHOiDMKa/NLrYKS1Pm364iu5rAM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f4ab9af-d411-4db7-0c15-08de68159ae6 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5777.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2026 19:58:33.7932 (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: o7p7aO0W/Ar6Ayy+F6QvB7600QR2q6DkmapHVb8YTuYgc0ogV/VOTa4eQmdeNoEkU9OOsHMODlLrwTt2fYj1Gw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4752 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-09_01,2026-02-09_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2601150000 definitions=main-2602090169 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA5MDE2OCBTYWx0ZWRfX067al62us1j5 VpEb6CEkmY/bEDWKuoAxJ2uOezRtF7TOST636IDevmL08M+Nde4BY1KYjXoaQAvbVlbq4070Bku R4zdsWnYWVR3xZBTet16UALXsmVjbmP5jr7Ibxkg8Hp8uyYVVS3jkjjh17a2MoIXJIQS5PBKnHz iWhm28kv4HffW7/PCVUrpqypixYJIV4DCBGjj3FRL0aaNvtQqYMtVnNLu2isbwGxD1eoAv75kR8 9Lka5q8UO8ZYglGkZMwYBJvJ8gly4zMhuFgQd2zKSnrxV9NM2OSC9HZQzPtJAA0i5qrUw56p2BI wl3pAwPIh0h2Nn9v2eAoHiGT6WPE90It5OvssHIU1uEl0wNXZTTuJU3a2ecdqyo4nBmN9J9zzU+ g9gTq182+i5BgYg88oShJblnWquH6oNs/mCF/Z8NL0ThOsWX1VucmBhEzR4WKoNBlkRCQ5MEKEu bGRR10lkjJc6VUtLGlxuLkMhkkhMa0vPiJBRZPB0= X-Proofpoint-GUID: apfmPMYXIZZA1P-Auj9lix4Jv0THb_9x X-Authority-Analysis: v=2.4 cv=ccnfb3DM c=1 sm=1 tr=0 ts=698a3c71 b=1 cx=c_pps a=qoll8+KPOyaMroiJ2sR5sw==:117 a=qoll8+KPOyaMroiJ2sR5sw==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=HzLeVaNsDn8A:10 a=GoEa3M9JfhUA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=yPCof4ZbAAAA:8 a=TFr53SC5hDGcbPrpWZ8A:9 a=CjuIK1q_8ugA:10 cc=ntf awl=host:12149 X-Proofpoint-ORIG-GUID: apfmPMYXIZZA1P-Auj9lix4Jv0THb_9x X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 17CBE40006 X-Stat-Signature: 33japonf7wi644ufiqjcc8rtf1dc733j X-Rspam-User: X-HE-Tag: 1770667141-966064 X-HE-Meta: U2FsdGVkX1+llw/DAmznPdY9aJJ9DWzmHxp2XMrR4SEt2r813SqAiPCzNtFDcufWFT/GnQpYZmpYOj4z3XI0FWY3RAnJhTJhQc+VOThWLMAuqHbQOgy814VZ+Aei5b6rsaWfA7dwkWrrSWpoe56o2tVAs9geqqBowIR1XYYGKKqtlOtVHAadfpEmMeYu6T84ZHIGFj3OwkHYAWhW82e5kQLcxglGvos1xJm3WfWhVzmF7u9bmSiMUlKZk8xx0jZJvlBH3ti8nrKolHhudXhu/JX1/X7C8qulInL2gtKQM1Fl+E7dCpmnjDePLTCkLpaJ3sF05Ge0F6YYp2hKTdirFQskWkRDeL4LxpOxeecXc2ZYAuwDAOfiaXN3yn+GadM/qVrx7l3qNxsJvMn63LpiuCT3WmyJxr8zFc+ZS0qUUS6sZPoJSGZj59iZpHkmJA41BYaKDdMCuOI0kVhumdmWtfzIxh4UHMvdul6057IlaEWkcx+Rdnn+IEpMflG4NtZy8oKhDP06wYGU0qq1cFYJMlTyTOnNw+XWAQ4pzTpLQxTgNkDHNLSol9DVe1Js6Iv/WAyak2ZLcaY0lSJNZNClmY/ve6WXmK4K0wOfVqJhJmUsHKP0A3jGxiiesK8cX+vP38WrqYdD2cauA9W0bQRaSR5k13VRNr0oYLUkX3s58/blwOvma+2U9MueY2u6KVFjM4GWnOOZ0fxRn4/HiP3QDTWW3Rfeh8SSQ6cYaxqzyoaAWAm717Mx5BhHbZABV3VOCi7UldRFUa6UdlSLh2rmWGEFOFIeUi9mxCoJ1JXFE7NiWRzgarplGcqbSBrSdN1hqsAXdCvMxdjIiXKgdXH+xNweEqnb89dViJGQuSGsPl5pWu+DsxTPtJlV+suJ58mSqhyGcUW70MfVphVjUVFTbQEVvXNVVtUQgfFFTblTtwyaCIge2mTWQwV+LsQk7RQ9FeYbjv4nXx0GEQNWLAA JJLy3nKM aXAhN9a+g5SrpomE7o7tmTOayc1LgQW5z0I5QHRmowScqpJrI0RwbYQMyG8wBGifViOfQWrQFSHxlGvYYXt06RDqbGulZFS1HNlD28/ViOomg9aUNN8qDjWtJsB7pYwF5PF9pAox9olld3hrdjCg5w+/5XP+s3B+oSDLikmMyWrtwoysSM6h3Dusz6ybqskku2x5SAnLgaYkCQ/SGIB4z/eCxOPP5Hq8EHxmTPnkRVNoAKRL6R5HHh4apXatWIDz/TIdSvCgDeYpEr6KQtCyqQNJM8cgab/Iwu97WX3ITnk08kduYAowA301njdt2IrgmJ2kmEGQ8waE7GKCfQx6fZMZrwFNZp9ea2Fz+dcR9dFrB+3OKSugNNIBD2wK4ZR5jLNuN3Hv1SUfI2fuaT/j5As/ubA8JvuiDFj4obw3qHkOcik5n4LtAha0RdxyDg1rmVb3elmRRJXMF7zc+P/zP3n7YsH8va5EV14NEEoc75W+5E2O8EWHMXCrb2hcmNP3oN96L2z6zwOgDfxHKxaTGyG2NkOovDr1sw9zdAyc1Vq8SHmHHpAay1CSD1gHY9dilQM05kCU4j8MfxXWrvE6AgecLNLb4EYZFGuZRD9w7DYcXWRVo0THwlkewy2J6sg1uL1rBZ3Ip18fo44wn2tdUJfj22JwGAf//df1Yey0Z7UZS3l4IfELSuicgfLwmgX0QSnnCRjRfPml8EjPfFFxiNuR0OA== 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: * Lorenzo Stoakes [260122 16:06]: > So far the userland VMA tests have been established as a rough expression > of what's been possible. > > qAdapt it into a more usable form by separating out tests and shared helper ^^^^ Typo > functions. > > Since we test functions that are declared statically in mm/vma.c, we make > use of the trick of #include'ing kernel C files directly. > > In order for the tests to continue to function, we must therefore also > this way into the tests/ directory. > > We try to keep as much shared logic actually modularised into a separate > compilation unit in shared.c, however the merge_existing() and attach_vma() > helpers rely on statically declared mm/vma.c functions so these must be > declared in main.c. > > Signed-off-by: Lorenzo Stoakes Besides that typo, it looks good. Reviewed-by: Liam R. Howlett > --- > tools/testing/vma/Makefile | 4 +- > tools/testing/vma/main.c | 55 ++++ > tools/testing/vma/shared.c | 131 ++++++++ > tools/testing/vma/shared.h | 114 +++++++ > tools/testing/vma/{vma.c => tests/merge.c} | 332 +-------------------- > tools/testing/vma/tests/mmap.c | 57 ++++ > tools/testing/vma/tests/vma.c | 39 +++ > tools/testing/vma/vma_internal.h | 9 - > 8 files changed, 406 insertions(+), 335 deletions(-) > create mode 100644 tools/testing/vma/main.c > create mode 100644 tools/testing/vma/shared.c > create mode 100644 tools/testing/vma/shared.h > rename tools/testing/vma/{vma.c => tests/merge.c} (82%) > create mode 100644 tools/testing/vma/tests/mmap.c > create mode 100644 tools/testing/vma/tests/vma.c > > diff --git a/tools/testing/vma/Makefile b/tools/testing/vma/Makefile > index 66f3831a668f..94133d9d3955 100644 > --- a/tools/testing/vma/Makefile > +++ b/tools/testing/vma/Makefile > @@ -6,10 +6,10 @@ default: vma > > include ../shared/shared.mk > > -OFILES = $(SHARED_OFILES) vma.o maple-shim.o > +OFILES = $(SHARED_OFILES) main.o shared.o maple-shim.o > TARGETS = vma > > -vma.o: vma.c vma_internal.h ../../../mm/vma.c ../../../mm/vma_init.c ../../../mm/vma_exec.c ../../../mm/vma.h > +main.o: main.c shared.c shared.h vma_internal.h tests/merge.c tests/mmap.c tests/vma.c ../../../mm/vma.c ../../../mm/vma_init.c ../../../mm/vma_exec.c ../../../mm/vma.h > > vma: $(OFILES) > $(CC) $(CFLAGS) -o $@ $(OFILES) $(LDLIBS) > diff --git a/tools/testing/vma/main.c b/tools/testing/vma/main.c > new file mode 100644 > index 000000000000..49b09e97a51f > --- /dev/null > +++ b/tools/testing/vma/main.c > @@ -0,0 +1,55 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > + > +#include "shared.h" > +/* > + * Directly import the VMA implementation here. Our vma_internal.h wrapper > + * provides userland-equivalent functionality for everything vma.c uses. > + */ > +#include "../../../mm/vma_init.c" > +#include "../../../mm/vma_exec.c" > +#include "../../../mm/vma.c" > + > +/* Tests are included directly so they can test static functions in mm/vma.c. */ > +#include "tests/merge.c" > +#include "tests/mmap.c" > +#include "tests/vma.c" > + > +/* Helper functions which utilise static kernel functions. */ > + > +struct vm_area_struct *merge_existing(struct vma_merge_struct *vmg) > +{ > + struct vm_area_struct *vma; > + > + vma = vma_merge_existing_range(vmg); > + if (vma) > + vma_assert_attached(vma); > + return vma; > +} > + > +int attach_vma(struct mm_struct *mm, struct vm_area_struct *vma) > +{ > + int res; > + > + res = vma_link(mm, vma); > + if (!res) > + vma_assert_attached(vma); > + return res; > +} > + > +/* Main test running which invokes tests/ *.c runners. */ > +int main(void) > +{ > + int num_tests = 0, num_fail = 0; > + > + maple_tree_init(); > + vma_state_init(); > + > + run_merge_tests(&num_tests, &num_fail); > + run_mmap_tests(&num_tests, &num_fail); > + run_vma_tests(&num_tests, &num_fail); > + > + printf("%d tests run, %d passed, %d failed.\n", > + num_tests, num_tests - num_fail, num_fail); > + > + return num_fail == 0 ? EXIT_SUCCESS : EXIT_FAILURE; > +} > diff --git a/tools/testing/vma/shared.c b/tools/testing/vma/shared.c > new file mode 100644 > index 000000000000..bda578cc3304 > --- /dev/null > +++ b/tools/testing/vma/shared.c > @@ -0,0 +1,131 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > + > +#include "shared.h" > + > + > +bool fail_prealloc; > +unsigned long mmap_min_addr = CONFIG_DEFAULT_MMAP_MIN_ADDR; > +unsigned long dac_mmap_min_addr = CONFIG_DEFAULT_MMAP_MIN_ADDR; > +unsigned long stack_guard_gap = 256UL< + > +const struct vm_operations_struct vma_dummy_vm_ops; > +struct anon_vma dummy_anon_vma; > +struct task_struct __current; > + > +struct vm_area_struct *alloc_vma(struct mm_struct *mm, > + unsigned long start, unsigned long end, > + pgoff_t pgoff, vm_flags_t vm_flags) > +{ > + struct vm_area_struct *vma = vm_area_alloc(mm); > + > + if (vma == NULL) > + return NULL; > + > + vma->vm_start = start; > + vma->vm_end = end; > + vma->vm_pgoff = pgoff; > + vm_flags_reset(vma, vm_flags); > + vma_assert_detached(vma); > + > + return vma; > +} > + > +void detach_free_vma(struct vm_area_struct *vma) > +{ > + vma_mark_detached(vma); > + vm_area_free(vma); > +} > + > +struct vm_area_struct *alloc_and_link_vma(struct mm_struct *mm, > + unsigned long start, unsigned long end, > + pgoff_t pgoff, vm_flags_t vm_flags) > +{ > + struct vm_area_struct *vma = alloc_vma(mm, start, end, pgoff, vm_flags); > + > + if (vma == NULL) > + return NULL; > + > + if (attach_vma(mm, vma)) { > + detach_free_vma(vma); > + return NULL; > + } > + > + /* > + * Reset this counter which we use to track whether writes have > + * begun. Linking to the tree will have caused this to be incremented, > + * which means we will get a false positive otherwise. > + */ > + vma->vm_lock_seq = UINT_MAX; > + > + return vma; > +} > + > +void reset_dummy_anon_vma(void) > +{ > + dummy_anon_vma.was_cloned = false; > + dummy_anon_vma.was_unlinked = false; > +} > + > +int cleanup_mm(struct mm_struct *mm, struct vma_iterator *vmi) > +{ > + struct vm_area_struct *vma; > + int count = 0; > + > + fail_prealloc = false; > + reset_dummy_anon_vma(); > + > + vma_iter_set(vmi, 0); > + for_each_vma(*vmi, vma) { > + detach_free_vma(vma); > + count++; > + } > + > + mtree_destroy(&mm->mm_mt); > + mm->map_count = 0; > + return count; > +} > + > +bool vma_write_started(struct vm_area_struct *vma) > +{ > + int seq = vma->vm_lock_seq; > + > + /* We reset after each check. */ > + vma->vm_lock_seq = UINT_MAX; > + > + /* The vma_start_write() stub simply increments this value. */ > + return seq > -1; > +} > + > +void __vma_set_dummy_anon_vma(struct vm_area_struct *vma, > + struct anon_vma_chain *avc, struct anon_vma *anon_vma) > +{ > + vma->anon_vma = anon_vma; > + INIT_LIST_HEAD(&vma->anon_vma_chain); > + list_add(&avc->same_vma, &vma->anon_vma_chain); > + avc->anon_vma = vma->anon_vma; > +} > + > +void vma_set_dummy_anon_vma(struct vm_area_struct *vma, > + struct anon_vma_chain *avc) > +{ > + __vma_set_dummy_anon_vma(vma, avc, &dummy_anon_vma); > +} > + > +struct task_struct *get_current(void) > +{ > + return &__current; > +} > + > +unsigned long rlimit(unsigned int limit) > +{ > + return (unsigned long)-1; > +} > + > +void vma_set_range(struct vm_area_struct *vma, > + unsigned long start, unsigned long end, > + pgoff_t pgoff) > +{ > + vma->vm_start = start; > + vma->vm_end = end; > + vma->vm_pgoff = pgoff; > +} > diff --git a/tools/testing/vma/shared.h b/tools/testing/vma/shared.h > new file mode 100644 > index 000000000000..6c64211cfa22 > --- /dev/null > +++ b/tools/testing/vma/shared.h > @@ -0,0 +1,114 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > + > +#pragma once > + > +#include > +#include > +#include > + > +#include "generated/bit-length.h" > +#include "maple-shared.h" > +#include "vma_internal.h" > +#include "../../../mm/vma.h" > + > +/* Simple test runner. Assumes local num_[fail, tests] counters. */ > +#define TEST(name) \ > + do { \ > + (*num_tests)++; \ > + if (!test_##name()) { \ > + (*num_fail)++; \ > + fprintf(stderr, "Test " #name " FAILED\n"); \ > + } \ > + } while (0) > + > +#define ASSERT_TRUE(_expr) \ > + do { \ > + if (!(_expr)) { \ > + fprintf(stderr, \ > + "Assert FAILED at %s:%d:%s(): %s is FALSE.\n", \ > + __FILE__, __LINE__, __FUNCTION__, #_expr); \ > + return false; \ > + } \ > + } while (0) > + > +#define ASSERT_FALSE(_expr) ASSERT_TRUE(!(_expr)) > +#define ASSERT_EQ(_val1, _val2) ASSERT_TRUE((_val1) == (_val2)) > +#define ASSERT_NE(_val1, _val2) ASSERT_TRUE((_val1) != (_val2)) > + > +#define IS_SET(_val, _flags) ((_val & _flags) == _flags) > + > +extern bool fail_prealloc; > + > +/* Override vma_iter_prealloc() so we can choose to fail it. */ > +#define vma_iter_prealloc(vmi, vma) \ > + (fail_prealloc ? -ENOMEM : mas_preallocate(&(vmi)->mas, (vma), GFP_KERNEL)) > + > +#define CONFIG_DEFAULT_MMAP_MIN_ADDR 65536 > + > +extern unsigned long mmap_min_addr; > +extern unsigned long dac_mmap_min_addr; > +extern unsigned long stack_guard_gap; > + > +extern const struct vm_operations_struct vma_dummy_vm_ops; > +extern struct anon_vma dummy_anon_vma; > +extern struct task_struct __current; > + > +/* > + * Helper function which provides a wrapper around a merge existing VMA > + * operation. > + * > + * Declared in main.c as uses static VMA function. > + */ > +struct vm_area_struct *merge_existing(struct vma_merge_struct *vmg); > + > +/* > + * Helper function to allocate a VMA and link it to the tree. > + * > + * Declared in main.c as uses static VMA function. > + */ > +int attach_vma(struct mm_struct *mm, struct vm_area_struct *vma); > + > +/* Helper function providing a dummy vm_ops->close() method.*/ > +static inline void dummy_close(struct vm_area_struct *) > +{ > +} > + > +/* Helper function to simply allocate a VMA. */ > +struct vm_area_struct *alloc_vma(struct mm_struct *mm, > + unsigned long start, unsigned long end, > + pgoff_t pgoff, vm_flags_t vm_flags); > + > +/* Helper function to detach and free a VMA. */ > +void detach_free_vma(struct vm_area_struct *vma); > + > +/* Helper function to allocate a VMA and link it to the tree. */ > +struct vm_area_struct *alloc_and_link_vma(struct mm_struct *mm, > + unsigned long start, unsigned long end, > + pgoff_t pgoff, vm_flags_t vm_flags); > + > +/* > + * Helper function to reset the dummy anon_vma to indicate it has not been > + * duplicated. > + */ > +void reset_dummy_anon_vma(void); > + > +/* > + * Helper function to remove all VMAs and destroy the maple tree associated with > + * a virtual address space. Returns a count of VMAs in the tree. > + */ > +int cleanup_mm(struct mm_struct *mm, struct vma_iterator *vmi); > + > +/* Helper function to determine if VMA has had vma_start_write() performed. */ > +bool vma_write_started(struct vm_area_struct *vma); > + > +void __vma_set_dummy_anon_vma(struct vm_area_struct *vma, > + struct anon_vma_chain *avc, struct anon_vma *anon_vma); > + > +/* Provide a simple dummy VMA/anon_vma dummy setup for testing. */ > +void vma_set_dummy_anon_vma(struct vm_area_struct *vma, > + struct anon_vma_chain *avc); > + > +/* Helper function to specify a VMA's range. */ > +void vma_set_range(struct vm_area_struct *vma, > + unsigned long start, unsigned long end, > + pgoff_t pgoff); > diff --git a/tools/testing/vma/vma.c b/tools/testing/vma/tests/merge.c > similarity index 82% > rename from tools/testing/vma/vma.c > rename to tools/testing/vma/tests/merge.c > index 93d21bc7e112..3708dc6945b0 100644 > --- a/tools/testing/vma/vma.c > +++ b/tools/testing/vma/tests/merge.c > @@ -1,132 +1,5 @@ > // SPDX-License-Identifier: GPL-2.0-or-later > > -#include > -#include > -#include > - > -#include "generated/bit-length.h" > - > -#include "maple-shared.h" > -#include "vma_internal.h" > - > -/* Include so header guard set. */ > -#include "../../../mm/vma.h" > - > -static bool fail_prealloc; > - > -/* Then override vma_iter_prealloc() so we can choose to fail it. */ > -#define vma_iter_prealloc(vmi, vma) \ > - (fail_prealloc ? -ENOMEM : mas_preallocate(&(vmi)->mas, (vma), GFP_KERNEL)) > - > -#define CONFIG_DEFAULT_MMAP_MIN_ADDR 65536 > - > -unsigned long mmap_min_addr = CONFIG_DEFAULT_MMAP_MIN_ADDR; > -unsigned long dac_mmap_min_addr = CONFIG_DEFAULT_MMAP_MIN_ADDR; > -unsigned long stack_guard_gap = 256UL< - > -/* > - * Directly import the VMA implementation here. Our vma_internal.h wrapper > - * provides userland-equivalent functionality for everything vma.c uses. > - */ > -#include "../../../mm/vma_init.c" > -#include "../../../mm/vma_exec.c" > -#include "../../../mm/vma.c" > - > -const struct vm_operations_struct vma_dummy_vm_ops; > -static struct anon_vma dummy_anon_vma; > - > -#define ASSERT_TRUE(_expr) \ > - do { \ > - if (!(_expr)) { \ > - fprintf(stderr, \ > - "Assert FAILED at %s:%d:%s(): %s is FALSE.\n", \ > - __FILE__, __LINE__, __FUNCTION__, #_expr); \ > - return false; \ > - } \ > - } while (0) > -#define ASSERT_FALSE(_expr) ASSERT_TRUE(!(_expr)) > -#define ASSERT_EQ(_val1, _val2) ASSERT_TRUE((_val1) == (_val2)) > -#define ASSERT_NE(_val1, _val2) ASSERT_TRUE((_val1) != (_val2)) > - > -#define IS_SET(_val, _flags) ((_val & _flags) == _flags) > - > -static struct task_struct __current; > - > -struct task_struct *get_current(void) > -{ > - return &__current; > -} > - > -unsigned long rlimit(unsigned int limit) > -{ > - return (unsigned long)-1; > -} > - > -/* Helper function to simply allocate a VMA. */ > -static struct vm_area_struct *alloc_vma(struct mm_struct *mm, > - unsigned long start, > - unsigned long end, > - pgoff_t pgoff, > - vm_flags_t vm_flags) > -{ > - struct vm_area_struct *vma = vm_area_alloc(mm); > - > - if (vma == NULL) > - return NULL; > - > - vma->vm_start = start; > - vma->vm_end = end; > - vma->vm_pgoff = pgoff; > - vm_flags_reset(vma, vm_flags); > - vma_assert_detached(vma); > - > - return vma; > -} > - > -/* Helper function to allocate a VMA and link it to the tree. */ > -static int attach_vma(struct mm_struct *mm, struct vm_area_struct *vma) > -{ > - int res; > - > - res = vma_link(mm, vma); > - if (!res) > - vma_assert_attached(vma); > - return res; > -} > - > -static void detach_free_vma(struct vm_area_struct *vma) > -{ > - vma_mark_detached(vma); > - vm_area_free(vma); > -} > - > -/* Helper function to allocate a VMA and link it to the tree. */ > -static struct vm_area_struct *alloc_and_link_vma(struct mm_struct *mm, > - unsigned long start, > - unsigned long end, > - pgoff_t pgoff, > - vm_flags_t vm_flags) > -{ > - struct vm_area_struct *vma = alloc_vma(mm, start, end, pgoff, vm_flags); > - > - if (vma == NULL) > - return NULL; > - > - if (attach_vma(mm, vma)) { > - detach_free_vma(vma); > - return NULL; > - } > - > - /* > - * Reset this counter which we use to track whether writes have > - * begun. Linking to the tree will have caused this to be incremented, > - * which means we will get a false positive otherwise. > - */ > - vma->vm_lock_seq = UINT_MAX; > - > - return vma; > -} > - > /* Helper function which provides a wrapper around a merge new VMA operation. */ > static struct vm_area_struct *merge_new(struct vma_merge_struct *vmg) > { > @@ -146,20 +19,6 @@ static struct vm_area_struct *merge_new(struct vma_merge_struct *vmg) > return vma; > } > > -/* > - * Helper function which provides a wrapper around a merge existing VMA > - * operation. > - */ > -static struct vm_area_struct *merge_existing(struct vma_merge_struct *vmg) > -{ > - struct vm_area_struct *vma; > - > - vma = vma_merge_existing_range(vmg); > - if (vma) > - vma_assert_attached(vma); > - return vma; > -} > - > /* > * Helper function which provides a wrapper around the expansion of an existing > * VMA. > @@ -173,8 +32,8 @@ static int expand_existing(struct vma_merge_struct *vmg) > * Helper function to reset merge state the associated VMA iterator to a > * specified new range. > */ > -static void vmg_set_range(struct vma_merge_struct *vmg, unsigned long start, > - unsigned long end, pgoff_t pgoff, vm_flags_t vm_flags) > +void vmg_set_range(struct vma_merge_struct *vmg, unsigned long start, > + unsigned long end, pgoff_t pgoff, vm_flags_t vm_flags) > { > vma_iter_set(vmg->vmi, start); > > @@ -197,8 +56,8 @@ static void vmg_set_range(struct vma_merge_struct *vmg, unsigned long start, > > /* Helper function to set both the VMG range and its anon_vma. */ > static void vmg_set_range_anon_vma(struct vma_merge_struct *vmg, unsigned long start, > - unsigned long end, pgoff_t pgoff, vm_flags_t vm_flags, > - struct anon_vma *anon_vma) > + unsigned long end, pgoff_t pgoff, vm_flags_t vm_flags, > + struct anon_vma *anon_vma) > { > vmg_set_range(vmg, start, end, pgoff, vm_flags); > vmg->anon_vma = anon_vma; > @@ -211,10 +70,9 @@ static void vmg_set_range_anon_vma(struct vma_merge_struct *vmg, unsigned long s > * VMA, link it to the maple tree and return it. > */ > static struct vm_area_struct *try_merge_new_vma(struct mm_struct *mm, > - struct vma_merge_struct *vmg, > - unsigned long start, unsigned long end, > - pgoff_t pgoff, vm_flags_t vm_flags, > - bool *was_merged) > + struct vma_merge_struct *vmg, unsigned long start, > + unsigned long end, pgoff_t pgoff, vm_flags_t vm_flags, > + bool *was_merged) > { > struct vm_area_struct *merged; > > @@ -234,72 +92,6 @@ static struct vm_area_struct *try_merge_new_vma(struct mm_struct *mm, > return alloc_and_link_vma(mm, start, end, pgoff, vm_flags); > } > > -/* > - * Helper function to reset the dummy anon_vma to indicate it has not been > - * duplicated. > - */ > -static void reset_dummy_anon_vma(void) > -{ > - dummy_anon_vma.was_cloned = false; > - dummy_anon_vma.was_unlinked = false; > -} > - > -/* > - * Helper function to remove all VMAs and destroy the maple tree associated with > - * a virtual address space. Returns a count of VMAs in the tree. > - */ > -static int cleanup_mm(struct mm_struct *mm, struct vma_iterator *vmi) > -{ > - struct vm_area_struct *vma; > - int count = 0; > - > - fail_prealloc = false; > - reset_dummy_anon_vma(); > - > - vma_iter_set(vmi, 0); > - for_each_vma(*vmi, vma) { > - detach_free_vma(vma); > - count++; > - } > - > - mtree_destroy(&mm->mm_mt); > - mm->map_count = 0; > - return count; > -} > - > -/* Helper function to determine if VMA has had vma_start_write() performed. */ > -static bool vma_write_started(struct vm_area_struct *vma) > -{ > - int seq = vma->vm_lock_seq; > - > - /* We reset after each check. */ > - vma->vm_lock_seq = UINT_MAX; > - > - /* The vma_start_write() stub simply increments this value. */ > - return seq > -1; > -} > - > -/* Helper function providing a dummy vm_ops->close() method.*/ > -static void dummy_close(struct vm_area_struct *) > -{ > -} > - > -static void __vma_set_dummy_anon_vma(struct vm_area_struct *vma, > - struct anon_vma_chain *avc, > - struct anon_vma *anon_vma) > -{ > - vma->anon_vma = anon_vma; > - INIT_LIST_HEAD(&vma->anon_vma_chain); > - list_add(&avc->same_vma, &vma->anon_vma_chain); > - avc->anon_vma = vma->anon_vma; > -} > - > -static void vma_set_dummy_anon_vma(struct vm_area_struct *vma, > - struct anon_vma_chain *avc) > -{ > - __vma_set_dummy_anon_vma(vma, avc, &dummy_anon_vma); > -} > - > static bool test_simple_merge(void) > { > struct vm_area_struct *vma; > @@ -1616,39 +1408,6 @@ static bool test_merge_extend(void) > return true; > } > > -static bool test_copy_vma(void) > -{ > - vm_flags_t vm_flags = VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE; > - struct mm_struct mm = {}; > - bool need_locks = false; > - VMA_ITERATOR(vmi, &mm, 0); > - struct vm_area_struct *vma, *vma_new, *vma_next; > - > - /* Move backwards and do not merge. */ > - > - vma = alloc_and_link_vma(&mm, 0x3000, 0x5000, 3, vm_flags); > - vma_new = copy_vma(&vma, 0, 0x2000, 0, &need_locks); > - ASSERT_NE(vma_new, vma); > - ASSERT_EQ(vma_new->vm_start, 0); > - ASSERT_EQ(vma_new->vm_end, 0x2000); > - ASSERT_EQ(vma_new->vm_pgoff, 0); > - vma_assert_attached(vma_new); > - > - cleanup_mm(&mm, &vmi); > - > - /* Move a VMA into position next to another and merge the two. */ > - > - vma = alloc_and_link_vma(&mm, 0, 0x2000, 0, vm_flags); > - vma_next = alloc_and_link_vma(&mm, 0x6000, 0x8000, 6, vm_flags); > - vma_new = copy_vma(&vma, 0x4000, 0x2000, 4, &need_locks); > - vma_assert_attached(vma_new); > - > - ASSERT_EQ(vma_new, vma_next); > - > - cleanup_mm(&mm, &vmi); > - return true; > -} > - > static bool test_expand_only_mode(void) > { > vm_flags_t vm_flags = VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE; > @@ -1689,73 +1448,8 @@ static bool test_expand_only_mode(void) > return true; > } > > -static bool test_mmap_region_basic(void) > -{ > - struct mm_struct mm = {}; > - unsigned long addr; > - struct vm_area_struct *vma; > - VMA_ITERATOR(vmi, &mm, 0); > - > - current->mm = &mm; > - > - /* Map at 0x300000, length 0x3000. */ > - addr = __mmap_region(NULL, 0x300000, 0x3000, > - VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE, > - 0x300, NULL); > - ASSERT_EQ(addr, 0x300000); > - > - /* Map at 0x250000, length 0x3000. */ > - addr = __mmap_region(NULL, 0x250000, 0x3000, > - VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE, > - 0x250, NULL); > - ASSERT_EQ(addr, 0x250000); > - > - /* Map at 0x303000, merging to 0x300000 of length 0x6000. */ > - addr = __mmap_region(NULL, 0x303000, 0x3000, > - VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE, > - 0x303, NULL); > - ASSERT_EQ(addr, 0x303000); > - > - /* Map at 0x24d000, merging to 0x250000 of length 0x6000. */ > - addr = __mmap_region(NULL, 0x24d000, 0x3000, > - VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE, > - 0x24d, NULL); > - ASSERT_EQ(addr, 0x24d000); > - > - ASSERT_EQ(mm.map_count, 2); > - > - for_each_vma(vmi, vma) { > - if (vma->vm_start == 0x300000) { > - ASSERT_EQ(vma->vm_end, 0x306000); > - ASSERT_EQ(vma->vm_pgoff, 0x300); > - } else if (vma->vm_start == 0x24d000) { > - ASSERT_EQ(vma->vm_end, 0x253000); > - ASSERT_EQ(vma->vm_pgoff, 0x24d); > - } else { > - ASSERT_FALSE(true); > - } > - } > - > - cleanup_mm(&mm, &vmi); > - return true; > -} > - > -int main(void) > +static void run_merge_tests(int *num_tests, int *num_fail) > { > - int num_tests = 0, num_fail = 0; > - > - maple_tree_init(); > - vma_state_init(); > - > -#define TEST(name) \ > - do { \ > - num_tests++; \ > - if (!test_##name()) { \ > - num_fail++; \ > - fprintf(stderr, "Test " #name " FAILED\n"); \ > - } \ > - } while (0) > - > /* Very simple tests to kick the tyres. */ > TEST(simple_merge); > TEST(simple_modify); > @@ -1771,15 +1465,5 @@ int main(void) > TEST(dup_anon_vma); > TEST(vmi_prealloc_fail); > TEST(merge_extend); > - TEST(copy_vma); > TEST(expand_only_mode); > - > - TEST(mmap_region_basic); > - > -#undef TEST > - > - printf("%d tests run, %d passed, %d failed.\n", > - num_tests, num_tests - num_fail, num_fail); > - > - return num_fail == 0 ? EXIT_SUCCESS : EXIT_FAILURE; > } > diff --git a/tools/testing/vma/tests/mmap.c b/tools/testing/vma/tests/mmap.c > new file mode 100644 > index 000000000000..bded4ecbe5db > --- /dev/null > +++ b/tools/testing/vma/tests/mmap.c > @@ -0,0 +1,57 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > + > +static bool test_mmap_region_basic(void) > +{ > + struct mm_struct mm = {}; > + unsigned long addr; > + struct vm_area_struct *vma; > + VMA_ITERATOR(vmi, &mm, 0); > + > + current->mm = &mm; > + > + /* Map at 0x300000, length 0x3000. */ > + addr = __mmap_region(NULL, 0x300000, 0x3000, > + VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE, > + 0x300, NULL); > + ASSERT_EQ(addr, 0x300000); > + > + /* Map at 0x250000, length 0x3000. */ > + addr = __mmap_region(NULL, 0x250000, 0x3000, > + VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE, > + 0x250, NULL); > + ASSERT_EQ(addr, 0x250000); > + > + /* Map at 0x303000, merging to 0x300000 of length 0x6000. */ > + addr = __mmap_region(NULL, 0x303000, 0x3000, > + VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE, > + 0x303, NULL); > + ASSERT_EQ(addr, 0x303000); > + > + /* Map at 0x24d000, merging to 0x250000 of length 0x6000. */ > + addr = __mmap_region(NULL, 0x24d000, 0x3000, > + VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE, > + 0x24d, NULL); > + ASSERT_EQ(addr, 0x24d000); > + > + ASSERT_EQ(mm.map_count, 2); > + > + for_each_vma(vmi, vma) { > + if (vma->vm_start == 0x300000) { > + ASSERT_EQ(vma->vm_end, 0x306000); > + ASSERT_EQ(vma->vm_pgoff, 0x300); > + } else if (vma->vm_start == 0x24d000) { > + ASSERT_EQ(vma->vm_end, 0x253000); > + ASSERT_EQ(vma->vm_pgoff, 0x24d); > + } else { > + ASSERT_FALSE(true); > + } > + } > + > + cleanup_mm(&mm, &vmi); > + return true; > +} > + > +static void run_mmap_tests(int *num_tests, int *num_fail) > +{ > + TEST(mmap_region_basic); > +} > diff --git a/tools/testing/vma/tests/vma.c b/tools/testing/vma/tests/vma.c > new file mode 100644 > index 000000000000..6d9775aee243 > --- /dev/null > +++ b/tools/testing/vma/tests/vma.c > @@ -0,0 +1,39 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > + > +static bool test_copy_vma(void) > +{ > + vm_flags_t vm_flags = VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE; > + struct mm_struct mm = {}; > + bool need_locks = false; > + VMA_ITERATOR(vmi, &mm, 0); > + struct vm_area_struct *vma, *vma_new, *vma_next; > + > + /* Move backwards and do not merge. */ > + > + vma = alloc_and_link_vma(&mm, 0x3000, 0x5000, 3, vm_flags); > + vma_new = copy_vma(&vma, 0, 0x2000, 0, &need_locks); > + ASSERT_NE(vma_new, vma); > + ASSERT_EQ(vma_new->vm_start, 0); > + ASSERT_EQ(vma_new->vm_end, 0x2000); > + ASSERT_EQ(vma_new->vm_pgoff, 0); > + vma_assert_attached(vma_new); > + > + cleanup_mm(&mm, &vmi); > + > + /* Move a VMA into position next to another and merge the two. */ > + > + vma = alloc_and_link_vma(&mm, 0, 0x2000, 0, vm_flags); > + vma_next = alloc_and_link_vma(&mm, 0x6000, 0x8000, 6, vm_flags); > + vma_new = copy_vma(&vma, 0x4000, 0x2000, 4, &need_locks); > + vma_assert_attached(vma_new); > + > + ASSERT_EQ(vma_new, vma_next); > + > + cleanup_mm(&mm, &vmi); > + return true; > +} > + > +static void run_vma_tests(int *num_tests, int *num_fail) > +{ > + TEST(copy_vma); > +} > diff --git a/tools/testing/vma/vma_internal.h b/tools/testing/vma/vma_internal.h > index 2743f12ecf32..b48ebae3927d 100644 > --- a/tools/testing/vma/vma_internal.h > +++ b/tools/testing/vma/vma_internal.h > @@ -1127,15 +1127,6 @@ static inline void mapping_allow_writable(struct address_space *mapping) > atomic_inc(&mapping->i_mmap_writable); > } > > -static inline void vma_set_range(struct vm_area_struct *vma, > - unsigned long start, unsigned long end, > - pgoff_t pgoff) > -{ > - vma->vm_start = start; > - vma->vm_end = end; > - vma->vm_pgoff = pgoff; > -} > - > static inline > struct vm_area_struct *vma_find(struct vma_iterator *vmi, unsigned long max) > { > -- > 2.52.0 >