On Wed, 27 Mar 2024 07:41:33 -0400 Sasha Levin sashal@kernel.org wrote:
This is a note to let you know that I've just added the patch titled
vfio/pci: Prepare for dynamic interrupt context storage
to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: vfio-pci-prepare-for-dynamic-interrupt-context-stora.patch and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
commit bca808da62c6a87ef168554caa318c2801d19b70 Author: Reinette Chatre reinette.chatre@intel.com Date: Thu May 11 08:44:30 2023 -0700
vfio/pci: Prepare for dynamic interrupt context storage
[ Upstream commit d977e0f7663961368f6442589e52d27484c2f5c2 ] Interrupt context storage is statically allocated at the time interrupts are allocated. Following allocation, the interrupt context is managed by directly accessing the elements of the array using the vector as index. It is possible to allocate additional MSI-X vectors after MSI-X has been enabled. Dynamic storage of interrupt context is needed to support adding new MSI-X vectors after initial allocation. Replace direct access of array elements with pointers to the array elements. Doing so reduces impact of moving to a new data structure. Move interactions with the array to helpers to mostly contain changes needed to transition to a dynamic data structure. No functional change intended. Signed-off-by: Reinette Chatre reinette.chatre@intel.com Reviewed-by: Kevin Tian kevin.tian@intel.com Acked-by: Thomas Gleixner tglx@linutronix.de Reviewed-by: Jason Gunthorpe jgg@nvidia.com Link: https://lore.kernel.org/r/eab289693c8325ede9aba99380f8b8d5143980a4.168374066... Signed-off-by: Alex Williamson alex.williamson@redhat.com Stable-dep-of: fe9a7082684e ("vfio/pci: Disable auto-enable of exclusive INTx IRQ") Signed-off-by: Sasha Levin sashal@kernel.org
...
@@ -171,15 +225,24 @@ static irqreturn_t vfio_intx_handler(int irq, void *dev_id) static int vfio_intx_enable(struct vfio_pci_core_device *vdev) {
- struct vfio_pci_irq_ctx *ctx;
- int ret;
- if (!is_irq_none(vdev)) return -EINVAL;
if (!vdev->pdev->irq) return -ENODEV;
- vdev->ctx = kzalloc(sizeof(struct vfio_pci_irq_ctx), GFP_KERNEL_ACCOUNT);
- if (!vdev->ctx)
return -ENOMEM;
- ret = vfio_irq_ctx_alloc_num(vdev, 1);
- if (ret)
return ret;
- ctx = vfio_irq_ctx_get(vdev, 0);
- if (!ctx) {
vfio_irq_ctx_free_all(vdev);
return -EINVAL;
- }
vdev->num_ctx = 1;
This is broken on it's own, vfio_irq_ctx_get() depends on a valid num_ctx, therefore this function always returns -EINVAL. This was resolved upstream by b156e48fffa9 ("vfio/pci: Use xarray for interrupt context storage") which was from the same series, so this issue was never apparent upstream. Suggest dropping this and fe9a7082684e ("vfio/pci: Disable auto-enable of exclusive INTx IRQ") for now and we'll try to rework the latter to remove the dependency. Thanks,
Alex
On Fri, Mar 29, 2024 at 11:04:33AM -0600, Alex Williamson wrote:
On Wed, 27 Mar 2024 07:41:33 -0400 Sasha Levin sashal@kernel.org wrote:
This is a note to let you know that I've just added the patch titled
vfio/pci: Prepare for dynamic interrupt context storage
to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: vfio-pci-prepare-for-dynamic-interrupt-context-stora.patch and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
commit bca808da62c6a87ef168554caa318c2801d19b70 Author: Reinette Chatre reinette.chatre@intel.com Date: Thu May 11 08:44:30 2023 -0700
vfio/pci: Prepare for dynamic interrupt context storage
[ Upstream commit d977e0f7663961368f6442589e52d27484c2f5c2 ] Interrupt context storage is statically allocated at the time interrupts are allocated. Following allocation, the interrupt context is managed by directly accessing the elements of the array using the vector as index. It is possible to allocate additional MSI-X vectors after MSI-X has been enabled. Dynamic storage of interrupt context is needed to support adding new MSI-X vectors after initial allocation. Replace direct access of array elements with pointers to the array elements. Doing so reduces impact of moving to a new data structure. Move interactions with the array to helpers to mostly contain changes needed to transition to a dynamic data structure. No functional change intended. Signed-off-by: Reinette Chatre reinette.chatre@intel.com Reviewed-by: Kevin Tian kevin.tian@intel.com Acked-by: Thomas Gleixner tglx@linutronix.de Reviewed-by: Jason Gunthorpe jgg@nvidia.com Link: https://lore.kernel.org/r/eab289693c8325ede9aba99380f8b8d5143980a4.168374066... Signed-off-by: Alex Williamson alex.williamson@redhat.com Stable-dep-of: fe9a7082684e ("vfio/pci: Disable auto-enable of exclusive INTx IRQ") Signed-off-by: Sasha Levin sashal@kernel.org
...
@@ -171,15 +225,24 @@ static irqreturn_t vfio_intx_handler(int irq, void *dev_id) static int vfio_intx_enable(struct vfio_pci_core_device *vdev) {
- struct vfio_pci_irq_ctx *ctx;
- int ret;
- if (!is_irq_none(vdev)) return -EINVAL;
if (!vdev->pdev->irq) return -ENODEV;
- vdev->ctx = kzalloc(sizeof(struct vfio_pci_irq_ctx), GFP_KERNEL_ACCOUNT);
- if (!vdev->ctx)
return -ENOMEM;
- ret = vfio_irq_ctx_alloc_num(vdev, 1);
- if (ret)
return ret;
- ctx = vfio_irq_ctx_get(vdev, 0);
- if (!ctx) {
vfio_irq_ctx_free_all(vdev);
return -EINVAL;
- }
vdev->num_ctx = 1;
This is broken on it's own, vfio_irq_ctx_get() depends on a valid num_ctx, therefore this function always returns -EINVAL. This was resolved upstream by b156e48fffa9 ("vfio/pci: Use xarray for interrupt context storage") which was from the same series, so this issue was never apparent upstream. Suggest dropping this and fe9a7082684e ("vfio/pci: Disable auto-enable of exclusive INTx IRQ") for now and we'll try to rework the latter to remove the dependency. Thanks,
Ok, I'll go drop both of these and take the series you just sent, thanks.
greg k-h
linux-stable-mirror@lists.linaro.org