From: Rusty Russell <rusty@rustcorp•com.au>
To: "Michael S. Tsirkin" <mst@redhat•com>
Cc: Krishna Kumar2 <krkumar2@in•ibm.com>,
davem@davemloft•net, netdev@vger•kernel.org, yvugenfi@redhat•com
Subject: Re: [PATCH] virtio_net: Fix queue full check
Date: Mon, 8 Nov 2010 09:38:47 +1030 [thread overview]
Message-ID: <201011080938.47938.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20101104122424.GA29830@redhat.com>
On Thu, 4 Nov 2010 10:54:24 pm Michael S. Tsirkin wrote:
> I thought about this some more. I think the original
> code is actually correct in returning ENOSPC: indirect
> buffers are nice, but it's a mistake
> to rely on them as a memory allocation might fail.
>
> And if you look at virtio-net, it is dropping packets
> under memory pressure which is not really a happy outcome:
> the packet will get freed, reallocated and we get another one,
> adding pressure on the allocator instead of releasing it
> until we free up some buffers.
>
> So I now think we should calculate the capacity
> assuming non-indirect entries, and if we manage to
> use indirect, all the better.
I've long said it's a weakness in the network stack that it insists
drivers stop the tx queue before they *might* run out of room, leading to
worst-case assumptions and underutilization of the tx ring.
However, I lost that debate, and so your patch is the way it's supposed to
work. The other main indirect user (block) doesn't care as its queue
allows for post-attempt blocking.
I enhanced your commentry a little:
Subject: virtio: return correct capacity to users
Date: Thu, 4 Nov 2010 14:24:24 +0200
From: "Michael S. Tsirkin" <mst@redhat•com>
We can't rely on indirect buffers for capacity
calculations because they need a memory allocation
which might fail. In particular, virtio_net can get
into this situation under stress, and it drops packets
and performs badly.
So return the number of buffers we can guarantee users.
Signed-off-by: Michael S. Tsirkin <mst@redhat•com>
Signed-off-by: Rusty Russell <rusty@rustcorp•com.au>
Reported-By: Krishna Kumar2 <krkumar2@in•ibm.com>
Thanks!
Rusty.
next prev parent reply other threads:[~2010-11-07 23:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-28 5:10 [PATCH] virtio_net: Fix queue full check Krishna Kumar
2010-10-29 9:47 ` Rusty Russell
2010-10-29 10:55 ` Krishna Kumar2
2010-10-29 11:28 ` Rusty Russell
2010-11-02 16:17 ` Michael S. Tsirkin
2010-11-04 12:24 ` Michael S. Tsirkin
2010-11-04 16:17 ` Krishna Kumar2
2010-11-04 16:45 ` Michael S. Tsirkin
2010-11-07 23:08 ` Rusty Russell [this message]
2010-11-09 4:26 ` Krishna Kumar2
2010-11-09 13:15 ` Michael S. Tsirkin
2010-11-09 15:30 ` Krishna Kumar2
2010-11-09 15:30 ` Michael S. Tsirkin
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=201011080938.47938.rusty@rustcorp.com.au \
--to=rusty@rustcorp$(echo .)com.au \
--cc=davem@davemloft$(echo .)net \
--cc=krkumar2@in$(echo .)ibm.com \
--cc=mst@redhat$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=yvugenfi@redhat$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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