Patchwork How to lock-up your tap-based VM network

login
register
mail settings
Submitter Blue Swirl
Date April 13, 2010, 6:48 p.m.
Message ID <x2of43fc5581004131148p9f1c3c3dm7d50231b50f374f0@mail.gmail.com>
Download mbox | patch
Permalink /patch/50081/
State New
Headers show

Comments

Blue Swirl - April 13, 2010, 6:48 p.m.
On 4/12/10, Paul Brook <paul@codesourcery.com> wrote:
> > A major reason for this deadlock could likely be removed by shutting
>  > down the tap (if peered) or dropping packets in user space (in case of
>  > vlan) when a NIC is stopped or otherwise shut down. Currently most (if
>  > not all) NIC models seem to signal both "queue full" and "RX disabled"
>  > via !can_receive().
>
>
> No. A disabled device should return true from can_recieve, then discard the
>  packets in its receive callback. Failure to do so is a bug in the device. It
>  looks like the virtio-net device may be buggy.

Awesome, it looks like a longstanding bug with pcnet/lance has is
fixed by this change! OpenBSD installer would hang when receiving
packages, now it works!
Blue Swirl - April 13, 2010, 7:13 p.m.
On 4/13/10, Blue Swirl <blauwirbel@gmail.com> wrote:
> On 4/12/10, Paul Brook <paul@codesourcery.com> wrote:
>  > > A major reason for this deadlock could likely be removed by shutting
>  >  > down the tap (if peered) or dropping packets in user space (in case of
>  >  > vlan) when a NIC is stopped or otherwise shut down. Currently most (if
>  >  > not all) NIC models seem to signal both "queue full" and "RX disabled"
>  >  > via !can_receive().
>  >
>  >
>  > No. A disabled device should return true from can_recieve, then discard the
>  >  packets in its receive callback. Failure to do so is a bug in the device. It
>  >  looks like the virtio-net device may be buggy.
>
>
> Awesome, it looks like a longstanding bug with pcnet/lance has is
>  fixed by this change! OpenBSD installer would hang when receiving
>  packages, now it works!

I spoke too soon, networking works also without the patch now.

Patch

diff --git a/hw/pcnet.c b/hw/pcnet.c
index 5e63eb5..a04ad09 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1031,8 +1031,6 @@  static int pcnet_tdte_poll(PCNetState *s)
 int pcnet_can_receive(VLANClientState *nc)
 {
     PCNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
-    if (CSR_STOP(s) || CSR_SPND(s))
-        return 0;

     return sizeof(s->buffer)-16;
 }