From: Ben Greear <greearb@candelatech.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: NetDev <netdev@vger.kernel.org>, robert@herjulf.net
Subject: Re: pktgen and spin_lock_bh in xmit path
Date: Tue, 20 Oct 2009 10:37:36 -0700 [thread overview]
Message-ID: <4ADDF560.1020509@candelatech.com> (raw)
In-Reply-To: <4ADD41F5.5080707@candelatech.com>
On 10/19/2009 09:52 PM, Ben Greear wrote:
> Eric Dumazet wrote:
>> Ben Greear a écrit :
>>> I'm having strange issues when running pktgen on 10G interfaces while
>>> also running
>>> pktgen on mac-vlans on that interface, when the mac-vlan pktgen threads
>>> are on a different
>>> CPU.
I think I found the problem. First, lockdep was not the issue, and mac-vlans
were properly setting up the lockdep keys. I would have expected lockdep to
figure out I was trying to lock a non-valid lock, but maybe something else
kept that from happening.
Second: I think the problem can only happen on my code tree because I
added code to allow mac-vlans to return NETDEV_TX_BUSY
when a hacked varient of dev_queue_xmit decided it could not immediately
transmit a packet. Without my change, a packet would have to be created fresh
in this scenario, so it would not hit the bug.
However, I think pktgen might still need a similar fix because other drivers or
logic might also change the skb tx-queue map.
Here is the problem, or at least one of them:
pktgen tries to xmit, but gets NETDEV_TX_BUSY. During the xmit attempt, the
skb queue map was changed to that of the underlying device, which was 4. Note
that mac-vlans have only a single tx queue.
pktgen will retry this skb, but it never resets the skb queue back to 0.
This means that it will soon be accessing txq[4], which is corrupting
memory. Things rapidly decline from here!
Here is a patch for comment, in case the pktgen folks would like to
apply something similar:
@@ -3991,11 +4001,26 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev, u64 now)
}
}
- if (!pkt_dev->skb) {
+ if ((!pkt_dev->skb) || (pkt_dev->clone_count <= 1)) {
+ /** If clone count is low, that might be because device is a layered
+ * virtual device, like mac-vlan. In that case, the queue-map may be
+ * changed while transmitting out the lower levels, so we need to
+ * reset this here so we don't accidentally use a bogus queue.
+ */
+ reset_queue_map:
set_cur_queue_map(pkt_dev);
queue_map = pkt_dev->cur_queue_map;
} else {
queue_map = skb_get_queue_mapping(pkt_dev->skb);
+ if (unlikely(queue_map >= odev->num_tx_queues)) {
+ static int do_once = 1;
+ if (do_once) {
+ printk("pktgen ERROR: queue_map range error, queue_map: %i num_tx_queues: %i iface: %s\n",
+ queue_map, odev->num_tx_queues, odev->name);
+ WARN_ON(1);
+ }
+ goto reset_queue_map;
+ }
}
txq = netdev_get_tx_queue(odev, queue_map);
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
next prev parent reply other threads:[~2009-10-20 17:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-20 3:38 pktgen and spin_lock_bh in xmit path Ben Greear
2009-10-20 3:48 ` Eric Dumazet
2009-10-20 4:52 ` Ben Greear
2009-10-20 17:37 ` Ben Greear [this message]
2009-10-20 17:44 ` Eric Dumazet
2009-10-20 17:54 ` Ben Greear
2009-10-20 18:35 ` Eric Dumazet
2009-10-20 18:54 ` Eric Dumazet
2009-10-20 20:16 ` Ben Greear
2009-10-20 21:10 ` Ben Greear
2009-10-20 21:22 ` Eric Dumazet
2009-10-20 21:30 ` Ben Greear
2009-10-20 21:57 ` Eric Dumazet
2009-10-20 23:17 ` Ben Greear
2009-10-21 3:05 ` Ben Greear
2009-10-21 3:12 ` Eric Dumazet
2009-10-21 3:59 ` Eric Dumazet
2009-10-21 5:00 ` Ben Greear
2009-10-21 5:14 ` Eric Dumazet
2009-10-21 5:40 ` Ben Greear
2009-10-21 5:12 ` Krishna Kumar2
2009-10-21 5:32 ` Ben Greear
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ADDF560.1020509@candelatech.com \
--to=greearb@candelatech.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=robert@herjulf.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).