Regression in linux 2.6.32 virtio_net seen with vhost-net
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Herbert Xu <[email protected]> wrote on 12/17/2009 06:01:53 PM:
Quoted 7 lines
Quoted 7 lines
On a (slightly) related note,
qdisc_restart()has this code:/* Dequeue packet */ skb = dequeue_skb(q); if (unlikely(!skb)) return 0;
Quoted 8 lines
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:Why would it return skb == NULL? If the queue is stopped, then chances are packets will pile up in the qdisc so
dequeue_skbshould return a non-NULL skb.
Since dequeue_skb finds the first skb that was cached in gso_skb, handles the stopped txq and returns NULL for all subsequent skbs. And qdisc_restart bails out immediately. Only the first skb will get requeue'd, and no more skbs are taken out of the queue - either dequeue or gso_skb, till the driver restarts the queue. That's why I think this code is not the issue, and probably as optimized as possible for all cases.
I still feel the device is wrongly waking up the txq, and next tx fails, driver stops the queue, and core does another requeue/sched, and so on.
thanks,
- KK
Quoted 6 lines · On Thu, Dec 17, 2009 at 06:26:33PM +0530, Krishna Kumar2 wrote:
Since
dequeue_skbfinds the first skb that was cached ingso_skb, handles the stopped txq and returns NULL for all subsequent skbs. Andqdisc_restartbails out immediately. Only the first skb will get requeue'd, and no more skbs are taken out of the queue - either dequeue orgso_skb, till the driver restarts the queue.
But dev_requeue_skb immediately reschedules a new TX softirq so this will keep going until the hardware wakes up the queue.
That is, we have an infinite loop consuming CPU that could otherwise be spent doing useful work, such as generating new packets.
Note that this is not new in 2.6.32. It has been this way since 2008 at least.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtHerbert Xu <[email protected]> wrote on 12/17/2009 07:10:53 PM:
Quoted 11 lines
Quoted 5 lines
Since
dequeue_skbfinds the first skb that was cached ingso_skb, handles the stopped txq and returns NULL for all subsequent skbs. Andqdisc_restartbails out immediately. Only the first skb will get requeue'd, and no more skbs are taken out of the queue - either dequeue orgso_skb, till the driver restarts the queue.But
dev_requeue_skbimmediately reschedules a new TX softirq so this will keep going until the hardware wakes up the queue.That is, we have an infinite loop consuming CPU that could otherwise be spent doing useful work, such as generating new packets.
Except that dev_requeue_skb is never called again till the device is restarted and stopped. It is called once per stop, and after this, dequeue_skb never returns a skb, hence no more requeue's.
Thanks,
- KK