RE: [PATCH v5 28/28] vfio/xe: Add device specific vfio_pci driver variant for Intel graphics

From: Tian, Kevin
Date: Mon Nov 10 2025 - 20:49:47 EST


> From: Winiarski, Michal <michal.winiarski@xxxxxxxxx>
> Sent: Tuesday, November 11, 2025 9:05 AM
> +
> + /*
> + * As the higher VFIO layers are holding locks across reset and using
> + * those same locks with the mm_lock we need to prevent ABBA
> deadlock
> + * with the state_mutex and mm_lock.
> + * In case the state_mutex was taken already we defer the cleanup
> work
> + * to the unlock flow of the other running context.
> + */
> + spin_lock(&xe_vdev->reset_lock);
> + xe_vdev->deferred_reset = true;
> + if (!mutex_trylock(&xe_vdev->state_mutex)) {
> + spin_unlock(&xe_vdev->reset_lock);
> + return;
> + }
> + spin_unlock(&xe_vdev->reset_lock);
> + xe_vfio_pci_state_mutex_unlock(xe_vdev);
> +
> + xe_vfio_pci_reset(xe_vdev);
> +}

Jason suggested to do this in the core given it's common [1].

If you disagree, then please raise it and get consensus in that thread
instead of rushing to post a new version...

[1] https://lore.kernel.org/all/20251108004754.GD1859178@xxxxxxxx/