qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] s390-ccw: Fix ipl failure.
@ 2013-08-30  9:03 Cornelia Huck
  2013-08-30  9:03 ` [Qemu-devel] [PATCH v2] s390-ccw: Fix waiting for virtio processing Cornelia Huck
  0 siblings, 1 reply; 4+ messages in thread
From: Cornelia Huck @ 2013-08-30  9:03 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Cornelia Huck, Christian Borntraeger, qemu-devel, Dominik Dingel,
	Paolo Bonzini

Hi,

here's v2 of the s390-ccw bios fix, improved as by Paolo's suggestion.

Still works fine for me with a dataplane device :)

Cornelia Huck (1):
  s390-ccw: Fix waiting for virtio processing.

 pc-bios/s390-ccw/virtio.c | 7 ++++---
 pc-bios/s390-ccw/virtio.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

-- 
1.8.3.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH v2] s390-ccw: Fix waiting for virtio processing.
  2013-08-30  9:03 [Qemu-devel] [PATCH v2] s390-ccw: Fix ipl failure Cornelia Huck
@ 2013-08-30  9:03 ` Cornelia Huck
  2013-08-30 13:13   ` Alexander Graf
  0 siblings, 1 reply; 4+ messages in thread
From: Cornelia Huck @ 2013-08-30  9:03 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Cornelia Huck, Christian Borntraeger, qemu-devel, Dominik Dingel,
	Paolo Bonzini

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>

--

v1 -> v2: Move setting the used index as by Paolo's suggestion
---
 pc-bios/s390-ccw/virtio.c | 7 ++++---
 pc-bios/s390-ccw/virtio.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c
index 49f2d29..4d6e48f 100644
--- a/pc-bios/s390-ccw/virtio.c
+++ b/pc-bios/s390-ccw/virtio.c
@@ -123,6 +123,7 @@ static void vring_init(struct vring *vr, unsigned int num, void *p,
     /* We're running with interrupts off anyways, so don't bother */
     vr->used->flags = VRING_USED_F_NO_NOTIFY;
     vr->used->idx = 0;
+    vr->used_idx = 0;
 
     debug_print_addr("init vr", vr);
 }
@@ -150,8 +151,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 +179,8 @@ 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) {
+    /* Wait until the used index has moved. */
+    while (vr->used->idx == vr->used_idx) {
         vring_notify(schid);
         if (timeout && (get_second() >= target_second)) {
             r = 1;
@@ -189,6 +189,7 @@ static int vring_wait_reply(struct vring *vr, int timeout)
         yield();
     }
 
+    vr->used_idx = vr->used->idx;
     vr->next_idx = 0;
     vr->desc[0].len = 0;
     vr->desc[0].flags = 0;
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] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] s390-ccw: Fix waiting for virtio processing.
  2013-08-30  9:03 ` [Qemu-devel] [PATCH v2] s390-ccw: Fix waiting for virtio processing Cornelia Huck
@ 2013-08-30 13:13   ` Alexander Graf
  2013-08-30 13:23     ` Christian Borntraeger
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2013-08-30 13:13 UTC (permalink / raw)
  To: Cornelia Huck
  Cc: Christian Borntraeger, qemu-devel, Dominik Dingel, Paolo Bonzini


On 30.08.2013, at 11:03, Cornelia Huck wrote:

> 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>

Acked-by: Alexander Graf <agraf@suse.de>

Christian, do you want to queue this up?

Connie, next time for patch sets that only contain a single patch, please don't do a cover letter. However, when you do create a cover letter, please use git format-patch -n, so that it's obvious that this is a patch set from the subject lines :).


Alex

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] s390-ccw: Fix waiting for virtio processing.
  2013-08-30 13:13   ` Alexander Graf
@ 2013-08-30 13:23     ` Christian Borntraeger
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Borntraeger @ 2013-08-30 13:23 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Cornelia Huck, Paolo Bonzini, qemu-devel, Dominik Dingel

On 30/08/13 15:13, Alexander Graf wrote:
> 
> On 30.08.2013, at 11:03, Cornelia Huck wrote:
> 
>> 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>
> 
> Acked-by: Alexander Graf <agraf@suse.de>
> 
> Christian, do you want to queue this up?

Either me or Conny.
Conny, can you also update the binary rom image in a 2nd patch in that series?

Christian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-30 13:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-30  9:03 [Qemu-devel] [PATCH v2] s390-ccw: Fix ipl failure Cornelia Huck
2013-08-30  9:03 ` [Qemu-devel] [PATCH v2] s390-ccw: Fix waiting for virtio processing Cornelia Huck
2013-08-30 13:13   ` Alexander Graf
2013-08-30 13:23     ` Christian Borntraeger

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).