summaryrefslogtreecommitdiff
path: root/drivers/s390/kvm
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2013-01-07 15:51:52 +0100
committerMarcelo Tosatti <mtosatti@redhat.com>2013-01-09 18:40:19 -0200
commitb26ba22bb4f12289f9d5eb878c490e674934a197 (patch)
tree0782745449e21009e95e74ff6efbfbf7b14cf1d5 /drivers/s390/kvm
parent73fa21ea4fc662a2e8e85f84c4ca3fcb55fa4da2 (diff)
KVM: s390: Gracefully handle busy conditions on ccw_device_start
In rare cases a virtio command might try to issue a ccw before a former ccw was answered with a tsch. This will cause CC=2 (busy). Lets just retry in that case. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'drivers/s390/kvm')
-rw-r--r--drivers/s390/kvm/virtio_ccw.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
index 70419a75d0e0..2edd94af131c 100644
--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -132,11 +132,14 @@ static int ccw_io_helper(struct virtio_ccw_device *vcdev,
unsigned long flags;
int flag = intparm & VIRTIO_CCW_INTPARM_MASK;
- spin_lock_irqsave(get_ccwdev_lock(vcdev->cdev), flags);
- ret = ccw_device_start(vcdev->cdev, ccw, intparm, 0, 0);
- if (!ret)
- vcdev->curr_io |= flag;
- spin_unlock_irqrestore(get_ccwdev_lock(vcdev->cdev), flags);
+ do {
+ spin_lock_irqsave(get_ccwdev_lock(vcdev->cdev), flags);
+ ret = ccw_device_start(vcdev->cdev, ccw, intparm, 0, 0);
+ if (!ret)
+ vcdev->curr_io |= flag;
+ spin_unlock_irqrestore(get_ccwdev_lock(vcdev->cdev), flags);
+ cpu_relax();
+ } while (ret == -EBUSY);
wait_event(vcdev->wait_q, doing_io(vcdev, flag) == 0);
return ret ? ret : vcdev->err;
}