From: Eric Dumazet <eric.dumazet@gmail.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: Jiri Pirko <jpirko@redhat.com>,
netdev@vger.kernel.org, Alexey Dobriyan <adobriyan@gmail.com>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] pktgen: Clone skb to avoid corruption of skbs in ndo_start_xmit methods
Date: Wed, 20 Jul 2011 02:43:12 +0200 [thread overview]
Message-ID: <1311122593.3113.46.camel@edumazet-laptop> (raw)
In-Reply-To: <20110720001904.GA1992@neilslaptop.think-freely.org>
Le mardi 19 juillet 2011 à 20:19 -0400, Neil Horman a écrit :
> >
> You are correct Eric, this can cause a significant performance regression, but I
> think that beats causing a panic or other unexpected behavior. I read your
> previous threads with others regarding fixing this with vlans, but I don't think
> its fair to just say 'its fast, but it might cause oopses'.
>
> And its not sufficient to simply forbid soft drivers to make use of pktgen, its
> not just a soft driver problem, its systemic. Any driver which assumes that it
> has exclusive access to an skb submitted for transmit is at risk from pktgen in
> its current implementation. That of course as a subset includes all the soft
> drivers, but others are also suceptible. As examples (some of which I noted in
> the origional post) virtio_net uses the skb->cb to hold vnet header information
> which will be corrupted on sucessive sends. bnx2x linearizes skbs under certain
> circumstances, which means pktgen, if it marshals a fragmented frame will not
> send a fragmented frame after the first iteration. The PPP and Slip drivers
> skb_push the skb to prepend a header to the frame on send, meaning sucessive
> uses, up until they get an skb_under_panic will get iteratively more malformed
> frames on the wire as ppp headers get stacked on top of one another. These are
> ust a few of the examples I've found.
>
> The long and the short of it in my mind, is that we have a fundamental
> disconnect between driver asumptions and pktgen. If its ok to submit shared
> skbs to drivers, then we need to augment drivers that modify skbs on transmit to
> clone the skb (likey not an efficient solution), or if its not ok to do so, we
> need to change pktgen to not behave that way.
>
Its a known problem, please check mail archives. Nobody felt a fix was
needed.
> > Note : a sysadmin has other ways to make a machine panic or reboot or
> > halt...
> Yes, predictable ways, that the sysadmin can see coming based on what they're
> doing (i.e. no one should be shocked if they dd /dev/random to /dev/kmem and get
> a hang or panic, or if they issue a sysrq-c, etc). This case is different. A
> sysadmin reasonably expects pktgen to send the frames they configure on the
> interface they specify. While its arguably reasonable to forsee that it may not
> work with soft interfaces, pktgen just won't work with some hardware drivers (as
> per the examples above). And it won't always be an oops, it may be occasional
> random behvaior in the output data, and its highly dependent not just on the use
> of pktgen, but rather the specific command(s) issued.
>
>
> I'm sensitive to the performance impact, but I would much rather see a lower
> performing pktgen that doesn't randomly crash, and bring the performance back up
> in a safe, reliable way. To that end, I've been starting to think about
> pre-allocating a ring buffer of skbs with a skb->users count biased up to
> prevent driver freeing. That way we could detect 'unused skb's' by a user count
> that was at the bias level. Thoughts?
>
I dont know. I use pktgen maybe once per week and never got a single
crash like this. We probably are very few pktgen users in the world, and
we use it exactly to avoid calling skb_clone() or other expensive per
xmit setup.
Just remove pktgen from RedHat kernels, if you dont trust sysadmins.
# CONFIG_PKTGEN is not set
Alternatively, add a check to problematic drivers to _not_ mess skb if
skb_shared(skb) is true : eventually use skb_share_check()
next prev parent reply other threads:[~2011-07-20 0:43 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-19 19:52 [PATCH] pktgen: Clone skb to avoid corruption of skbs in ndo_start_xmit methods Neil Horman
2011-07-19 20:02 ` Eric Dumazet
2011-07-19 20:17 ` Joe Perches
2011-07-19 20:29 ` Jiri Pirko
2011-07-19 20:41 ` Eric Dumazet
2011-07-19 21:01 ` Ben Greear
2011-07-20 0:19 ` Neil Horman
2011-07-20 0:25 ` Rick Jones
2011-07-20 15:23 ` Loke, Chetan
2011-07-20 0:43 ` Eric Dumazet [this message]
2011-07-20 0:52 ` Ben Greear
2011-07-20 2:07 ` Neil Horman
2011-07-20 4:19 ` Ben Greear
2011-07-20 4:24 ` Eric Dumazet
2011-07-20 15:17 ` Loke, Chetan
2011-07-20 15:18 ` Neil Horman
2011-07-20 15:30 ` Eric Dumazet
2011-07-20 15:39 ` Neil Horman
2011-07-20 15:44 ` Eric Dumazet
2011-07-20 16:19 ` Neil Horman
2011-07-20 15:35 ` Michał Mirosław
2011-07-20 15:40 ` Neil Horman
2011-07-20 16:08 ` Michał Mirosław
2011-07-20 16:18 ` Neil Horman
2011-07-20 16:37 ` Ben Greear
2011-07-20 16:33 ` Ben Greear
2011-07-20 16:36 ` Neil Horman
2011-07-21 22:01 ` David Miller
2011-07-21 22:14 ` Ben Greear
2011-07-21 22:19 ` David Miller
2011-07-21 22:26 ` Ben Greear
2011-07-21 23:50 ` Neil Horman
2011-07-22 0:08 ` David Miller
2011-07-22 1:37 ` Neil Horman
2011-07-20 1:59 ` Neil Horman
2011-07-25 19:45 ` [PATCH 0/2] pktgen: Clone skb to avoid corruption of skbs in ndo_start_xmit methods (v2) Neil Horman
2011-07-25 19:45 ` [PATCH 1/2] net: add IFF_SKB_TX_SHARED flag to priv_flags Neil Horman
2011-07-25 20:11 ` Eric Dumazet
2011-07-26 14:54 ` Neil Horman
2011-07-25 19:45 ` [PATCH 2/2] net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared Neil Horman
2011-07-26 18:34 ` Krzysztof Halasa
2011-07-26 16:05 ` [PATCH 0/2] pktgen: Clone skb to avoid corruption of skbs in ndo_start_xmit methods (v3) Neil Horman
2011-07-26 16:05 ` [PATCH 1/2] net: add IFF_SKB_TX_SHARED flag to priv_flags Neil Horman
2011-07-28 5:42 ` David Miller
2011-07-28 8:15 ` Robert Olsson
2011-07-28 10:50 ` Neil Horman
2011-07-26 16:05 ` [PATCH 2/2] net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared Neil Horman
2011-07-28 5:42 ` David Miller
2011-07-29 6:16 ` [PATCH 0/2] pktgen: Clone skb to avoid corruption of skbs in ndo_start_xmit methods (v3) Michael S. Tsirkin
2011-07-29 11:19 ` Neil Horman
2011-08-17 15:07 ` Ben Hutchings
2011-08-22 0:27 ` Neil Horman
2011-08-22 16:17 ` Ben Hutchings
2011-08-22 17:33 ` Ben Hutchings
2011-08-22 18:14 ` Neil Horman
2011-08-23 14:01 ` Ben Hutchings
2011-08-23 15:13 ` Neil Horman
2011-08-23 15:53 ` Ben Hutchings
2011-08-23 16:21 ` Neil Horman
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=1311122593.3113.46.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=adobriyan@gmail.com \
--cc=davem@davemloft.net \
--cc=jpirko@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
/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