linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Elliot Berman <quic_eberman@quicinc.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Sean Christopherson <seanjc@google.com>,
	Fuad Tabba <tabba@google.com>,
	Ackerley Tng <ackerleytng@google.com>,
	Mike Rapoport <rppt@kernel.org>,
	David Hildenbrand <david@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Trond Myklebust <trondmy@kernel.org>,
	Anna Schumaker <anna@kernel.org>,
	Mike Marshall <hubcap@omnibond.com>,
	Martin Brandenburg <martin@omnibond.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	James Gowans <jgowans@amazon.com>, Mike Day <michael.day@amd.com>,
	linux-fsdevel@vger.kernel.org, kvm@vger.kernel.org,
	linux-coco@lists.linux.dev, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-doc@vger.kernel.org, linux-nfs@vger.kernel.org,
	devel@lists.orangefs.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5 1/2] filemap: Pass address_space mapping to ->free_folio()
Date: Fri, 22 Nov 2024 18:22:54 +0000	[thread overview]
Message-ID: <Z0DL_jL4Tw_Z1LKD@casper.infradead.org> (raw)
In-Reply-To: <20241122-guestmem-library-v5-1-450e92951a15@quicinc.com>

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.

  reply	other threads:[~2024-11-22 18:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-22 17:29 [PATCH v5 0/2] mm: Refactor KVM guest_memfd to introduce guestmem library Elliot Berman
2024-11-22 17:29 ` [PATCH v5 1/2] filemap: Pass address_space mapping to ->free_folio() Elliot Berman
2024-11-22 18:22   ` Matthew Wilcox [this message]
2024-12-04 12:44   ` Mike Marshall
2024-11-22 17:29 ` [PATCH v5 2/2] mm: guestmem: Convert address_space operations to guestmem library Elliot Berman
2024-11-22 18:33   ` Matthew Wilcox
2025-04-03 14:48     ` Sean Christopherson
2024-11-25 18:04 ` [PATCH v5 0/2] mm: Refactor KVM guest_memfd to introduce " Mike Day

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=Z0DL_jL4Tw_Z1LKD@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=ackerleytng@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=anna@kernel.org \
    --cc=brauner@kernel.org \
    --cc=corbet@lwn.net \
    --cc=david@redhat.com \
    --cc=devel@lists.orangefs.org \
    --cc=hpa@zytor.com \
    --cc=hubcap@omnibond.com \
    --cc=jack@suse.cz \
    --cc=jgowans@amazon.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=martin@omnibond.com \
    --cc=michael.day@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=quic_eberman@quicinc.com \
    --cc=rppt@kernel.org \
    --cc=seanjc@google.com \
    --cc=tabba@google.com \
    --cc=trondmy@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).