Re: [PATCH v7 07/10] s390/vfio_ccw: cancel existing workqueues
From: Matthew Rosato
Date: Mon Jul 27 2026 - 17:58:02 EST
On 7/27/26 3:22 PM, Eric Farman wrote:
> The initialization of the io_work and crw_work workqueues begs the
> question of whether they should be un-initialized. Add the corresponding
> cleanup tags in _release_dev to ensure work isn't dispatched after
> the private struct is free'd.
>
> Suggested-by: Matthew Rosato <mjrosato@xxxxxxxxxxxxx>
> Fixes: e5f84dbaea59 ("vfio: ccw: return I/O results asynchronously")
> Fixes: 3f02cb2fd9d2 ("vfio-ccw: Wire up the CRW irq and CRW region")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Eric Farman <farman@xxxxxxxxxxxxx>
> ---
> drivers/s390/cio/vfio_ccw_ops.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c
> index 032a1cdf4df7..bd488e40e153 100644
> --- a/drivers/s390/cio/vfio_ccw_ops.c
> +++ b/drivers/s390/cio/vfio_ccw_ops.c
> @@ -136,6 +136,10 @@ static void vfio_ccw_mdev_release_dev(struct vfio_device *vdev)
> kfree(crw);
> }
>
> + /* Should be empty, but just in case */
> + cancel_work_sync(&private->io_work);
> + cancel_work_sync(&private->crw_work);
> +
I think the sashiko report here means you should do the cancel work
prior to running the crw list. I think actually patch 10 will resolve
this as well, but moving it a bit earlier in this patch would avoid
introducing the temporary regression in the first place.
> kmem_cache_free(vfio_ccw_crw_region, private->crw_region);
> kmem_cache_free(vfio_ccw_schib_region, private->schib_region);
> kmem_cache_free(vfio_ccw_cmd_region, private->cmd_region);
> @@ -202,6 +206,10 @@ static void vfio_ccw_mdev_close_device(struct vfio_device *vdev)
> container_of(vdev, struct vfio_ccw_private, vdev);
>
> vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_CLOSE);
> +
> + cancel_work_sync(&private->io_work);
> + cancel_work_sync(&private->crw_work);
> +
> vfio_ccw_unregister_dev_regions(private);
> }
>