linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Shivansh Vij <shivanshvij@outlook.com>
To: Ryan Roberts <ryan.roberts@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Shuah Khan <shuah@kernel.org>, Joey Gouly <joey.gouly@arm.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	David Hildenbrand <david@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH v1 0/5] arm64/mm: uffd write-protect and soft-dirty tracking
Date: Fri, 19 Apr 2024 08:19:33 +0000	[thread overview]
Message-ID: <lv6dp1ct.e4f5aac7-e361-4fa2-98ec-60ee334a859e@we.are.superhuman.com> (raw)
In-Reply-To: <24999e38-e4f7-4616-8eae-dfdeba327558@arm.com>

[-- Attachment #1: Type: text/plain, Size: 3247 bytes --]

Hey All,

On Fri, Apr 19, 2024 at 3:47 AM, Ryan Roberts <ryan.roberts@arm.com<mailto:ryan.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 support for arm64. I consider the soft-dirty support (patches 3 and 4) as RFC - see rationale 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 overlay PTE_UXN in patch 1, freeing up the SW bit. Bit 63 is marked as "IGNORED" 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 that 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-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 keep 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 more generic uffd-wp. So unless somebody makes a clear case for the inclusion of soft-dirty 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 soft-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 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 focused 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-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 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 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 (albeit one requiring slightly more work).




[-- Attachment #2: Type: text/html, Size: 8365 bytes --]

      reply	other threads:[~2024-04-19  8:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19  7:43 Ryan Roberts
2024-04-19  7:43 ` [PATCH v1 1/5] arm64/mm: Move PTE_PROT_NONE and PMD_PRESENT_INVALID Ryan Roberts
2024-04-19  7:43 ` [PATCH v1 2/5] arm64/mm: Add uffd write-protect support Ryan Roberts
2024-04-19  7:43 ` [RFC PATCH v1 3/5] arm64/mm: Add soft-dirty page tracking support Ryan Roberts
2024-04-19  7:43 ` [RFC PATCH v1 4/5] selftests/mm: Enable soft-dirty tests on arm64 Ryan Roberts
2024-04-19  7:43 ` [PATCH v1 5/5] selftests/mm: soft-dirty should fail if a testcase fails Ryan Roberts
2024-04-22  9:33   ` David Hildenbrand
2024-04-23  8:24     ` Ryan Roberts
2024-04-23  8:44       ` Muhammad Usama Anjum
2024-04-24 10:40         ` Ryan Roberts
2024-04-19  7:47 ` [PATCH v1 0/5] arm64/mm: uffd write-protect and soft-dirty tracking Ryan Roberts
2024-04-19  8:19   ` Shivansh Vij [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lv6dp1ct.e4f5aac7-e361-4fa2-98ec-60ee334a859e@we.are.superhuman.com \
    --to=shivanshvij@outlook.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=david@redhat.com \
    --cc=joey.gouly@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mark.rutland@arm.com \
    --cc=ryan.roberts@arm.com \
    --cc=shuah@kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox