public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Patch "vfio/pci: Prepare for dynamic interrupt context storage" has been added to the 6.1-stable tree
       [not found] <20240327114133.2806020-1-sashal@kernel.org>
@ 2024-03-29 17:04 ` Alex Williamson
  2024-03-30  8:44   ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Williamson @ 2024-03-29 17:04 UTC (permalink / raw)
  To: Sasha Levin; +Cc: stable, stable-commits, reinette.chatre

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;a=summary
> 
> 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.1683740667.git.reinette.chatre@intel.com
>     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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Patch "vfio/pci: Prepare for dynamic interrupt context storage" has been added to the 6.1-stable tree
  2024-03-29 17:04 ` Patch "vfio/pci: Prepare for dynamic interrupt context storage" has been added to the 6.1-stable tree Alex Williamson
@ 2024-03-30  8:44   ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2024-03-30  8:44 UTC (permalink / raw)
  To: Alex Williamson; +Cc: Sasha Levin, stable, stable-commits, reinette.chatre

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;a=summary
> > 
> > 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.1683740667.git.reinette.chatre@intel.com
> >     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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-30  8:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240327114133.2806020-1-sashal@kernel.org>
2024-03-29 17:04 ` Patch "vfio/pci: Prepare for dynamic interrupt context storage" has been added to the 6.1-stable tree Alex Williamson
2024-03-30  8:44   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox