[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aLWtaZYi65aLtTAP@kernel.org>
Date: Mon, 1 Sep 2025 17:27:53 +0300
From: Mike Rapoport <rppt@...nel.org>
To: "Roy, Patrick" <roypat@...zon.co.uk>
Cc: "ackerleytng@...gle.com" <ackerleytng@...gle.com>,
"david@...hat.com" <david@...hat.com>,
"Manwaring, Derek" <derekmn@...zon.com>,
"Thomson, Jack" <jackabt@...zon.co.uk>,
"Kalyazin, Nikita" <kalyazin@...zon.co.uk>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"kvmarm@...ts.linux.dev" <kvmarm@...ts.linux.dev>,
"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"seanjc@...gle.com" <seanjc@...gle.com>,
"tabba@...gle.com" <tabba@...gle.com>,
"vbabka@...e.cz" <vbabka@...e.cz>,
"will@...nel.org" <will@...nel.org>,
"Cali, Marco" <xmarcalx@...zon.co.uk>
Subject: Re: [PATCH v5 04/12] KVM: guest_memfd: Add flag to remove from
direct map
On Mon, Sep 01, 2025 at 02:22:22PM +0000, Roy, Patrick wrote:
> On Thu, 2025-08-28 at 15:54 +0100, Mike Rapoport wrote:
> > On Thu, Aug 28, 2025 at 09:39:21AM +0000, Roy, Patrick wrote:
> >
> >> static inline void kvm_gmem_mark_prepared(struct folio *folio)
> >> {
> >> + struct inode *inode = folio_inode(folio);
> >> +
> >> + if (kvm_gmem_test_no_direct_map(inode))
> >> + set_direct_map_valid_noflush(folio_page(folio, 0), folio_nr_pages(folio), false);
> >
> > This may fail to split large mapping in the direct map. Why not move this
> > to kvm_gmem_prepare_folio() where you can handle returned error?
>
> Argh, yeah, got that the wrong way around. Will update the error handling.
>
> > I think that using set_direct_map_invalid_noflush() here and
> > set_direct_map_default_noflush() in kvm_gmem_free_folio() better is
> > clearer and makes it more obvious that here the folio is removed from the
> > direct map and when freed it's direct mapping is restored.
> >
> > This requires to export two symbols in patch 2, but I think it's worth it.
>
> Mh, but set_direct_map_[default|invalid]_noflush() only take a single struct
> page * argument, so they'd either need to gain a npages argument, or we add yet
> more functions to set_memory.h. Do you still think that's worth it?
Ah, right, misremembered that. Let's keep set_direct_map_valid_noflush().
--
Sincerely yours,
Mike.
Powered by blists - more mailing lists