Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-18 Thread David Hildenbrand
On 18.10.24 09:15, Patrick Roy wrote: On Thu, 2024-10-17 at 20:18 +0100, Jason Gunthorpe wrote: On Thu, Oct 17, 2024 at 03:11:10PM -0400, Peter Xu wrote: On Thu, Oct 17, 2024 at 02:10:10PM -0300, Jason Gunthorpe wrote: If so, maybe that's a non-issue for non-CoCo, where the VM object / gmemf

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-18 Thread Patrick Roy
On Thu, 2024-10-17 at 20:18 +0100, Jason Gunthorpe wrote: > On Thu, Oct 17, 2024 at 03:11:10PM -0400, Peter Xu wrote: >> On Thu, Oct 17, 2024 at 02:10:10PM -0300, Jason Gunthorpe wrote: If so, maybe that's a non-issue for non-CoCo, where the VM object / gmemfd object (when created) can

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-17 Thread David Hildenbrand
On 17.10.24 21:18, Jason Gunthorpe wrote: On Thu, Oct 17, 2024 at 03:11:10PM -0400, Peter Xu wrote: On Thu, Oct 17, 2024 at 02:10:10PM -0300, Jason Gunthorpe wrote: If so, maybe that's a non-issue for non-CoCo, where the VM object / gmemfd object (when created) can have a flag marking that it's

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-17 Thread Jason Gunthorpe
On Thu, Oct 17, 2024 at 03:11:10PM -0400, Peter Xu wrote: > On Thu, Oct 17, 2024 at 02:10:10PM -0300, Jason Gunthorpe wrote: > > > If so, maybe that's a non-issue for non-CoCo, where the VM object / > > > gmemfd object (when created) can have a flag marking that it's > > > always shared and can nev

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-17 Thread Peter Xu
On Thu, Oct 17, 2024 at 02:10:10PM -0300, Jason Gunthorpe wrote: > > If so, maybe that's a non-issue for non-CoCo, where the VM object / > > gmemfd object (when created) can have a flag marking that it's > > always shared and can never be converted to private for any page > > within. > > What is n

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-17 Thread Vishal Annapurve
On Thu, Oct 17, 2024 at 10:46 PM Jason Gunthorpe wrote: > > On Thu, Oct 17, 2024 at 07:11:46PM +0200, David Hildenbrand wrote: > > On 17.10.24 18:47, Jason Gunthorpe wrote: > > > On Thu, Oct 17, 2024 at 10:58:29AM -0400, Peter Xu wrote: > > > > > > > My question was more torwards whether gmemfd co

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-17 Thread David Hildenbrand
On 17.10.24 19:16, Jason Gunthorpe wrote: On Thu, Oct 17, 2024 at 07:11:46PM +0200, David Hildenbrand wrote: On 17.10.24 18:47, Jason Gunthorpe wrote: On Thu, Oct 17, 2024 at 10:58:29AM -0400, Peter Xu wrote: My question was more torwards whether gmemfd could still expose the possibility to b

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-17 Thread David Hildenbrand
On 17.10.24 18:47, Jason Gunthorpe wrote: On Thu, Oct 17, 2024 at 10:58:29AM -0400, Peter Xu wrote: My question was more torwards whether gmemfd could still expose the possibility to be used in VA forms to other modules that may not support fd+offsets yet. I keep hearing they don't want to su

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-17 Thread Jason Gunthorpe
On Thu, Oct 17, 2024 at 07:11:46PM +0200, David Hildenbrand wrote: > On 17.10.24 18:47, Jason Gunthorpe wrote: > > On Thu, Oct 17, 2024 at 10:58:29AM -0400, Peter Xu wrote: > > > > > My question was more torwards whether gmemfd could still expose the > > > possibility to be used in VA forms to oth

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-17 Thread Peter Xu
On Thu, Oct 17, 2024 at 01:47:13PM -0300, Jason Gunthorpe wrote: > On Thu, Oct 17, 2024 at 10:58:29AM -0400, Peter Xu wrote: > > > My question was more torwards whether gmemfd could still expose the > > possibility to be used in VA forms to other modules that may not support > > fd+offsets yet. >

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-17 Thread Jason Gunthorpe
On Thu, Oct 17, 2024 at 01:05:34PM -0400, Peter Xu wrote: > On Thu, Oct 17, 2024 at 01:47:13PM -0300, Jason Gunthorpe wrote: > > On Thu, Oct 17, 2024 at 10:58:29AM -0400, Peter Xu wrote: > > > > > My question was more torwards whether gmemfd could still expose the > > > possibility to be used in V

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-17 Thread Jason Gunthorpe
On Thu, Oct 17, 2024 at 10:58:29AM -0400, Peter Xu wrote: > My question was more torwards whether gmemfd could still expose the > possibility to be used in VA forms to other modules that may not support > fd+offsets yet. I keep hearing they don't want to support page pinning on a guestmemfd mappi

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-17 Thread David Hildenbrand
On 16.10.24 22:16, Peter Xu wrote: On Wed, Oct 16, 2024 at 10:45:43AM +0200, David Hildenbrand wrote: On 16.10.24 01:42, Ackerley Tng wrote: Peter Xu writes: On Fri, Oct 11, 2024 at 11:32:11PM +, Ackerley Tng wrote: Peter Xu writes: On Tue, Sep 10, 2024 at 11:43:57PM +, Ackerley

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-17 Thread Peter Xu
On Wed, Oct 16, 2024 at 08:54:24PM -0300, Jason Gunthorpe wrote: > On Wed, Oct 16, 2024 at 07:49:31PM -0400, Peter Xu wrote: > > On Wed, Oct 16, 2024 at 07:51:57PM -0300, Jason Gunthorpe wrote: > > > On Wed, Oct 16, 2024 at 04:16:17PM -0400, Peter Xu wrote: > > > > > > > > Is there chance that whe

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-17 Thread David Hildenbrand
On 17.10.24 01:49, Peter Xu wrote: On Wed, Oct 16, 2024 at 07:51:57PM -0300, Jason Gunthorpe wrote: On Wed, Oct 16, 2024 at 04:16:17PM -0400, Peter Xu wrote: Is there chance that when !CoCo will be supported, then external modules (e.g. VFIO) can reuse the old user mappings, just like before g

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-16 Thread Jason Gunthorpe
On Wed, Oct 16, 2024 at 07:49:31PM -0400, Peter Xu wrote: > On Wed, Oct 16, 2024 at 07:51:57PM -0300, Jason Gunthorpe wrote: > > On Wed, Oct 16, 2024 at 04:16:17PM -0400, Peter Xu wrote: > > > > > > Is there chance that when !CoCo will be supported, then external modules > > > (e.g. VFIO) can reus

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-16 Thread Peter Xu
On Wed, Oct 16, 2024 at 07:51:57PM -0300, Jason Gunthorpe wrote: > On Wed, Oct 16, 2024 at 04:16:17PM -0400, Peter Xu wrote: > > > > Is there chance that when !CoCo will be supported, then external modules > > (e.g. VFIO) can reuse the old user mappings, just like before gmemfd? > > > > To suppor

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-16 Thread Jason Gunthorpe
On Wed, Oct 16, 2024 at 04:16:17PM -0400, Peter Xu wrote: > > Is there chance that when !CoCo will be supported, then external modules > (e.g. VFIO) can reuse the old user mappings, just like before gmemfd? > > To support CoCo, I understand gmem+offset is required all over the places. > However i

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-16 Thread Peter Xu
On Wed, Oct 16, 2024 at 10:45:43AM +0200, David Hildenbrand wrote: > On 16.10.24 01:42, Ackerley Tng wrote: > > Peter Xu writes: > > > > > On Fri, Oct 11, 2024 at 11:32:11PM +, Ackerley Tng wrote: > > > > Peter Xu writes: > > > > > > > > > On Tue, Sep 10, 2024 at 11:43:57PM +, Ackerley

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-16 Thread Jason Gunthorpe
On Wed, Oct 16, 2024 at 01:54:32PM +0200, David Hildenbrand wrote: > Likely should be doable. All we need is the generalized concept of a folio > with HVO, and a way to move these folios between owners (e.g., > global<->hugetlb, global<->guest_memfd). +1 HVO seems to become a sticking point in t

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-16 Thread David Hildenbrand
On 16.10.24 12:48, Vishal Annapurve wrote: On Wed, Oct 16, 2024 at 2:20 PM David Hildenbrand wrote: I also don't know how you treat things like folio_test_hugetlb() on possible assumptions that the VMA must be a hugetlb vma. I'd confess I didn't yet check the rest of the patchset yet - readi

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-16 Thread Vishal Annapurve
On Wed, Oct 16, 2024 at 2:20 PM David Hildenbrand wrote: > > >> I also don't know how you treat things like folio_test_hugetlb() on > >> possible assumptions that the VMA must be a hugetlb vma. I'd confess I > >> didn't yet check the rest of the patchset yet - reading a large series > >> without

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-16 Thread David Hildenbrand
I also don't know how you treat things like folio_test_hugetlb() on possible assumptions that the VMA must be a hugetlb vma. I'd confess I didn't yet check the rest of the patchset yet - reading a large series without a git tree is sometimes challenging to me. I'm thinking to basically never i

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-16 Thread David Hildenbrand
On 16.10.24 01:42, Ackerley Tng wrote: Peter Xu writes: On Fri, Oct 11, 2024 at 11:32:11PM +, Ackerley Tng wrote: Peter Xu writes: On Tue, Sep 10, 2024 at 11:43:57PM +, Ackerley Tng wrote: The faultability xarray is stored on the inode since faultability is a property of the guest

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-15 Thread Ackerley Tng
Peter Xu writes: > On Fri, Oct 11, 2024 at 11:32:11PM +, Ackerley Tng wrote: >> Peter Xu writes: >> >> > On Tue, Sep 10, 2024 at 11:43:57PM +, Ackerley Tng wrote: >> >> The faultability xarray is stored on the inode since faultability is a >> >> property of the guest_memfd's memory cont

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-15 Thread Peter Xu
On Fri, Oct 11, 2024 at 11:32:11PM +, Ackerley Tng wrote: > Peter Xu writes: > > > On Tue, Sep 10, 2024 at 11:43:57PM +, Ackerley Tng wrote: > >> The faultability xarray is stored on the inode since faultability is a > >> property of the guest_memfd's memory contents. > >> > >> In this R

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-11 Thread Ackerley Tng
Peter Xu writes: > On Tue, Sep 10, 2024 at 11:43:57PM +, Ackerley Tng wrote: >> The faultability xarray is stored on the inode since faultability is a >> property of the guest_memfd's memory contents. >> >> In this RFC, presence of an entry in the xarray indicates faultable, >> but this coul

Re: [RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-10-10 Thread Peter Xu
On Tue, Sep 10, 2024 at 11:43:57PM +, Ackerley Tng wrote: > The faultability xarray is stored on the inode since faultability is a > property of the guest_memfd's memory contents. > > In this RFC, presence of an entry in the xarray indicates faultable, > but this could be flipped so that prese

[RFC PATCH 26/39] KVM: guest_memfd: Track faultability within a struct kvm_gmem_private

2024-09-10 Thread Ackerley Tng
The faultability xarray is stored on the inode since faultability is a property of the guest_memfd's memory contents. In this RFC, presence of an entry in the xarray indicates faultable, but this could be flipped so that presence indicates unfaultable. For flexibility, a special value "FAULT" is u