Re: [RFC PATCH 3/3] kvm: Atomic memslot updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/4/22 16:14, Emanuele Giuseppe Esposito wrote:
+    g_assert(qemu_mutex_iothread_locked());

Please add a comment here:

    /* Block further invocations of the ioctls outside the BQL.  */

+    CPU_FOREACH(cpu) {
+        qemu_lockcnt_lock(&cpu->in_ioctl_lock);
+    }
+    qemu_lockcnt_lock(&kvm_in_ioctl_lock);
- kvm_set_phys_mem(kml, section, false);
-    memory_region_unref(section->mr);
+    /* Inhibiting happens rarely, we can keep things simple and spin here. */

Not making it spin is pretty easy. You can add a qemu_event_set to kvm_set_in_ioctl() and kvm_cpu_set_in_ioctl(), and here something like:

    if (in_kvm_ioctls()) {
        qemu_event_reset(&kvm_in_ioctl_event);
        if (in_kvm_ioctls()) {
            qemu_event_wait(&kvm_in_ioctl_event);
        }
    }

where in_kvm_ioctls() returns true if any (vCPU or KVM) lockcnt has a nonzero count.

Also please create a new header sysemu/accel-blocker.h and accel/blocker.c or something like that with all the functions, because this code can potentially be used by all KVM-like accelerators.

Paolo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux