[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z0DL_jL4Tw_Z1LKD@casper.infradead.org>
Date: Fri, 22 Nov 2024 18:22:54 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Elliot Berman <quic_eberman@...cinc.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Sean Christopherson <seanjc@...gle.com>,
Fuad Tabba <tabba@...gle.com>,
Ackerley Tng <ackerleytng@...gle.com>,
Mike Rapoport <rppt@...nel.org>,
David Hildenbrand <david@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, Jonathan Corbet <corbet@....net>,
Trond Myklebust <trondmy@...nel.org>,
Anna Schumaker <anna@...nel.org>,
Mike Marshall <hubcap@...ibond.com>,
Martin Brandenburg <martin@...ibond.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
James Gowans <jgowans@...zon.com>, Mike Day <michael.day@....com>,
linux-fsdevel@...r.kernel.org, kvm@...r.kernel.org,
linux-coco@...ts.linux.dev, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-doc@...r.kernel.org, linux-nfs@...r.kernel.org,
devel@...ts.orangefs.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v5 1/2] filemap: Pass address_space mapping to
->free_folio()
On Fri, Nov 22, 2024 at 09:29:38AM -0800, Elliot Berman wrote:
> When guest_memfd becomes a library, a callback will need to be made to
> the owner (KVM SEV) to update the RMP entry for the page back to shared
> state. This is currently being done as part of .free_folio() operation,
> but this callback shouldn't assume that folio->mapping is set/valid.
I think this could be slightly clearer ...
guest_memfd wants to inform the owner of the page that the folio has
been removed from the mapping. The best place to do this is in the
free_folio() callback, but the folio's mapping pointer has already been
cleared. Pass the mapping in so that the callback knows which mapping
the folio has been removed from.
> ---
> Documentation/filesystems/locking.rst | 2 +-
Because life is hard, we also have documentation in vfs.rst. Can you
please update that one too?
> +++ b/virt/kvm/guest_memfd.c
> @@ -358,7 +358,8 @@ static int kvm_gmem_error_folio(struct address_space *mapping, struct folio *fol
> }
>
> #ifdef CONFIG_HAVE_KVM_ARCH_GMEM_INVALIDATE
> -static void kvm_gmem_free_folio(struct folio *folio)
> +static void kvm_gmem_free_folio(struct address_space *mapping,
> + struct folio *folio)
> {
> struct page *page = folio_page(folio, 0);
> kvm_pfn_t pfn = page_to_pfn(page);
You could just use folio_pfn() here; maybe sneak it in as part of this
patch or do a separate patch for it.
Powered by blists - more mailing lists