Commit 46fbe4e4 authored by Peter Oberparleiter's avatar Peter Oberparleiter Committed by Martin Schwidefsky

[S390] cio: move device unregistration to dedicated work queue

Use dedicated slow path work queue when unregistering a device due to
a user action. This ensures serialialization of other register/
unregister requests.
Signed-off-by: default avatarPeter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 4bcb3a37
...@@ -296,36 +296,33 @@ static void ccw_device_unregister(struct ccw_device *cdev) ...@@ -296,36 +296,33 @@ static void ccw_device_unregister(struct ccw_device *cdev)
device_del(&cdev->dev); device_del(&cdev->dev);
} }
static void ccw_device_remove_orphan_cb(struct device *dev) static void ccw_device_remove_orphan_cb(struct work_struct *work)
{ {
struct ccw_device *cdev = to_ccwdev(dev); struct ccw_device_private *priv;
struct ccw_device *cdev;
priv = container_of(work, struct ccw_device_private, kick_work);
cdev = priv->cdev;
ccw_device_unregister(cdev); ccw_device_unregister(cdev);
put_device(&cdev->dev); put_device(&cdev->dev);
/* Release cdev reference for workqueue processing. */
put_device(&cdev->dev);
} }
static void ccw_device_remove_sch_cb(struct device *dev) static void ccw_device_call_sch_unregister(struct work_struct *work);
{
struct subchannel *sch;
sch = to_subchannel(dev);
css_sch_device_unregister(sch);
/* Reset intparm to zeroes. */
sch->schib.pmcw.intparm = 0;
cio_modify(sch);
put_device(&sch->dev);
}
static void static void
ccw_device_remove_disconnected(struct ccw_device *cdev) ccw_device_remove_disconnected(struct ccw_device *cdev)
{ {
unsigned long flags; unsigned long flags;
int rc;
/* /*
* Forced offline in disconnected state means * Forced offline in disconnected state means
* 'throw away device'. * 'throw away device'.
*/ */
/* Get cdev reference for workqueue processing. */
if (!get_device(&cdev->dev))
return;
if (ccw_device_is_orphan(cdev)) { if (ccw_device_is_orphan(cdev)) {
/* /*
* Deregister ccw device. * Deregister ccw device.
...@@ -335,23 +332,13 @@ ccw_device_remove_disconnected(struct ccw_device *cdev) ...@@ -335,23 +332,13 @@ ccw_device_remove_disconnected(struct ccw_device *cdev)
spin_lock_irqsave(cdev->ccwlock, flags); spin_lock_irqsave(cdev->ccwlock, flags);
cdev->private->state = DEV_STATE_NOT_OPER; cdev->private->state = DEV_STATE_NOT_OPER;
spin_unlock_irqrestore(cdev->ccwlock, flags); spin_unlock_irqrestore(cdev->ccwlock, flags);
rc = device_schedule_callback(&cdev->dev, PREPARE_WORK(&cdev->private->kick_work,
ccw_device_remove_orphan_cb); ccw_device_remove_orphan_cb);
if (rc) } else
CIO_MSG_EVENT(0, "Couldn't unregister orphan " /* Deregister subchannel, which will kill the ccw device. */
"0.%x.%04x\n", PREPARE_WORK(&cdev->private->kick_work,
cdev->private->dev_id.ssid, ccw_device_call_sch_unregister);
cdev->private->dev_id.devno); queue_work(slow_path_wq, &cdev->private->kick_work);
return;
}
/* Deregister subchannel, which will kill the ccw device. */
rc = device_schedule_callback(cdev->dev.parent,
ccw_device_remove_sch_cb);
if (rc)
CIO_MSG_EVENT(0, "Couldn't unregister disconnected device "
"0.%x.%04x\n",
cdev->private->dev_id.ssid,
cdev->private->dev_id.devno);
} }
/** /**
...@@ -970,12 +957,17 @@ static void ccw_device_call_sch_unregister(struct work_struct *work) ...@@ -970,12 +957,17 @@ static void ccw_device_call_sch_unregister(struct work_struct *work)
priv = container_of(work, struct ccw_device_private, kick_work); priv = container_of(work, struct ccw_device_private, kick_work);
cdev = priv->cdev; cdev = priv->cdev;
/* Get subchannel reference for local processing. */
if (!get_device(cdev->dev.parent))
return;
sch = to_subchannel(cdev->dev.parent); sch = to_subchannel(cdev->dev.parent);
css_sch_device_unregister(sch); css_sch_device_unregister(sch);
/* Reset intparm to zeroes. */ /* Reset intparm to zeroes. */
sch->schib.pmcw.intparm = 0; sch->schib.pmcw.intparm = 0;
cio_modify(sch); cio_modify(sch);
/* Release cdev reference for workqueue processing.*/
put_device(&cdev->dev); put_device(&cdev->dev);
/* Release subchannel reference for local processing. */
put_device(&sch->dev); put_device(&sch->dev);
} }
...@@ -1001,6 +993,8 @@ io_subchannel_recog_done(struct ccw_device *cdev) ...@@ -1001,6 +993,8 @@ io_subchannel_recog_done(struct ccw_device *cdev)
PREPARE_WORK(&cdev->private->kick_work, PREPARE_WORK(&cdev->private->kick_work,
ccw_device_call_sch_unregister); ccw_device_call_sch_unregister);
queue_work(slow_path_wq, &cdev->private->kick_work); queue_work(slow_path_wq, &cdev->private->kick_work);
/* Release subchannel reference for asynchronous recognition. */
put_device(&sch->dev);
if (atomic_dec_and_test(&ccw_device_init_count)) if (atomic_dec_and_test(&ccw_device_init_count))
wake_up(&ccw_device_init_wq); wake_up(&ccw_device_init_wq);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment