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 2B754C4345F for ; Fri, 19 Apr 2024 08:19:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7495F6B0083; Fri, 19 Apr 2024 04:19:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F7F76B0085; Fri, 19 Apr 2024 04:19:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 598B26B0087; Fri, 19 Apr 2024 04:19:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 367206B0083 for ; Fri, 19 Apr 2024 04:19:40 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A1D54A0BE2 for ; Fri, 19 Apr 2024 08:19:39 +0000 (UTC) X-FDA: 82025582478.21.46E759D Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10olkn2028.outbound.protection.outlook.com [40.92.41.28]) by imf08.hostedemail.com (Postfix) with ESMTP id AB0E7160010 for ; Fri, 19 Apr 2024 08:19:36 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=iU7wBJJ4; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf08.hostedemail.com: domain of shivanshvij@outlook.com designates 40.92.41.28 as permitted sender) smtp.mailfrom=shivanshvij@outlook.com; dmarc=pass (policy=none) header.from=outlook.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713514776; 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=pml2w5mp/wnmcM8/WCRydXv9OogryYC/wEGQdQkruB0=; b=kYSxthlTW11rRUFRAtumZ0a/l6da5OYd8oPOgjlw+87aqqLfEL2x3VJf9AuXgQDA/L2cUK zR9jc+0oq6KyxVNkHeEtYErOr+AwbGIoPklDiaDZg0Qm+ecHiaG35+xj3i8A3dRimPGYlz itHFW6BqVAzJ087OEhDMdBd/weVQLJM= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=iU7wBJJ4; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf08.hostedemail.com: domain of shivanshvij@outlook.com designates 40.92.41.28 as permitted sender) smtp.mailfrom=shivanshvij@outlook.com; dmarc=pass (policy=none) header.from=outlook.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1713514776; a=rsa-sha256; cv=pass; b=V4eOrWj7EOpv+7Xa4p4fm9uFpboKaEm1QDOeJucv7LFX7J5F+mOL0CWKD/24V3H/eaQuS1 crSkevDYugq5E15ve7/UX7m68aZXscHqzaq6TIJyBjinCcpVL1lDM5xNjsIoUy09KTziQc g7TrQ1iQ6nrqEjy6R/puGRgtOK+Z8Zo= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G9nqHim1FBFi4vHlmhJS59Waw/JJxAxUwnTkFcQ03w/a0idpn7ipVoSXBb8VylXfF5L4ZycgCP3LprwFqAX9iI1ATeh+hLq6Z1oW47zkuQzDegS3FvC3RHS3HzruE27HAAKjMiIJ2YyZTpptKVvH0zwOMIynvXDeW+U8d01j7xmBmeXCoiW0QuNiJMFBzJy2FHdqse/ukKCRvvzo6aRDe5vLnavO+rR28rhJiszR5WmrRBGTdn3o0dkyqtYyDiaRKV9Y6buA/X30Frd3h0C9kn5sOzcabd/9WN5EgQCkBXqGBM3AMA7Q7apmLZI38MU7HKjygZSF7twrlFsHfHY0tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=pml2w5mp/wnmcM8/WCRydXv9OogryYC/wEGQdQkruB0=; b=kd+76mkQsDnm+J7ZVUN+FRcE/GxeZIGzta7Sj+PZ2kaonByGQoTZYItfzn5JS/lEIXumJemoUa6jzxhGWcrRIN8TjtUglSyFlSMj5SpXoEV0KPaWEMLWDqANc1juhXOswJ1IpamgR7S8BoUo/wwPJQVRgJvEgn4+/9K+um4FslaDRcJm098hHcUmzBqMVFq3iwLy4Zu6UK5i4RwXyomcSZhMD/t1bBq8bgYv4jM/ac4r9w3ArcmnwsRi5M7JY7KrRA7FJdFK3TCp3CGXWMcwxCLgrYH0adL1R6glsVOm64kK3HIeBagyh80yDhdHWhTCbhf5NJ0lvpxphEFLtPs3Ig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pml2w5mp/wnmcM8/WCRydXv9OogryYC/wEGQdQkruB0=; b=iU7wBJJ4R3o3d/h2oBa1q5NWWrNxVfZg0ISMt7YGmg+r2EEMxqXg5FbsV7HC5lWhcthKrCmJ4YYmA2m+XkACHr8pAT5hxm9sUu7/R30Cs/AB8i7tNSbU4Dm5RTlV6aQtKJQHw9c1cr/PFQiW4oMHVd6HB9fdl8PBgW66EqbOs8LlAiqGdfJG8qjNmgoT+EiLv2W9HaOfp8rJaJkbfqIM/G7OqzcVQ8n5OMs9sCkd9OpIAhXIAfUeRuCECfvZz14YyYKzNHW5RiXDqs6fFuGMNl8XpemtZM0HhJC45XZZ6rshs0GnD6JXHE7bzSW/bi/QXT/jlMusUoyAMBI/bzSrDA== Received: from MW4PR12MB6875.namprd12.prod.outlook.com (2603:10b6:303:209::5) by BL3PR12MB6594.namprd12.prod.outlook.com (2603:10b6:208:38d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.43; Fri, 19 Apr 2024 08:19:33 +0000 Received: from MW4PR12MB6875.namprd12.prod.outlook.com ([fe80::f933:4f7d:1a1e:d7c4]) by MW4PR12MB6875.namprd12.prod.outlook.com ([fe80::f933:4f7d:1a1e:d7c4%7]) with mapi id 15.20.7472.037; Fri, 19 Apr 2024 08:19:33 +0000 From: Shivansh Vij To: Ryan Roberts CC: Catalin Marinas , Will Deacon , Andrew Morton , Shuah Khan , Joey Gouly , Ard Biesheuvel , Mark Rutland , Anshuman Khandual , David Hildenbrand , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kselftest@vger.kernel.org" Subject: Re: [PATCH v1 0/5] arm64/mm: uffd write-protect and soft-dirty tracking Thread-Topic: [PATCH v1 0/5] arm64/mm: uffd write-protect and soft-dirty tracking Thread-Index: AQHaki1WdjYIu4CfuECqPGqYndfIFbFvNzIAgAAJELg= Date: Fri, 19 Apr 2024 08:19:33 +0000 Message-ID: References: <20240419074344.2643212-1-ryan.roberts@arm.com> <24999e38-e4f7-4616-8eae-dfdeba327558@arm.com> In-Reply-To: <24999e38-e4f7-4616-8eae-dfdeba327558@arm.com> Accept-Language: en-CA, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-superhuman-id: lv6eg7oe.028cd914-3a68-4900-9573-9d58e07a6d5b x-superhuman-draft-id: draft00f0d34ec9b0a623 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [w2fIHpdUIZVOGwpEsnSbyOQCVRuUpsNt] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR12MB6875:EE_|BL3PR12MB6594:EE_ x-ms-office365-filtering-correlation-id: 56298378-81ba-418e-2e78-08dc60497166 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 60lJZZGk8I1w8uGYE+PzvCB/vu/Bj82U+jxqDjv18DUekrA/Q4zDKP3hXUUa00r5t6ivYqMbT7AYcuqHp0lUMRrsByqDUAXj/V7RCBJDuFxFjft5OuMfz3zxYi0AWi1xyqcLSPh2Y6bIyfWw4HJJGyMCC4nF2cx6WoB/+fQSg1qdhSavt7fG2Ls5Ju6WH77EzmDCrnj86g00/xPpadphHuLNFNXD9BkmqRh9FweiVRA4JjTG3+jhTbbPsq+prlM8tID739E4AYrS7UhumlJf74yNwY1PcEJ5pWVA9W62RY8kX6JxGB6N/QhdAo4I5HodlPhi48/AvmDCkcw2lbzNA5soLuEby7gkgSUhKkjvJdrTJ1rXZlZYNkNZvkTy6J6c1TmJ6FgIlNBT5xLc99UdJQvu5dKcZiM0d8hHJ1xuqXIPiSb5dJDS6YJcGAOGjnHccgOL3NB7eBRJer9oTfuASFBUC1fEv3iBXIBXjs3eKTwOLtvR8WTRQzJTIzSl0rdyKPornJYpiJlG0HCuvLmgjc9D0U5m3kubXiLfjlNx6VX6qDbKMLWN+P4SGnfYIQMKSHXgtJmB4TjCiBWuvftnfYYcyX1DOjH6WDe4skFD7ES2AbX/uPozPH+wBK/Y9anOMTxk0Q0Qt4sa+7e+d4bMYzwI1KGROH3gPI5BzoIYp7lg0XS3gLTHWmHkbp8jf7ubB0WYGMtHbfCQqwRJ2GQSOw== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?s7FiMLiURt6QVp1dUSs+LkWAvVjrq6pE5UGgw1LeZ+zsF9qBIC56itOfPNHk?= =?us-ascii?Q?U76GfnIiUY3Cst0gTt2gAnGzrrPtmVVx5AuF8tYcE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2DFR2w2dAuGFRDoHcq+iXZ3TgZJw1sTtDj2Z/OIkhqO/D?= =?us-ascii?Q?Uc9HDMcqF+LUksf/08ZRHBfYWdHnfccfLtbP535pxpS3D8p7iOtlyktuuZqY?= =?us-ascii?Q?mEgF6WD8sTsC3yGuA4x9bHwcCaZ924L15+QqKHKBUaKCawFfQf0adCFMCbwZ?= =?us-ascii?Q?YrRU5LDvkH1n8R4WlZTYdPnQfQSktRlaUvFU3GbnIXXw/B+V3UFhiHW/+Bsw?= =?us-ascii?Q?AVPafDE06k5bW+XbI0rklUCO99mm++8A4RmgzAaPDUcaxf8nKWhRmpJXou8?= =?us-ascii?Q?=3D?= Content-Type: multipart/alternative; boundary="_000_lv6dp1cte4f5aac7e3614fa298ec60ee334a859ewearesuperhuman_" MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR12MB6875.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 56298378-81ba-418e-2e78-08dc60497166 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2024 08:19:33.1151 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6594 X-Stat-Signature: byx346p8usq5ngs1zpf95wqtgrdxn8nt X-Rspamd-Queue-Id: AB0E7160010 X-Rspamd-Server: rspam10 X-Rspam-User: X-HE-Tag: 1713514776-147479 X-HE-Meta: U2FsdGVkX19MUZVmoFuy6zeXSyc6yPo38F0E6XmJPRO7hprfVCEx/SNtyJZkImTqFlBjL3iALmoQAgNsYiSpT+eoMbx21fWtJ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w2awOj6ejMMSZBDPToh+p2Drw0xrRnLPWMZ8BPote+64BVfP3S24RtW3XBZNwTF0+YGFT31MXuVC5mYSzSc2Uqi0Xxrc+WdTE+JTpgeWFi+WszCBy3p5YF37Gkw+2DIfEuFFyBu3GX0z5eeS7Kzzw0JM50ceA3cTttKYKHLUCopaN43MDphYS1pFSoGvDoty8O3HTZnH9rple32avshuzy2o5IiAkp4v4uoTYyiPe6i1HNEgiGLCM4IyNYUi0NZ7pEy6gnG0W1bXzKmgAR4Y8mzBeTTmuMG8z1xSLFx6PkY/YpUPyW9iZa16loR3iEIY851VE7+OO8fNAbDq/XYbunnHS1bi0ZkPZbdZpYJDHHVWD/UE/EgQ9ZyQdIh1nUSxXvNgWtkgTurNESd8ZBBbn3FFhDz9h9aGkHdT9WYN2q8bs+lxx74LIXW3yqfNQY1M6bGdeYCyHmwnZ6/qENLPwpzghzJbsytjrfX0IbWQ/XLPjjH+8KIAA== 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: --_000_lv6dp1cte4f5aac7e3614fa298ec60ee334a859ewearesuperhuman_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hey All, On Fri, Apr 19, 2024 at 3:47 AM, Ryan Roberts > wrote: On 19/04/2024 08:43, Ryan Roberts wrote: Hi All, This series adds uffd write-protect and soft-dirty tracking support for arm= 64. I consider the soft-dirty support (patches 3 and 4) as RFC - see ration= ale below. Previous attempts to add these features have failed because of a perceived = lack of available PTE SW bits. However it actually turns out that there are= 2 available but they are hidden. PTE_PROT_NONE was previously occupying a = SW bit, but it only applies when PTE_VALID is clear, so this is moved to ov= erlay PTE_UXN in patch 1, freeing up the SW bit. Bit 63 is marked as "IGNOR= ED" in the Arm ARM, but it does not currently indicate "reserved for SW use= " like it does for the other SW bits. I've confirmed with the spec owner th= at this is an oversight; the bit is intended to be reserved for SW use and = the spec will clarify this in a future update. So we have our two bits; patch 2 enables uffd-wp, patch 3 enables soft-dirt= y and patches 4 and 5 sort out the selftests so that the soft-dirty tests a= re compiled for, and run on arm64. That said, these are the last 2 SW bits and we may want to keep 1 bit in re= serve for future use. soft-dirty is only used for CRIU to my knowledge, and= it is thought that their use case could be solved with the more generic uf= fd-wp. So unless somebody makes a clear case for the inclusion of soft-dirt= y support, we are probably better off dropping patches 3 and 4 and keeping = bit 63 for future use. Although note that the most recent attempt to add so= ft-dirty for arm64 was last month [1] so I'd like to give Shivansh Vij the = opportunity to make the case. Ugh, forgot to mention that this applies on top of v6.9-rc3, and all the uf= fd-wp and soft-dirty tests in the mm selftests suite run and pass. And no r= egressions are observed in any of the other selftests. Appreciate the opportunity to provide input here. I personally don't know of any applications other than CRIU that make heavy= use of soft-dirty, and my use case is specifically focused on adding live-= migration support to CRIU on ARM. Cloud providers like AWS have pretty massive discounts for ARM-based spot i= nstances (90% last time I checked), and having live-migration in CRIU would= allow more applications to take advantage of that. As Ryan mentioned, there are two ways to achieve this - add dirty tracking = to ARM (Patch 3/4), or tear out the existing dirty tracking code in CRIU an= d replace it with uffd-wp. I picked option one (dirty tracking in arm) because it seems to be the simp= lest way to move forward, whereas it would be a relatively heavy effort to = add uffd-wp support to CRIU. >From a performance perspective I am also a little worried that uffd will be= slower than just tracking the dirty bits asynchronously with sw dirty, but= maybe that's not as much of a concern with the addition of uffd-wp async. With all this being said, I'll defer to the wisdom of the crowd about which= approach makes more sense - after all, with this patch we should get uffd-= wp support on arm so at least there will be _a_ way forward for CRIU (albei= t one requiring slightly more work). --_000_lv6dp1cte4f5aac7e3614fa298ec60ee334a859ewearesuperhuman_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Hey All,

On Fri, Apr 19, 2024 at 3:47 AM, Ryan Roberts <ry= an.roberts@arm.com> wrote:

On 19/04/2024 08:43, Ryan Roberts wrote:

Hi All,

This series adds uffd write-protect and soft-dirty tracking s= upport for arm64. I consider the soft-dirty support (patches 3 and 4) as RF= C - see rationale below.

Previous attempts to add these features have failed because o= f a perceived lack of available PTE SW bits. However it actually turns out = that there are 2 available but they are hidden. PTE_PROT_NONE was previousl= y occupying a SW bit, but it only applies when PTE_VALID is clear, so this is moved to overlay PTE_UXN in pa= tch 1, freeing up the SW bit. Bit 63 is marked as "IGNORED" in th= e Arm ARM, but it does not currently indicate "reserved for SW use&quo= t; like it does for the other SW bits. I've confirmed with the spec owner that this is an oversight; the bit is intended to be r= eserved for SW use and the spec will clarify this in a future update.

So we have our two bits; patch 2 enables uffd-wp, patch 3 ena= bles soft-dirty and patches 4 and 5 sort out the selftests so that the soft= -dirty tests are compiled for, and run on arm64.

That said, these are the last 2 SW bits and we may want to ke= ep 1 bit in reserve for future use. soft-dirty is only used for CRIU to my = knowledge, and it is thought that their use case could be solved with the m= ore generic uffd-wp. So unless somebody makes a clear case for the inclusion of soft-dirty support, we are probabl= y better off dropping patches 3 and 4 and keeping bit 63 for future use. Al= though note that the most recent attempt to add soft-dirty for arm64 was la= st month [1] so I'd like to give Shivansh Vij the opportunity to make the case.

Ugh, forgot to mention that this applies on top of v6.9-rc3, = and all the uffd-wp and soft-dirty tests in the mm selftests suite run and = pass. And no regressions are observed in any of the other selftests.


Appreciate the opportunity to provide input here. = ;

I personally don't know of any applications other than= CRIU that make heavy use of soft-dirty, and my use case is specifically fo= cused on adding live-migration support to CRIU on ARM. 

Cloud providers like AWS have pretty massive discounts for = ARM-based spot instances (90% last time I checked), and having live-migrati= on in CRIU would allow more applications to take advantage of that.

As Ryan mentioned, there are two ways to achieve this = - add dirty tracking to ARM (Patch 3/4), or tear out the existing dirt= y tracking code in CRIU and replace it with uffd-wp. 

I picked option one (dirty tracking in arm) because it= seems to be the simplest way to move forward, whereas it would&n= bsp;be a relatively heavy effort to add uffd-wp support to CRIU. =

From a performance perspective I am also a little worr= ied that uffd will be slower than just tracking the dirty bits asynchronously with sw dirty, but maybe that's not = as much of a concern with the addition of uffd-wp async. 

With all this being said, I'll defer to the wisdom of the c= rowd about which approach makes more sense - after all, with this patc= h we should get uffd-wp support on arm so at least there will be = _a_ way forward for CRIU (albeit one requiring slightly more work). 


3D"
--_000_lv6dp1cte4f5aac7e3614fa298ec60ee334a859ewearesuperhuman_--