Skip to contentSkip to conversation

Regression in linux 2.6.32 virtio_net seen with vhost-net

RFC PATCH Krishna Kumar2 2 participants 3 messages Dec 17, 2009 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive

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_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:

Why would it return skb == NULL? If the queue is stopped, then chances are packets will pile up in the qdisc so dequeue_skb should 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

#3 lore raw
Quoted 6 lines · On Thu, Dec 17, 2009 at 06:26:33PM +0530, Krishna Kumar2 wrote:

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.

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.txt
#4 lore raw

Herbert Xu <[email protected]> wrote on 12/17/2009 07:10:53 PM:

Quoted 11 lines
Quoted 5 lines

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.

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.

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