virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 3/4] virtio: console makes incorrect assumption about virtio API
Date: Tue, 30 Mar 2010 12:00:45 +0530	[thread overview]
Message-ID: <20100330063044.GD28273@amit-x200.redhat.com> (raw)
In-Reply-To: <201003301549.22395.rusty@rustcorp.com.au>

On (Tue) Mar 30 2010 [15:49:22], Rusty Russell wrote:
> 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>
> To: Amit Shah <amit.shah@redhat.com>

Acked-by: Amit Shah <amit.shah@redhat.com>

> ---
>  drivers/char/virtio_console.c |   10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
> --- a/drivers/char/virtio_console.c
> +++ b/drivers/char/virtio_console.c
> @@ -415,20 +415,16 @@ static ssize_t send_buf(struct port *por
>  	out_vq->vq_ops->kick(out_vq);
>  
>  	if (ret < 0) {
> -		len = 0;
> +		in_count = 0;
>  		goto fail;
>  	}
>  
> -	/*
> -	 * Wait till the host acknowledges it pushed out the data we
> -	 * sent. Also ensure we return to userspace the number of
> -	 * bytes that were successfully consumed by the host.
> -	 */
> +	/* Wait till the host acknowledges it pushed out the data we sent. */
>  	while (!out_vq->vq_ops->get_buf(out_vq, &len))
>  		cpu_relax();
>  fail:
>  	/* We're expected to return the amount of data we wrote */
> -	return len;
> +	return in_count;
>  }
>  
>  /*
> 

		Amit
-- 
http://log.amitshah.net/

      reply	other threads:[~2010-03-30  6:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30  5:19 [PATCH 3/4] virtio: console makes incorrect assumption about virtio API Rusty Russell
2010-03-30  6:30 ` Amit Shah [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100330063044.GD28273@amit-x200.redhat.com \
    --to=amit.shah@redhat.com \
    --cc=mst@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).