Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH] vfio/xe: avoid duplicate reset in xe_vfio_pci_reset_done
@ 2026-04-24  9:17 zhaoguohan
  2026-04-24 16:47 ` Alex Williamson
  2026-04-27  1:21 ` [PATCH v2] " zhaoguohan
  0 siblings, 2 replies; 7+ messages in thread
From: zhaoguohan @ 2026-04-24  9:17 UTC (permalink / raw)
  To: Alex Williamson, Michał Winiarski, kvm, intel-xe
  Cc: Jason Gunthorpe, Yishai Hadas, Shameer Kolothum, Kevin Tian,
	linux-kernel

From: GuoHan Zhao <zhaoguohan@kylinos.cn>

xe_vfio_pci_reset_done() sets deferred_reset and, when it manages to
acquire state_mutex itself, hands the cleanup off to
xe_vfio_pci_state_mutex_unlock().

That helper already clears deferred_reset and runs xe_vfio_pci_reset()
before dropping the mutex. Calling xe_vfio_pci_reset() again right
afterwards repeats the reset handling unnecessarily.

Fixes: 1b81ed612e12 ("vfio/xe: Reorganize the init to decouple migration from reset")
Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
---
 drivers/vfio/pci/xe/main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/vfio/pci/xe/main.c b/drivers/vfio/pci/xe/main.c
index 4ecadbbfd86e..cbff5af385ef 100644
--- a/drivers/vfio/pci/xe/main.c
+++ b/drivers/vfio/pci/xe/main.c
@@ -135,8 +135,6 @@ static void xe_vfio_pci_reset_done(struct pci_dev *pdev)
 	}
 	spin_unlock(&xe_vdev->reset_lock);
 	xe_vfio_pci_state_mutex_unlock(xe_vdev);
-
-	xe_vfio_pci_reset(xe_vdev);
 }
 
 static const struct pci_error_handlers xe_vfio_pci_err_handlers = {
-- 
2.43.0


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

* Re: [PATCH] vfio/xe: avoid duplicate reset in xe_vfio_pci_reset_done
  2026-04-24  9:17 [PATCH] vfio/xe: avoid duplicate reset in xe_vfio_pci_reset_done zhaoguohan
@ 2026-04-24 16:47 ` Alex Williamson
  2026-04-27  1:21 ` [PATCH v2] " zhaoguohan
  1 sibling, 0 replies; 7+ messages in thread
From: Alex Williamson @ 2026-04-24 16:47 UTC (permalink / raw)
  To: zhaoguohan
  Cc: Michał Winiarski, kvm, intel-xe, Jason Gunthorpe,
	Yishai Hadas, Shameer Kolothum, Kevin Tian, linux-kernel, alex

On Fri, 24 Apr 2026 17:17:19 +0800
zhaoguohan@kylinos.cn wrote:

> From: GuoHan Zhao <zhaoguohan@kylinos.cn>
> 
> xe_vfio_pci_reset_done() sets deferred_reset and, when it manages to
> acquire state_mutex itself, hands the cleanup off to
> xe_vfio_pci_state_mutex_unlock().
> 
> That helper already clears deferred_reset and runs xe_vfio_pci_reset()
> before dropping the mutex. Calling xe_vfio_pci_reset() again right
> afterwards repeats the reset handling unnecessarily.
> 
> Fixes: 1b81ed612e12 ("vfio/xe: Reorganize the init to decouple migration from reset")

Change looks good to me, but the Fixes: attribution is wrong, this has
been present since the original code in 1f5556ec8b9e ("vfio/xe: Add
device specific vfio_pci driver variant for Intel graphics").  Thanks,

Alex


> Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
> ---
>  drivers/vfio/pci/xe/main.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/vfio/pci/xe/main.c b/drivers/vfio/pci/xe/main.c
> index 4ecadbbfd86e..cbff5af385ef 100644
> --- a/drivers/vfio/pci/xe/main.c
> +++ b/drivers/vfio/pci/xe/main.c
> @@ -135,8 +135,6 @@ static void xe_vfio_pci_reset_done(struct pci_dev *pdev)
>  	}
>  	spin_unlock(&xe_vdev->reset_lock);
>  	xe_vfio_pci_state_mutex_unlock(xe_vdev);
> -
> -	xe_vfio_pci_reset(xe_vdev);
>  }
>  
>  static const struct pci_error_handlers xe_vfio_pci_err_handlers = {


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

* [PATCH v2] vfio/xe: avoid duplicate reset in xe_vfio_pci_reset_done
  2026-04-24  9:17 [PATCH] vfio/xe: avoid duplicate reset in xe_vfio_pci_reset_done zhaoguohan
  2026-04-24 16:47 ` Alex Williamson
@ 2026-04-27  1:21 ` zhaoguohan
  2026-05-07  8:04   ` Tian, Kevin
                     ` (2 more replies)
  1 sibling, 3 replies; 7+ messages in thread
From: zhaoguohan @ 2026-04-27  1:21 UTC (permalink / raw)
  To: Alex Williamson, Michał Winiarski, kvm, intel-xe
  Cc: Jason Gunthorpe, Yishai Hadas, Shameer Kolothum, Kevin Tian,
	Rodrigo Vivi, Thomas Hellström, linux-kernel

From: GuoHan Zhao <zhaoguohan@kylinos.cn>

xe_vfio_pci_reset_done() sets deferred_reset and, when it manages to
acquire state_mutex itself, hands the cleanup off to
xe_vfio_pci_state_mutex_unlock().

That helper already clears deferred_reset and runs xe_vfio_pci_reset()
before dropping the mutex. Calling xe_vfio_pci_reset() again right
afterwards repeats the reset handling unnecessarily.

Fixes: 1f5556ec8b9e ("vfio/xe: Add device specific vfio_pci driver variant for Intel graphics")
Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
---
v2:
- Correct the Fixes tag to point to 1f5556ec8b9e

 drivers/vfio/pci/xe/main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/vfio/pci/xe/main.c b/drivers/vfio/pci/xe/main.c
index 4ecadbbfd86e..cbff5af385ef 100644
--- a/drivers/vfio/pci/xe/main.c
+++ b/drivers/vfio/pci/xe/main.c
@@ -135,8 +135,6 @@ static void xe_vfio_pci_reset_done(struct pci_dev *pdev)
 	}
 	spin_unlock(&xe_vdev->reset_lock);
 	xe_vfio_pci_state_mutex_unlock(xe_vdev);
-
-	xe_vfio_pci_reset(xe_vdev);
 }
 
 static const struct pci_error_handlers xe_vfio_pci_err_handlers = {
-- 
2.43.0

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

* RE: [PATCH v2] vfio/xe: avoid duplicate reset in xe_vfio_pci_reset_done
  2026-04-27  1:21 ` [PATCH v2] " zhaoguohan
@ 2026-05-07  8:04   ` Tian, Kevin
  2026-05-20 17:22   ` Alex Williamson
  2026-05-20 21:11   ` Alex Williamson
  2 siblings, 0 replies; 7+ messages in thread
From: Tian, Kevin @ 2026-05-07  8:04 UTC (permalink / raw)
  To: zhaoguohan@kylinos.cn, Alex Williamson, Winiarski, Michal,
	kvm@vger.kernel.org, intel-xe@lists.freedesktop.org
  Cc: Jason Gunthorpe, Yishai Hadas, Shameer Kolothum, Vivi, Rodrigo,
	Thomas Hellström, linux-kernel@vger.kernel.org

> From: zhaoguohan@kylinos.cn <zhaoguohan@kylinos.cn>
> Sent: Monday, April 27, 2026 9:21 AM
> 
> From: GuoHan Zhao <zhaoguohan@kylinos.cn>
> 
> xe_vfio_pci_reset_done() sets deferred_reset and, when it manages to
> acquire state_mutex itself, hands the cleanup off to
> xe_vfio_pci_state_mutex_unlock().
> 
> That helper already clears deferred_reset and runs xe_vfio_pci_reset()
> before dropping the mutex. Calling xe_vfio_pci_reset() again right
> afterwards repeats the reset handling unnecessarily.
> 
> Fixes: 1f5556ec8b9e ("vfio/xe: Add device specific vfio_pci driver variant for
> Intel graphics")
> Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

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

* Re: [PATCH v2] vfio/xe: avoid duplicate reset in xe_vfio_pci_reset_done
  2026-04-27  1:21 ` [PATCH v2] " zhaoguohan
  2026-05-07  8:04   ` Tian, Kevin
@ 2026-05-20 17:22   ` Alex Williamson
  2026-05-20 18:25     ` Michał Winiarski
  2026-05-20 21:11   ` Alex Williamson
  2 siblings, 1 reply; 7+ messages in thread
From: Alex Williamson @ 2026-05-20 17:22 UTC (permalink / raw)
  To: Michał Winiarski
  Cc: zhaoguohan, kvm, intel-xe, Jason Gunthorpe, Yishai Hadas,
	Shameer Kolothum, Kevin Tian, Rodrigo Vivi, Thomas Hellström,
	linux-kernel, alex

On Mon, 27 Apr 2026 09:21:28 +0800
zhaoguohan@kylinos.cn wrote:

> From: GuoHan Zhao <zhaoguohan@kylinos.cn>
> 
> xe_vfio_pci_reset_done() sets deferred_reset and, when it manages to
> acquire state_mutex itself, hands the cleanup off to
> xe_vfio_pci_state_mutex_unlock().
> 
> That helper already clears deferred_reset and runs xe_vfio_pci_reset()
> before dropping the mutex. Calling xe_vfio_pci_reset() again right
> afterwards repeats the reset handling unnecessarily.
> 
> Fixes: 1f5556ec8b9e ("vfio/xe: Add device specific vfio_pci driver variant for Intel graphics")
> Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
> ---
> v2:
> - Correct the Fixes tag to point to 1f5556ec8b9e


Michał, any objection?  I'd prefer to include this with your ack.
Thanks,

Alex
 
>  drivers/vfio/pci/xe/main.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/vfio/pci/xe/main.c b/drivers/vfio/pci/xe/main.c
> index 4ecadbbfd86e..cbff5af385ef 100644
> --- a/drivers/vfio/pci/xe/main.c
> +++ b/drivers/vfio/pci/xe/main.c
> @@ -135,8 +135,6 @@ static void xe_vfio_pci_reset_done(struct pci_dev *pdev)
>  	}
>  	spin_unlock(&xe_vdev->reset_lock);
>  	xe_vfio_pci_state_mutex_unlock(xe_vdev);
> -
> -	xe_vfio_pci_reset(xe_vdev);
>  }
>  
>  static const struct pci_error_handlers xe_vfio_pci_err_handlers = {


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

* Re: [PATCH v2] vfio/xe: avoid duplicate reset in xe_vfio_pci_reset_done
  2026-05-20 17:22   ` Alex Williamson
@ 2026-05-20 18:25     ` Michał Winiarski
  0 siblings, 0 replies; 7+ messages in thread
From: Michał Winiarski @ 2026-05-20 18:25 UTC (permalink / raw)
  To: Alex Williamson
  Cc: zhaoguohan, kvm, intel-xe, Jason Gunthorpe, Yishai Hadas,
	Shameer Kolothum, Kevin Tian, Rodrigo Vivi, Thomas Hellström,
	linux-kernel

On Wed, May 20, 2026 at 11:22:20AM -0600, Alex Williamson wrote:
> On Mon, 27 Apr 2026 09:21:28 +0800
> zhaoguohan@kylinos.cn wrote:
> 
> > From: GuoHan Zhao <zhaoguohan@kylinos.cn>
> > 
> > xe_vfio_pci_reset_done() sets deferred_reset and, when it manages to
> > acquire state_mutex itself, hands the cleanup off to
> > xe_vfio_pci_state_mutex_unlock().
> > 
> > That helper already clears deferred_reset and runs xe_vfio_pci_reset()
> > before dropping the mutex. Calling xe_vfio_pci_reset() again right
> > afterwards repeats the reset handling unnecessarily.
> > 
> > Fixes: 1f5556ec8b9e ("vfio/xe: Add device specific vfio_pci driver variant for Intel graphics")
> > Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
> > ---
> > v2:
> > - Correct the Fixes tag to point to 1f5556ec8b9e
> 
> 
> Michał, any objection?  I'd prefer to include this with your ack.
> Thanks,

Hi,

No objections.

Acked-by: Michał Winiarski <michal.winiarski@intel.com>

Thanks,
-Michał

> 
> Alex
>  
> >  drivers/vfio/pci/xe/main.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/vfio/pci/xe/main.c b/drivers/vfio/pci/xe/main.c
> > index 4ecadbbfd86e..cbff5af385ef 100644
> > --- a/drivers/vfio/pci/xe/main.c
> > +++ b/drivers/vfio/pci/xe/main.c
> > @@ -135,8 +135,6 @@ static void xe_vfio_pci_reset_done(struct pci_dev *pdev)
> >  	}
> >  	spin_unlock(&xe_vdev->reset_lock);
> >  	xe_vfio_pci_state_mutex_unlock(xe_vdev);
> > -
> > -	xe_vfio_pci_reset(xe_vdev);
> >  }
> >  
> >  static const struct pci_error_handlers xe_vfio_pci_err_handlers = {
> 

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

* Re: [PATCH v2] vfio/xe: avoid duplicate reset in xe_vfio_pci_reset_done
  2026-04-27  1:21 ` [PATCH v2] " zhaoguohan
  2026-05-07  8:04   ` Tian, Kevin
  2026-05-20 17:22   ` Alex Williamson
@ 2026-05-20 21:11   ` Alex Williamson
  2 siblings, 0 replies; 7+ messages in thread
From: Alex Williamson @ 2026-05-20 21:11 UTC (permalink / raw)
  To: zhaoguohan
  Cc: Michał Winiarski, kvm, intel-xe, Jason Gunthorpe,
	Yishai Hadas, Shameer Kolothum, Kevin Tian, Rodrigo Vivi,
	Thomas Hellström, linux-kernel, alex

On Mon, 27 Apr 2026 09:21:28 +0800
zhaoguohan@kylinos.cn wrote:

> From: GuoHan Zhao <zhaoguohan@kylinos.cn>
> 
> xe_vfio_pci_reset_done() sets deferred_reset and, when it manages to
> acquire state_mutex itself, hands the cleanup off to
> xe_vfio_pci_state_mutex_unlock().
> 
> That helper already clears deferred_reset and runs xe_vfio_pci_reset()
> before dropping the mutex. Calling xe_vfio_pci_reset() again right
> afterwards repeats the reset handling unnecessarily.
> 
> Fixes: 1f5556ec8b9e ("vfio/xe: Add device specific vfio_pci driver variant for Intel graphics")
> Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
> ---
> v2:
> - Correct the Fixes tag to point to 1f5556ec8b9e
> 
>  drivers/vfio/pci/xe/main.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/vfio/pci/xe/main.c b/drivers/vfio/pci/xe/main.c
> index 4ecadbbfd86e..cbff5af385ef 100644
> --- a/drivers/vfio/pci/xe/main.c
> +++ b/drivers/vfio/pci/xe/main.c
> @@ -135,8 +135,6 @@ static void xe_vfio_pci_reset_done(struct pci_dev *pdev)
>  	}
>  	spin_unlock(&xe_vdev->reset_lock);
>  	xe_vfio_pci_state_mutex_unlock(xe_vdev);
> -
> -	xe_vfio_pci_reset(xe_vdev);
>  }
>  
>  static const struct pci_error_handlers xe_vfio_pci_err_handlers = {

Applied to vfio next branch for v7.2.  Thanks,

Alex

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

end of thread, other threads:[~2026-05-20 21:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-24  9:17 [PATCH] vfio/xe: avoid duplicate reset in xe_vfio_pci_reset_done zhaoguohan
2026-04-24 16:47 ` Alex Williamson
2026-04-27  1:21 ` [PATCH v2] " zhaoguohan
2026-05-07  8:04   ` Tian, Kevin
2026-05-20 17:22   ` Alex Williamson
2026-05-20 18:25     ` Michał Winiarski
2026-05-20 21:11   ` Alex Williamson

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