[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v3 13/13] KVM: selftests: Add a KVM_IRQFD test to verify uniqueness requirements
On Fri, May 23, 2025, Sairaj Kodilkar wrote: > On 5/23/2025 5:22 AM, Sean Christopherson wrote: > > > + > > +int main(int argc, char *argv[]) > > +{ > > + pthread_t racing_thread; > > + int r, i; > > + > > + /* Create "full" VMs, as KVM_IRQFD requires an in-kernel IRQ chip. */ > > + vm1 = vm_create(1); > > + vm2 = vm_create(1); > > + > > + WRITE_ONCE(__eventfd, kvm_new_eventfd()); > > + > > + kvm_irqfd(vm1, 10, __eventfd, 0); > > + > > + r = __kvm_irqfd(vm1, 11, __eventfd, 0); > > + TEST_ASSERT(r && errno == EBUSY, > > + "Wanted EBUSY, r = %d, errno = %d", r, errno); > > + > > + r = __kvm_irqfd(vm2, 12, __eventfd, 0); > > + TEST_ASSERT(r && errno == EBUSY, > > + "Wanted EBUSY, r = %d, errno = %d", r, errno); > > + > > + kvm_irqfd(vm1, 11, READ_ONCE(__eventfd), KVM_IRQFD_FLAG_DEASSIGN); > > + kvm_irqfd(vm1, 12, READ_ONCE(__eventfd), KVM_IRQFD_FLAG_DEASSIGN); > > + kvm_irqfd(vm1, 13, READ_ONCE(__eventfd), KVM_IRQFD_FLAG_DEASSIGN); > > + kvm_irqfd(vm1, 14, READ_ONCE(__eventfd), KVM_IRQFD_FLAG_DEASSIGN); > > Hi Sean, > I dont see any allocation for the GSI 13 and 14.. > Is there any reason for the deassigning these two GSIs ? Yes, KVM's rather bizarre ABI is that DEASSIGN is allowed even if the VM doesn't have a corresponding assigned irqfd. The reason I added these early DEASSIGN calls is so that there will be an easier-to-debug failure if KVM's behavior changes (the racing threads part of the test abuses KVM's ABI). I didn't add a comment because the helpers already have comments, but looking at this again, I agree that main() needs a better comment.
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |