linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@linux.ibm.com>
To: David Hildenbrand <david@redhat.com>
Cc: Shivansh Vij <shivanshvij@outlook.com>,
	Ryan Roberts <ryan.roberts@arm.com>,
	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>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.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 19:30:44 +0300	[thread overview]
Message-ID: <ZiKcNJ0Qw2awRwaa@linux.ibm.com> (raw)
In-Reply-To: <c936083b-68b7-4d8f-a8fc-d188e646f390@redhat.com>

On Fri, Apr 19, 2024 at 11:45:14AM +0200, David Hildenbrand wrote:
> On 19.04.24 10:33, Shivansh Vij 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.
> > > > 
> > > > 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.
> > 
> > Appreciate the opportunity to provide input here.
> > 
> > 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).
> 
> Ccing Mike and Peter. In 2017, Mike gave a presentation "Memory tracking for
> iterative container migration"[1] at LPC
> 
> Some key points are still true I think:
> (1) More flexible and robust than soft-dirty
> (2) May obsolete soft-dirty
> 
> We further recently added a new UFFD_FEATURE_WP_ASYNC feature as part of
> [2], because getting soft-dirty return reliable results in some cases turned
> out rather hard to fix.
> 
> We might still have to optimize that approach for some very sparse large
> VMAs, but that should be solvable.
> 
>  "The major defect of this approach of dirty tracking is we need to
>  populate the pgtables when tracking starts. Soft-dirty doesn't do it
>  like that. It's unwanted in the case where the range of memory to track
>  is huge and unpopulated (e.g., tracking updates on a 10G file with
>  mmap() on top, without having any page cache installed yet). One way to
>  improve this is to allow pte markers exist for larger than PTE level
>  for PMD+. That will not change the interface if to implemented, so we
>  can leave that for later.")[3]
> 
> 
> If we can avoid adding soft-dirty on arm64 that would be great. This will
> require work on the CRIU side. One downside of uffd-wp is that it is
> currently not as avilable on architectures as soft-dirty.

Using uffd-wp instead of soft-dirty in CRIU will require quite some work on
CRIU side and probably on the kernel side too.

And as of now we'll anyway have to maintain soft-dirty because powerpc and
s390 don't have uffd-wp.

With UFFD_FEATURE_WP_ASYNC the concern that uffd-wp will be slower than
soft-dirty probably doesn't exist, but we won't know for sure until
somebody will try.

But there were other limitations, the most prominent was checkpointing an
application that uses uffd. If CRIU is to use uffd-wp for tracking of the
dirty pages, there should be some support for multiple uffd contexts for a
VMA and that's surely a lot of work.

> But I'll throw in another idea: do we really need soft-dirty and uffd-wp to
> exist at the same time in the same process (or the VMA?). In theory, we

For instance to have dirty memory tracking in CRIU for an application that
uses uffd-wp :) 

> could have a VMA flag that defines the semantics of the bit and simply have
> arch code use a single, abstracted PTE bit. Requires a bit more work,
> though, but the benfit would be that architecturs that do support soft-dirty
> could support uffd-wp.
> 
> [1] https://blog.linuxplumbersconf.org/2017/ocw//system/presentations/4724/original/Memory%20tracking%20for%20iterative%20container%20migration.pdf
> [2] https://lore.kernel.org/all/20230821141518.870589-1-usama.anjum@collabora.com/
> [3] https://lore.kernel.org/all/20230821141518.870589-2-usama.anjum@collabora.com/
> 
> -- 
> Cheers,
> 
> David / dhildenb
> 

-- 
Sincerely yours,
Mike.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19  7:43 [PATCH v1 0/5] arm64/mm: uffd write-protect and soft-dirty tracking 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:33   ` Shivansh Vij
2024-04-19  9:45     ` David Hildenbrand
2024-04-19 16:30       ` Mike Rapoport [this message]
2024-04-19 17:12         ` David Hildenbrand
2024-04-23  8:49           ` Ryan Roberts
2024-04-23 19:32             ` Shivansh Vij
2024-04-23 21:02               ` David Hildenbrand
2024-04-24 10:39                 ` Ryan Roberts
2024-04-24 11:02                   ` Catalin Marinas
2024-04-23 20:56             ` David Hildenbrand

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=ZiKcNJ0Qw2awRwaa@linux.ibm.com \
    --to=rppt@linux.ibm.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=mark.rutland@arm.com \
    --cc=ryan.roberts@arm.com \
    --cc=shivanshvij@outlook.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;
as well as URLs for NNTP newsgroup(s).