netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shirley Ma <mashirle@us.ibm.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, jasowang@redhat.com
Subject: Re: [PATCH V2]  vhost: fix check for # of outstanding buffers
Date: Thu, 21 Jul 2011 09:12:01 -0700	[thread overview]
Message-ID: <1311264721.3354.7.camel@localhost.localdomain> (raw)
In-Reply-To: <20110721080617.GA20360@redhat.com>

On Thu, 2011-07-21 at 11:06 +0300, Michael S. Tsirkin wrote:
> On Wed, Jul 20, 2011 at 10:23:12AM -0700, Shirley Ma wrote:
> > Fix the check for number of outstanding buffers returns incorrect
> > results due to vq->pend_idx wrap around;
> > 
> > Signed-off-by: Shirley Ma <xma@us.ibm.com>
> 
> OK, the logic's right now, and it's not worse
> than what we had, so I applied this after
> fixing up the comment (it's upend_idx and English
> sentences don't need to end with a semicolumn ;)
> 
> However, I would like to see the effect of the bug
> noted in the log in the future.
> 
> And the reason I mention this here, is that
> I think that the whole VHOST_MAX_PEND thing
> does not work as advertised: this logic only
> triggers when the ring is empty, so we will happily push
> more than VHOST_MAX_PEND packets if the guest manages
> to give them to us.
> 
> I'm not sure why we have the limit, either: the wmem
> limit in the socket still applies and seems more
> effective to prevent denial of service by a malicious guest.

Vhost can push more than VHOST_MAX_PEND if the guest manages to give
more. That's managed by wmem limit.

MAX_PEND is max of outstanding used buffers which lower level device
can't DMAed on time. socket destructor remains unchanged, so it can't
managed by wmem.

Since vhost handle_tx always calls vhost_zerocopy_singal_used() so this
condition is unlikely hit unless the lower device can't DMAed TX
MAX_PEND packets.

Thanks
Shirley


      reply	other threads:[~2011-07-21 16:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20 17:23 [PATCH V2] vhost: fix check for # of outstanding buffers Shirley Ma
2011-07-21  8:06 ` Michael S. Tsirkin
2011-07-21 16:12   ` Shirley Ma [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=1311264721.3354.7.camel@localhost.localdomain \
    --to=mashirle@us.ibm.com \
    --cc=davem@davemloft.net \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.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).