Regression in linux 2.6.32 virtio_net seen with vhost-net
Subsystems (3)
Quoted 30 lines
On Thu, Dec 17, 2009, Krishna Kumar2/India/IBM@IBMIN wrote on
Subject: Re: [RFC PATCH] Regression in linux 2.6.32
virtio_netseen with vhost-netQuoted 7 lines
Quoted 6 lines
Quoted 3 lines
I think
sch_direct_xmit()is not even callingdev_hard_start_xmit()as the tx queue is stopped
and does adev_requeue_skb()and returnsNETDEV_TX_BUSY.Yes but if the queue was stopped then we shouldn't even get into
sch_direct_xmit.I don't see any checks for
txq_stoppedin the callers of
sch_direct_xmit():Quoted 5 lines
__dev_xmit_skb()andqdisc_restart(). Both these routines get the txq and callsch_direct_xmit()which checks if tx queue is stopped or frozen.Am i missing something?
Yes -
dequeue_skb.The final skb, before the queue was stopped, is transmitted by the driver. The next time
sch_direct_xmitis called, it gets a skb and finds the device is stopped and requeue's the skb. For all subsequent xmits,dequeue_skbreturns NULL (and the other caller -__dev_xmit_skbcan never be called sinceqdisc_qlenis true) and thus requeue's will not happen. This also means that the number of requeues you see (eg 283K in one run) is the number of times the queue was stopped and restarted. So it looks like driver either:
Quoted 5 lines
1. didn't stop the queue when xmiting a packet successfully (the condition being that it would not be possible to xmit the next skb). But this doesn't seem to be the case.
2. wrongly restarted the queue. Possible - since a few places use both the start & wake queue api's.
[ Resending, since I sent to wrong id last time - sorry for some duplicates ]
On a (slightly) related note, qdisc_restart() has this code:
/* Dequeue packet */ skb = dequeue_skb(q); if (unlikely(!skb)) return 0;
When a txq is stopped, all subsequent dev_queue_xmits will execute this path, pass the "unlikely" code, and return. Is it reasonable to remove "unlikely" in both dequeue_skb and qdisc_restart, if so patch inlined below:
thanks,
- KK
From: Krishna Kumar <[email protected]>
1. Remove two unlikely checks since stopped queue's will result int getting a NULL skb.
2. Remove an extra space after unlikely check.
--- net/sched/sch_generic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/sched/sch_generic.c +3 -3
@@ -51,7 +51,7 @@ static inline struct sk_buff *dequeue_sk {struct sk_buff *skb = q->gso_skb; -if (unlikely (skb)) { +if (skb) {struct net_device *dev =qdisc_dev (q);struct netdev_queue *txq;
@@ -134,7 +134,7 @@ int sch_direct_xmit(struct sk_buff *skb, ret =handle_dev_cpu_collision (skb, txq, q); }else {/* Driver returned NETDEV_TX_BUSY - requeue skb */ -if (unlikely (ret !=NETDEV_TX_BUSY &&net_ratelimit ())) +if (unlikely (ret !=NETDEV_TX_BUSY &&net_ratelimit ()))printk (KERN_WARNING "BUG %s code %d qlen %d\n" , dev->name, ret, q->q.qlen);
@@ -176,7 +176,7 @@ static inline int qdisc_restart(struct Q/* Dequeue packet */ skb =dequeue_skb (q); -if (unlikely (!skb)) +if (!skb)return 0 ; root_lock =qdisc_lock (q);
Krishna Kumar wrote, On 12/17/2009 12:20 PM:
...
Quoted 9 lines
[ Resending, since I sent to wrong id last time - sorry for some duplicates ]
On a (slightly) related note,
qdisc_restart()has this code:/* Dequeue packet */ skb = dequeue_skb(q); if (unlikely(!skb)) return 0;
Quoted 4 lines
When a txq is stopped, all subsequent
dev_queue_xmitswill execute this path, pass the "unlikely" code, and return. Is it reasonable to remove "unlikely" in bothdequeue_skbandqdisc_restart, if so patch inlined below:
IMHO we should rather care for the "non-stopped" even if these cases are equally probable, but I doubt they are, especially wrt. modern super-fast NICs, so it would be nice to prove such a change with some test, I guess.
Thanks,
Jarek P.
Quoted 51 lines
thanks,
- KK
From: Krishna Kumar <[email protected]>
1. Remove two unlikely checks since stopped queue's will result int getting a NULL skb.
2. Remove an extra space after unlikely check.Signed-off-by Krishna Kumar <[email protected]>--- net/sched/sch_generic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)diff -ruNp
org/net/sched/sch_generic.cnew/net/sched/sch_generic.cnet/sched/sch_generic.c +3
-4@@ -51,7 +51,7 @@ static inline struct sk_buff *dequeue_sk {struct sk_buff *skb = q->gso_skb; -if (unlikely (skb)) { +if (skb) {struct net_device *dev =qdisc_dev (q);struct netdev_queue *txq;@@ -134,7 +134,7 @@ int sch_direct_xmit(struct sk_buff *skb, ret =handle_dev_cpu_collision (skb, txq, q); }else {/* Driver returned NETDEV_TX_BUSY - requeue skb */ -if (unlikely (ret !=NETDEV_TX_BUSY &&net_ratelimit ())) +if (unlikely (ret !=NETDEV_TX_BUSY &&net_ratelimit ()))printk (KERN_WARNING "BUG %s code %d qlen %d\n" , dev->name, ret, q->q.qlen);@@ -176,7 +176,7 @@ static inline int qdisc_restart(struct Q/* Dequeue packet */ skb =dequeue_skb (q); -if (unlikely (!skb)) +if (!skb)return 0 ; root_lock =qdisc_lock (q); --To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html