Re: [PATCH v5 2/2] mm: guestmem: Convert address_space operations to guestmem library
From: Sean Christopherson
Date: Thu Apr 03 2025 - 10:52:15 EST
On Fri, Nov 22, 2024, Matthew Wilcox wrote:
> On Fri, Nov 22, 2024 at 09:29:39AM -0800, Elliot Berman wrote:
> > A few near-term features are coming to guest_memfd which make sense to
> > create a built-in library.
>
> You haven't created a library, you've created a middle-layer. This
> file primarily consists of functions which redispatch to a function
> pointer. I think you'd be better off creating a library! That is,
> have the consumers register their own address_space_operations and
> have functions in this library which provide useful implementations.
Or, go even further and move the overwhelming majority of guest_memfd code into
mm/. But I suspect that will be practically infeasible, in which case I think I
agree with Matthew.
Either way, the Gunyah usage of the library/middle-layer needs to be included in
the series. It's impossible to review the code split and APIs without seeing
both KVM's usage and Gunyah's usage. E.g. this series allows
__guestmem_invalidate_begin() to fail, without any explanation as to while that's
legal or desirable.