Re: [PATCH] vfio: Decrement open_count before close_device()

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

 



On Tue, Oct 25, 2022 at 12:38:20PM -0700, Anthony DeRossi wrote:
> The implementation of close_device() for vfio-pci inspects the
> open_count of every device in the device set to determine whether a
> reset is needed. Unless open_count is decremented before invoking
> close_device(), the device set will always contain a device with
> open_count > 0, effectively disabling the reset logic.

This seems to miss the reason why this was done:

    Eliminate the calls to vfio_group_add_container_user() and add
    vfio_assert_device_open() to detect driver mis-use. This causes the
    close_device() op to check device->open_count so always leave it elevated
    while calling the op.

If we let it be zero then vfio_assert_device_open() will trigger on
other drivers.

I think the best approach is to change vfio_pci to understand that
open_count == 1 means it is the last close.

Thanks,
Jason



[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