From: Jarek Poplawski <jarkao2@gmail.com>
To: Michael Breuer <mbreuer@majjas.com>
Cc: David Miller <davem@davemloft.net>,
shemminger@linux-foundation.org, akpm@linux-foundation.org,
flyboy@gmail.com, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH] af_packet: Don't use skb after dev_queue_xmit()
Date: Wed, 6 Jan 2010 21:22:12 +0100 [thread overview]
Message-ID: <20100106202212.GB3354@del.dom.local> (raw)
In-Reply-To: <4B44E952.5000804@majjas.com>
On Wed, Jan 06, 2010 at 02:49:38PM -0500, Michael Breuer wrote:
> On 1/6/2010 2:22 AM, Jarek Poplawski wrote:
> >On Tue, Jan 05, 2010 at 09:36:28PM -0500, Michael Breuer wrote:
> >>On 1/5/2010 6:07 PM, Jarek Poplawski wrote:
> >>>David Miller wrote, On 12/27/2009 05:11 AM:
> >>>
> >>>
> >>>>From: David Miller<davem@davemloft.net>
> >>>>Date: Sat, 26 Dec 2009 19:44:18 -0800 (PST)
> >>>>
> >>>>
> >>>>>From: Stephen Hemminger<shemminger@linux-foundation.org>
> >>>>>Date: Sat, 26 Dec 2009 14:05:44 -0800
> >>>>>
> >>>>>
> >>>>>>Other drivers may have same problem, I really think this ought
> >>>>>>to be done at higher level.
> >>>>>>
> >>>>>I tend to agree with you, and I thought we had handled all
> >>>>>cases. Let's simply make AF_PACKET linearize the link
> >>>>>level header before sending things out to the transmit path.
> >>>>>
> >>>>>I can work on this if you want.
> >>>>>
> >>>>Actually Stephen, I took a look and I can't see how AF_PACKET
> >>>>can create this situation.
> >>>>
> >>>>It always copies into the linear area of the SKB it allocates
> >>>>for sendmsg() processing. Whether the data comes from sendmsg
> >>>>data or the mmap() ring buffer.
> >>>>
> >>>Actually, I think there is a bug in this place, but of course this
> >>>might be unconnected. Anyway, Michael, could you try this patch?
> >>>BTW, did you try with CONFIG_PACKET_MMAP disabled?
> >>>
> >>>Thanks,
> >>>Jarek P.
> >>>----------------->
> >>>
> >>>Changing an skb after dev_queue_xmit() is illegal. And since it's
> >>>inconsistent to treat specially net_xmit_errno() non-zero return,
> >>>while ignoring other dev_queue_xmit() errors, there is no reason
> >>>to break the loop in tpacket_snd() in this case.
> >>>
> >>>With debugging by: Stephen Hemminger<shemminger@linux-foundation.org>
> >>>
> >>>Reported-by: Michael Breuer<mbreuer@majjas.com>
> >>>Signed-off-by: Jarek Poplawski<jarkao2@gmail.com>
> >>>---
> >>>
> >>> net/packet/af_packet.c | 8 +++-----
> >>> 1 files changed, 3 insertions(+), 5 deletions(-)
> >>>
> >>>diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> >>>index e0516a2..984a1fa 100644
> >>>--- a/net/packet/af_packet.c
> >>>+++ b/net/packet/af_packet.c
> >>>@@ -1021,8 +1021,9 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
> >>>
> >>> status = TP_STATUS_SEND_REQUEST;
> >>> err = dev_queue_xmit(skb);
> >>>- if (unlikely(err> 0&& (err = net_xmit_errno(err)) != 0))
> >>>- goto out_xmit;
> >>>+ if (unlikely(err> 0))
> >>>+ err = net_xmit_errno(err);
> >>>+
> >>> packet_increment_head(&po->tx_ring);
> >>> len_sum += tp_len;
> >>> } while (likely((ph != NULL) ||
> >>>@@ -1033,9 +1034,6 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
> >>> err = len_sum;
> >>> goto out_put;
> >>>
> >>>-out_xmit:
> >>>- skb->destructor = sock_wfree;
> >>>- atomic_dec(&po->tx_ring.pending);
> >>> out_status:
> >>> __packet_set_status(po, ph, status);
> >>> kfree_skb(skb);
> >>>--
> >>>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> >>>the body of a message to majordomo@vger.kernel.org
> >>>More majordomo info at http://vger.kernel.org/majordomo-info.html
> >>>Please read the FAQ at http://www.tux.org/lkml/
> >>>
> >>This patch solves the original reported oops - as did Steven's patch of
> >>12/26: [PATCH] sky2: make sure ethernet header is in transmit skb (I ran
> >>without Steven's patch and with this patch).
> >>
> >>Oddly, with this patch vs. Steven's - I'm getting software interrupt
> >>errors sporadically while not under load - with Steven's I get the
> >>frequently while under load (as per nethogs). For example:
> >>Jan 5 21:29:00 mail kernel: sky2 0000:06:00.0: error interrupt
> >>status=0x40000008
> >>Jan 5 21:29:00 mail kernel: sky2 software interrupt status 0x40000008
> >>Jan 5 21:29:00 mail kernel: sky2 Tx ring pending=124...125 report=125
> >>done=125
> >>Jan 5 21:29:00 mail kernel: 124: 0xb38de0be(5374)
> >>Jan 5 21:29:00 mail kernel: sky2 0000:06:00.0: error interrupt status=0x8
> >>Jan 5 21:29:00 mail kernel: sky2 software interrupt status 0x8
> >>Jan 5 21:29:00 mail kernel: sky2 Tx ring pending=126...127 report=126
> >>done=127
> >>Jan 5 21:29:00 mail kernel: 126: 0xb38d80be(9014)
> >>
> >>I also believe (can't prove yet) that my load test is slower with this
> >>patch vs. the sky2 patch.
> >>
> >>Is it possible that this patch is causing the transmission to
> >>momentarily halt such that the overall utilization appears low at the
> >>time I see the interrupt errors, vs. the other patch which perhaps
> >>doesn't interrupt the traffic flow quite so much?
> >Yes, without this patch xmit could be stopped earlier on some kind of
> >errors, with retransmit of the last message possible. On the other
> >hand, other dev_queue_xmit() (negative) errors, are ignored. So this
> >place could be still improved by adding proper err handling (or
> >removing getting err return from dev_queue_xmit() at all).
> >
> >Anyway, I think this patch should be a safe proposal for stable. If
> >so, David, please add Michael's "Tested-by".
> >
> >>I haven't run yet with CONFIG_PACKET_MMAP disabled.
> >>
> >This should behave similarly as MMAP with this patch or maybe even
> >better in case of errors.
> >
> >Thanks,
> >Jarek P.
> This patch at first behaved similarly to the previous one - seemed
> to be running a bit better... until the adapter went down :(
I'm not sure: do you mean this patch above vs previous one by Stephen,
or did you manage to try my "alernative #2" patch already?
BTW, I forgot to mention, and maybe it doesn't matter here, but it
would be better to (always) use my sky2 patch from Berck Nash's
thread.
Jarek P.
next prev parent reply other threads:[~2010-01-06 20:22 UTC|newest]
Thread overview: 140+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4B300A2A.8040305@gmail.com>
2009-12-24 6:58 ` sky2 panic in 2.6.32.1 under load Andrew Morton
2009-12-24 16:03 ` Berck Nash
2009-12-24 16:28 ` Daniel Hazelton
2009-12-24 22:21 ` Stephen Hemminger
2009-12-24 22:42 ` Michael Breuer
2009-12-25 0:06 ` Daniel Hazelton
2009-12-24 16:10 ` Michael Breuer
2009-12-24 16:16 ` Berck Nash
2009-12-24 16:26 ` Michael Breuer
[not found] ` <4B300E30.9090707@majjas.com>
[not found] ` <4B3114E3.1070602@majjas.com>
[not found] ` <4B329FA3.9090904@majjas.com>
2009-12-24 7:01 ` sky2 panic in 2.6.32.1 under load (new oops) Andrew Morton
2009-12-24 19:18 ` Michael Breuer
2009-12-24 22:27 ` Stephen Hemminger
2009-12-25 16:28 ` Michael Breuer
2009-12-25 23:22 ` Stephen Hemminger
2009-12-26 3:23 ` Michael Breuer
2009-12-26 17:57 ` Stephen Hemminger
2009-12-26 20:37 ` Michael Breuer
2009-12-26 22:05 ` [PATCH] sky2: make sure ethernet header is in transmit skb Stephen Hemminger
2009-12-27 3:44 ` David Miller
2009-12-27 4:11 ` David Miller
2010-01-04 5:32 ` David Miller
2010-01-04 16:40 ` Stephen Hemminger
2010-01-04 17:02 ` Michael Breuer
2010-01-05 23:07 ` [PATCH] af_packet: Don't use skb after dev_queue_xmit() Jarek Poplawski
2010-01-05 23:16 ` Michael Breuer
2010-01-05 23:29 ` Jarek Poplawski
2010-01-06 2:36 ` Michael Breuer
2010-01-06 7:22 ` Jarek Poplawski
2010-01-06 9:15 ` [PATCH alt.2] " Jarek Poplawski
2010-01-06 14:49 ` Stephen Hemminger
2010-01-06 19:40 ` Jarek Poplawski
2010-01-06 19:49 ` [PATCH] " Michael Breuer
2010-01-06 20:22 ` Jarek Poplawski [this message]
2010-01-06 20:33 ` Michael Breuer
2010-01-06 21:09 ` Jarek Poplawski
2010-01-06 21:32 ` Michael Breuer
2010-01-06 21:10 ` Stephen Hemminger
2010-01-06 21:20 ` Michael Breuer
2010-01-06 23:26 ` Michael Breuer
2010-01-07 2:42 ` Michael Breuer
2010-01-07 4:00 ` Michael Breuer
2010-01-07 4:53 ` Stephen Hemminger
2010-01-07 5:10 ` Michael Breuer
2010-01-07 5:32 ` Michael Breuer
2010-01-07 5:54 ` Michael Breuer
2010-01-07 7:20 ` Michael Breuer
2010-01-07 7:47 ` Jarek Poplawski
2010-01-07 7:55 ` Michael Breuer
2010-01-07 8:21 ` Jarek Poplawski
2010-01-07 15:03 ` Michael Breuer
2010-01-07 17:56 ` Jarek Poplawski
2010-01-07 18:17 ` Jarek Poplawski
2010-01-07 15:05 ` Michael Breuer
2010-01-07 18:01 ` Jarek Poplawski
2010-01-07 18:19 ` Michael Breuer
2010-01-07 18:35 ` Jarek Poplawski
2010-01-07 18:40 ` Michael Breuer
2010-01-07 18:43 ` Michael Breuer
2010-01-07 18:50 ` Jarek Poplawski
2010-01-07 19:36 ` Jarek Poplawski
2010-01-07 19:55 ` Michael Breuer
2010-01-07 20:22 ` Jarek Poplawski
2010-01-07 23:11 ` Michael Breuer
2010-01-08 7:45 ` Jarek Poplawski
2010-01-08 16:40 ` Michael Breuer
2010-01-08 21:29 ` Jarek Poplawski
2010-01-08 21:48 ` Michael Breuer
2010-01-08 22:02 ` Jarek Poplawski
2010-01-09 4:45 ` Michael Breuer
2010-01-09 5:44 ` Michael Breuer
2010-01-09 12:28 ` Jarek Poplawski
2010-01-09 18:34 ` Michael Breuer
2010-01-13 20:39 ` Michael Breuer
2010-01-13 21:09 ` Jarek Poplawski
2010-01-13 21:16 ` Michael Breuer
2010-01-13 21:34 ` Jarek Poplawski
2010-01-17 16:26 ` Michael Breuer
2010-01-17 22:17 ` Jarek Poplawski
2010-01-17 22:34 ` Michael Breuer
2010-01-17 23:05 ` Jarek Poplawski
2010-01-17 23:15 ` Michael Breuer
2010-01-18 7:30 ` Jarek Poplawski
2010-01-18 16:29 ` Michael Breuer
2010-01-18 20:46 ` Jarek Poplawski
2010-01-18 20:56 ` Michael Breuer
2010-01-18 21:00 ` Stephen Hemminger
2010-01-18 21:06 ` Jarek Poplawski
2010-01-18 21:24 ` Michael Breuer
2010-01-18 21:50 ` Jarek Poplawski
2010-01-18 21:25 ` Jarek Poplawski
2010-01-18 21:39 ` Michael Breuer
2010-01-18 22:08 ` Jarek Poplawski
2010-01-18 22:17 ` Jarek Poplawski
2010-01-18 22:47 ` Michael Breuer
2010-01-19 5:46 ` Michael Breuer
2010-01-19 8:41 ` Jarek Poplawski
2010-01-19 15:28 ` Michael Breuer
2010-01-21 19:48 ` Michael Breuer
2010-01-19 10:47 ` Jarek Poplawski
2010-01-19 15:47 ` Michael Breuer
2010-01-19 19:59 ` Jarek Poplawski
2010-01-19 20:06 ` Michael Breuer
2010-01-19 20:29 ` Jarek Poplawski
2010-01-19 22:45 ` Jarek Poplawski
2010-01-20 1:01 ` Michael Breuer
2010-01-20 1:10 ` Stephen Hemminger
2010-01-21 16:14 ` Stefan Richter
2010-01-21 16:50 ` Stefan Richter
2010-01-18 22:25 ` Michael Breuer
2010-01-18 22:40 ` Jarek Poplawski
2009-12-27 17:03 ` sky2 panic in 2.6.32.1 under load (new oops) Michael Breuer
2009-12-27 18:22 ` Stephen Hemminger
2009-12-27 19:39 ` Michael Breuer
2009-12-29 17:30 ` Stephen Hemminger
2009-12-29 17:39 ` Michael Breuer
2009-12-29 18:38 ` Michael Breuer
2009-12-29 18:54 ` Michael Breuer
2009-12-29 19:49 ` Stephen Hemminger
2009-12-29 20:41 ` Michael Breuer
2009-12-30 7:23 ` Michael Breuer
2009-12-30 7:58 ` Stephen Hemminger
2009-12-30 17:49 ` Michael Breuer
2009-12-30 19:15 ` audit.c skb - tty race condition - was " Michael Breuer
2009-12-30 20:44 ` Michael Breuer
2009-12-30 21:15 ` Michael Breuer
2009-12-30 21:21 ` Michael Breuer
2009-12-30 7:59 ` Stephen Hemminger
2009-12-30 15:40 ` Michael Breuer
2009-12-30 18:10 ` Stephen Hemminger
2009-12-30 18:37 ` Michael Breuer
2009-12-31 18:09 ` Michael Breuer
2009-12-31 18:24 ` Stephen Hemminger
2010-01-01 17:42 ` Michael Breuer
2010-01-01 19:26 ` sky2 panic in 2.6.32.1 under load (tty NULL write) Michael Breuer
2010-01-01 20:34 ` Michael Breuer
2010-01-02 21:42 ` Michael Breuer
2009-12-29 19:15 ` sky2 panic in 2.6.32.1 under load (new oops) Jarek Poplawski
2009-12-29 19:20 ` Michael Breuer
2009-12-30 8:07 ` Stephen Hemminger
2009-12-30 15:36 ` Michael Breuer
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=20100106202212.GB3354@del.dom.local \
--to=jarkao2@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=flyboy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbreuer@majjas.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.org \
/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).