FAILED: patch "[PATCH] s390/vfio_ccw: Move cp cleanup out of not operational" failed to apply to 6.1-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 0c11f61a876ed6fcca53d442ed3f33ea8362a0f9
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026082035-gloater-overview-3820@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 0c11f61a876ed6fcca53d442ed3f33ea8362a0f9 Mon Sep 17 00:00:00 2001
From: Eric Farman <[email protected]>
Date: Tue, 28 Jul 2026 05:30:20 +0200
Subject: [PATCH] s390/vfio_ccw: Move cp cleanup out of not operational
The fsm_notoper() routine is called when the device has been lost, and is (by definition) no longer operational. Since this can happen asynchronously from the normal behavior of the driver, the cleanup may happen when holding other locks in the calling sequence (notably, the cio subchannel lock).
Push the cleanup of the private->cp resources to a workqueue, where it can be done out from under that lock sequence and a future patch can safely manage the locking requirements.
drivers/s390/cio/vfio_ccw_drv.c +9 -0
@@ -125,6 +125,15 @@ void vfio_ccw_crw_todo(struct work_struct *work)eventfd_signal (private->crw_trigger); } +void vfio_ccw_notoper_todo (struct work_struct *work) +{ +struct vfio_ccw_private *private; + + private = container_of(work, struct vfio_ccw_private, notoper_work); + +cp_free (&private->cp); +} +/* * Css driver callbacks */
drivers/s390/cio/vfio_ccw_fsm.c +1 -2
@@ -170,8 +170,7 @@ static void fsm_notoper(struct vfio_ccw_private *private,css_sched_sch_todo (sch,SCH_TODO_UNREG ); private->state =VFIO_CCW_STATE_NOT_OPER ; -/* This is usually handled during CLOSE event */ -cp_free (&private->cp); +queue_work (vfio_ccw_work_q, &private->notoper_work); }/*
drivers/s390/cio/vfio_ccw_ops.c +13 -0
@@ -54,6 +54,7 @@ static int vfio_ccw_mdev_init_dev(struct vfio_device *vdev)INIT_LIST_HEAD (&private->crw);INIT_WORK (&private->io_work, vfio_ccw_sch_io_todo);INIT_WORK (&private->crw_work, vfio_ccw_crw_todo); +INIT_WORK (&private->notoper_work, vfio_ccw_notoper_todo); private->cp.guest_cp = kzalloc_objs(struct ccw1, CCWCHAIN_LEN_MAX);if (!private->cp.guest_cp)
@@ -134,9 +135,16 @@ static void vfio_ccw_mdev_release_dev(struct vfio_device *vdev)/* * Ensure these work items are fully drained, so none can * fire after being released. +* +* notoper_work should have nothing to do here, because only +* open devices could have channel_program resources in use +* and those would be released during close. Nevertheless, +* call flush here as well to be certain anything that was +* allocated is freed. */ cancel_work_sync (&private->io_work);cancel_work_sync (&private->crw_work); +flush_work (&private->notoper_work);list_for_each_entry_safe (crw, temp, &private->crw, next) {list_del (&crw->next);
@@ -213,9 +221,14 @@ static void vfio_ccw_mdev_close_device(struct vfio_device *vdev)/* * Ensure these work items are drained, in the event the * device is re-opened instead of released. +* +* notoper_work needs to be given a chance to run if it +* is queued, so any memory associated with the channel +* program can be returned. */ cancel_work_sync (&private->io_work);cancel_work_sync (&private->crw_work); +flush_work (&private->notoper_work);vfio_ccw_unregister_dev_regions (private); }
drivers/s390/cio/vfio_ccw_private.h +3 -0
@@ -102,6 +102,7 @@ struct vfio_ccw_parent {* @req_trigger: eventfd ctx for signaling userspace to return device * @io_work: work for deferral process of I/O handling * @crw_work: work for deferral process of CRW handling +* @notoper_work: work for deferred processing in not-operational state */ struct vfio_ccw_private {struct vfio_device vdev;
@@ -125,11 +126,13 @@ struct vfio_ccw_private {struct eventfd_ctx *req_trigger;struct work_struct io_work;struct work_struct crw_work; +struct work_struct notoper_work; }__aligned(8) ;int vfio_ccw_sch_quiesce (struct subchannel *sch);void vfio_ccw_sch_io_todo (struct work_struct *work);void vfio_ccw_crw_todo (struct work_struct *work); +void vfio_ccw_notoper_todo (struct work_struct *work);extern struct mdev_driver vfio_ccw_mdev_driver;