* [Qemu-devel] [PATCH] s390-ccw: Fix ipl failure.
@ 2013-08-30 7:59 Cornelia Huck
2013-08-30 7:59 ` [Qemu-devel] [PATCH] s390-ccw.img: Fix waiting for virtio processing Cornelia Huck
0 siblings, 1 reply; 3+ messages in thread
From: Cornelia Huck @ 2013-08-30 7:59 UTC (permalink / raw)
To: Alexander Graf
Cc: Cornelia Huck, Christian Borntraeger, qemu-devel, Dominik Dingel
Hi Alex,
here's a simple patch that makes starting from a dataplane-backed device
on a fast LPAR work for me. I make some assumptions on the host behaviour,
but I think it's fine for that very simple implementation (and it certainly
works better than before :)
Could you either take or ack this patch? I can also prepare a pull request.
Cornelia Huck (1):
s390-ccw.img: Fix waiting for virtio processing.
pc-bios/s390-ccw/virtio.c | 10 +++++++---
pc-bios/s390-ccw/virtio.h | 1 +
2 files changed, 8 insertions(+), 3 deletions(-)
--
1.8.3.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH] s390-ccw.img: Fix waiting for virtio processing.
2013-08-30 7:59 [Qemu-devel] [PATCH] s390-ccw: Fix ipl failure Cornelia Huck
@ 2013-08-30 7:59 ` Cornelia Huck
2013-08-30 8:38 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Cornelia Huck @ 2013-08-30 7:59 UTC (permalink / raw)
To: Alexander Graf
Cc: Cornelia Huck, Christian Borntraeger, qemu-devel, Dominik Dingel
The guest side must not manipulate the index for the used buffers. Instead,
remember the state of the used buffer locally and wait until it has moved.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
pc-bios/s390-ccw/virtio.c | 10 +++++++---
pc-bios/s390-ccw/virtio.h | 1 +
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c
index 49f2d29..03f6fde 100644
--- a/pc-bios/s390-ccw/virtio.c
+++ b/pc-bios/s390-ccw/virtio.c
@@ -150,8 +150,6 @@ static void vring_send_buf(struct vring *vr, void *p, int len, int flags)
if (!(flags & VRING_DESC_F_NEXT)) {
vr->avail->idx++;
}
-
- vr->used->idx = vr->next_idx;
}
static u64 get_clock(void)
@@ -180,7 +178,13 @@ static int vring_wait_reply(struct vring *vr, int timeout)
struct subchannel_id schid = vr->schid;
int r = 0;
- while (vr->used->idx == vr->next_idx) {
+ vr->used_idx = vr->used->idx;
+ /*
+ * Wait until the used index has moved.
+ * Note: This is only race-free if the host doesn't start draining
+ * the queue out of its own accord.
+ */
+ while (vr->used->idx == vr->used_idx) {
vring_notify(schid);
if (timeout && (get_second() >= target_second)) {
r = 1;
diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h
index 86fdd57..772a63f 100644
--- a/pc-bios/s390-ccw/virtio.h
+++ b/pc-bios/s390-ccw/virtio.h
@@ -115,6 +115,7 @@ struct vring_used {
struct vring {
unsigned int num;
int next_idx;
+ int used_idx;
struct vring_desc *desc;
struct vring_avail *avail;
struct vring_used *used;
--
1.8.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-30 8:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-30 7:59 [Qemu-devel] [PATCH] s390-ccw: Fix ipl failure Cornelia Huck
2013-08-30 7:59 ` [Qemu-devel] [PATCH] s390-ccw.img: Fix waiting for virtio processing Cornelia Huck
2013-08-30 8:38 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).