Re: [PATCH 32/34] KVM: selftests: Add basic selftest for guest_memfd()

2023-11-16 Thread Ackerley Tng
ld > fail with EINVAL", > + flag | BIT_ULL(bit)); > + } otherwise this won't compile because valid_flags is not declared. These lines will have to be added back when adding transparent hugepage support. > + } > +} Tested-by: Ackerley Tng

Re: [RFC PATCH v11 12/29] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory

2023-09-14 Thread Ackerley Tng
Sean Christopherson writes: > On Mon, Aug 28, 2023, Ackerley Tng wrote: >> Sean Christopherson writes: >> >> If we track struct kvm with the inode, then I think (a), (b) and (c) can >> >> be independent of the refcounting method. What do you think? >>

Re: [RFC PATCH v11 12/29] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory

2023-09-01 Thread Ackerley Tng
Binbin Wu writes: > > >> >> I'm not sure whose refcount the folio_put() in kvm_gmem_allocate() is >> dropping though: >> >> + The refcount for the filemap depends on whether this is a hugepage or >>not, but folio_put() strictly drops a refcount of 1. >> + The refcount for the lru list is jus

Re: [RFC PATCH v11 12/29] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory

2023-08-30 Thread Ackerley Tng
Binbin Wu writes: >> >> >> +static long kvm_gmem_allocate(struct inode *inode, loff_t offset, loff_t >> len) >> +{ >> +struct address_space *mapping = inode->i_mapping; >> +pgoff_t start, index, end; >> +int r; >> + >> +/* Dedicated guest is immutable by default. */ >> +if (

Re: [RFC PATCH v11 12/29] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory

2023-08-28 Thread Ackerley Tng
Sean Christopherson writes: > On Mon, Aug 21, 2023, Ackerley Tng wrote: >> Sean Christopherson writes: >> >> > On Tue, Aug 15, 2023, Ackerley Tng wrote: >> >> Sean Christopherson writes: >> >> > Nullifying the KVM pointer isn't

Re: [RFC PATCH v11 28/29] KVM: selftests: Add basic selftest for guest_memfd()

2023-08-21 Thread Ackerley Tng
Sean Christopherson writes: > On Mon, Aug 07, 2023, Ackerley Tng wrote: >> Sean Christopherson writes: >> >> > Add a selftest to verify the basic functionality of guest_memfd(): >> > >> > >> >> Here's one more test: > > First

Re: [RFC PATCH v11 12/29] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory

2023-08-21 Thread Ackerley Tng
Sean Christopherson writes: > On Tue, Aug 15, 2023, Ackerley Tng wrote: >> Sean Christopherson writes: >> >> >> I feel that memslots form a natural way of managing usage of the gmem >> >> file. When a memslot is created, it is using the file; hence we take

Re: [RFC PATCH v11 12/29] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory

2023-08-15 Thread Ackerley Tng
Sean Christopherson writes: > On Mon, Aug 07, 2023, Ackerley Tng wrote: >> I’d like to propose an alternative to the refcounting approach between >> the gmem file and associated kvm, where we think of KVM’s memslots as >> users of the gmem file. >> >> Instead o

Re: [RFC PATCH v11 28/29] KVM: selftests: Add basic selftest for guest_memfd()

2023-08-07 Thread Ackerley Tng
Sean Christopherson writes: > Add a selftest to verify the basic functionality of guest_memfd(): > > Here's one more test: >From 72dc6836f01bdd613d64d4c6a4f2af8f2b777ba2 Mon Sep 17 00:00:00 2001 From: Ackerley Tng Date: Tue, 1 Aug 2023 18:02:50 + Subject: [PATCH] KV

Re: [RFC PATCH v11 28/29] KVM: selftests: Add basic selftest for guest_memfd()

2023-08-07 Thread Ackerley Tng
Sean Christopherson writes: > Add a selftest to verify the basic functionality of guest_memfd(): > > + file descriptor created with the guest_memfd() ioctl does not allow > read/write/mmap operations > + file size and block size as returned from fstat are as expected > + fallocate on the fd che

Re: [RFC PATCH v11 27/29] KVM: selftests: Expand set_memory_region_test to validate guest_memfd()

2023-08-07 Thread Ackerley Tng
bindings > - Unaligned bindings > > Signed-off-by: Chao Peng > Co-developed-by: Ackerley Tng > Signed-off-by: Ackerley Tng > [sean: trim the testcases to remove duplicate coverage] > Signed-off-by: Sean Christopherson > --- > .../selftests/kvm/inclu

Re: [RFC PATCH v11 12/29] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory

2023-08-07 Thread Ackerley Tng
Sean Christopherson writes: > > +static int kvm_gmem_release(struct inode *inode, struct file *file) > +{ > + struct kvm_gmem *gmem = file->private_data; > + struct kvm_memory_slot *slot; > + struct kvm *kvm = gmem->kvm; > + unsigned long index; > + > + filemap_invalidate_