Re: Linux guest domain with two vnets , the dirty quick fix

From: hyl
Date: Wed Sep 23 2009 - 05:44:09 EST


1. add the debug code:
--- a/drivers/net/sunvnet.c
+++ b/drivers/net/sunvnet.c
@@ -540,6 +540,11 @@ static void vnet_event(void *arg, int event)
}
if (err == 0)
break;
+ {
+ long stackdiff;
+ viodbg(DATA, "** vio:%llx, vio->lp:%llx, stack:%llx\n",
+ &vio, &vio->lp, &stackdiff);
+ }
viodbg(DATA, "TAG [%02x:%02x:%04x:%08x]\n",
msgbuf.tag.type,
msgbuf.tag.stype,

2. the output
from the below output, we see a re-enter to vnet_event happend. the
vio-hardwre report 2 interrupt
for same packet/or msg( why?)

vio: ID[0] vnet_walk_rx start[00000009] end[00000008]
vio: ID[0] vio_walk_rx_one desc[02:00:0000003c:00000001:842800:800]
vio: ID[0] vio_walk_rx_one desc[01:00:00000000:00000001:845000:800]
vio: ID[0] ** vio:fffff8003f9cafa8, vio->lp:fffff8003ebf0008,
stack:fffff8003f9cafa0 << same ldc vio
vio: ID[0] ** vio:fffff8003f9cafa8, vio->lp:fffff8003ebf0008,
stack:fffff8003f9ccc << with diffrent run stack
afa0
vio: ID[0] TAG [02:01:0042:0d4becc7]
vio: ID[0] TAG [02:01:0042:0d4becc7]
...........
vio: ID[0] vnet_walk_rx start[0000000a] end[00000009]
vio: ID[0] vio_walk_rx_one desc[02:00:0000003c:00000001:845000:800]
vio: ID[0] vio_walk_rx_one desc[02:00:0000003c:00000001:845000:800]
vio: ID[0] vio_walk_rx_one desc[01:00:00000000:00000001:847800:800]
vio: ID[0] vio_walk_rx_one desc[01:00:00000000:00000001:847800:800]
vio: ID[0] ** vio:fffff8003f9cb588, vio->lp:fffff8003ebf0008,
stack:fffff8003f9cb580
vio: ID[0] ** vio:fffff8003f9cb588, vio->lp:fffff8003ebf0008,
stack:fffff8003f9ccc


3. where need protection
the reason is :
static irqreturn_t ldc_rx(int irq, void *dev_id){

out:
spin_unlock_irqrestore(&lp->lock, flags);
<<
here run with out any lock
send_events(lp, event_mask);

4. the dirty fix, welcome fain grained lock implementation suggestion: