OSDN Git Service

vfio-ccw: Prevent quiesce function going into an infinite loop
authorFarhan Ali <alifm@linux.ibm.com>
Tue, 16 Apr 2019 21:23:14 +0000 (17:23 -0400)
committerCornelia Huck <cohuck@redhat.com>
Wed, 24 Apr 2019 12:18:51 +0000 (14:18 +0200)
commitd1ffa760d22aa1d8190478e5ef555c59a771db27
tree67987d48a04ed0d51f6fa68be7f3972213295bc8
parentb49bdc8602b7c9c7a977758bee4125683f73e59f
vfio-ccw: Prevent quiesce function going into an infinite loop

The quiesce function calls cio_cancel_halt_clear() and if we
get an -EBUSY we go into a loop where we:
- wait for any interrupts
- flush all I/O in the workqueue
- retry cio_cancel_halt_clear

During the period where we are waiting for interrupts or
flushing all I/O, the channel subsystem could have completed
a halt/clear action and turned off the corresponding activity
control bits in the subchannel status word. This means the next
time we call cio_cancel_halt_clear(), we will again start by
calling cancel subchannel and so we can be stuck between calling
cancel and halt forever.

Rather than calling cio_cancel_halt_clear() immediately after
waiting, let's try to disable the subchannel. If we succeed in
disabling the subchannel then we know nothing else can happen
with the device.

Suggested-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
Message-Id: <4d5a4b98ab1b41ac6131b5c36de18b76c5d66898.1555449329.git.alifm@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
drivers/s390/cio/vfio_ccw_drv.c