diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2010-04-08 11:46:16 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-04-07 20:16:17 -0400 |
commit | 9ff4cfab82d27e9fda72315f911bbaa9516e04bc (patch) | |
tree | a3c16833f8d9c0eb3d4194f4fd11c98e3899ffb4 | |
parent | 162a689a13ed61c0752726edb75427b2cd4186c1 (diff) |
virtio: console makes incorrect assumption about virtio API
The get_buf() API sets the second arg to the number of bytes *written*
by the other side; in this case it should be zero as these are output buffers.
lguest gets this right (obviously kvm's console doesn't), resulting in
continual buildup of console writes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Amit Shah <amit.shah@redhat.com>
-rw-r--r-- | drivers/char/virtio_console.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 48306bc733f7..86e9011325dc 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -416,20 +416,16 @@ static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count) | |||
416 | out_vq->vq_ops->kick(out_vq); | 416 | out_vq->vq_ops->kick(out_vq); |
417 | 417 | ||
418 | if (ret < 0) { | 418 | if (ret < 0) { |
419 | len = 0; | 419 | in_count = 0; |
420 | goto fail; | 420 | goto fail; |
421 | } | 421 | } |
422 | 422 | ||
423 | /* | 423 | /* Wait till the host acknowledges it pushed out the data we sent. */ |
424 | * Wait till the host acknowledges it pushed out the data we | ||
425 | * sent. Also ensure we return to userspace the number of | ||
426 | * bytes that were successfully consumed by the host. | ||
427 | */ | ||
428 | while (!out_vq->vq_ops->get_buf(out_vq, &len)) | 424 | while (!out_vq->vq_ops->get_buf(out_vq, &len)) |
429 | cpu_relax(); | 425 | cpu_relax(); |
430 | fail: | 426 | fail: |
431 | /* We're expected to return the amount of data we wrote */ | 427 | /* We're expected to return the amount of data we wrote */ |
432 | return len; | 428 | return in_count; |
433 | } | 429 | } |
434 | 430 | ||
435 | /* | 431 | /* |