From: David Miller <davem@davemloft.net>
To: jarkao2@gmail.com
Cc: jeff@garzik.org, mingo@elte.hu, johannes@sipsolutions.net,
wferi@niif.hu, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] netconsole: Disable softirqs in write_msg()
Date: Wed, 19 Nov 2008 02:10:45 -0800 (PST) [thread overview]
Message-ID: <20081119.021045.222679286.davem@davemloft.net> (raw)
In-Reply-To: <20081119084106.GA6699@ff.dom.local>
From: Jarek Poplawski <jarkao2@gmail.com>
Date: Wed, 19 Nov 2008 08:41:06 +0000
> This report: http://marc.info/?l=linux-netdev&m=122599341430090&w=2
> shows local_bh_enable() is used in the wrong context (irqs disabled).
> It happens when a usual network path is called by netconsole, which
> simply turns off hardirqs around this all.
This backtrace call path is anything but "usual".
There is a UDP send, and a local_bh_enable() done there triggers
softirqs, which processes device (I would guess loopback, or
some non-NAPI device) backlog processing.
This triggers an input netfilter ipt_LOG rule, which triggers a
printk over netconsole.
netpoll finds the TX queue of the tg3 device (which is NAPI)
full, so it invokes ->poll() to try and free up some TX queue
space.
This in turn triggers a packet receive, which hits bridging netfilter,
which does a conntrack lookup, which does the BH disable/enable which
triggers the warning.
I mean, this is just a very crazy trace :-)
I see an easy way around this. We should just punt on non-netpoll
RX packets that try to get processed during a netconsole ->poll()
run.
Wait a second, this is _supposed_ to be already happening. Perhaps
the tests in netpoll_rx() are screwed up.
net/core/netpoll.c'd poll_one_napi() explicitly sets NETPOLL_RX_DROP
in npinfo->rx_flags as well as increment "trapped", and that is
supposed to make netpoll_rx() return non-zero which tells the caller
to ignore and drop all RX packets.
What isn't that happening?
netpoll_rx()'s test is:
if (!npinfo || (!npinfo->rx_np && !npinfo->rx_flags))
return 0;
which looks perfectly fine. npinfo will be non-NULL by definition
because we are doing netpoll for netconsole on this device, and
->rx_flags are non-zero by the above mentioned code.
So we get to __netpoll_rx() by the next bit of code.
if (npinfo->rx_flags && __netpoll_rx(skb))
ret = 1;
And __netpoll_rx() says:
struct netpoll *np = npi->rx_np;
if (!np)
goto out;
this should trigger because a netpoll RX agent shouldn't be attached,
then:
out:
if (atomic_read(&trapped)) {
kfree_skb(skb);
return 1;
}
return 0;
which should trigger because trapped is non-zero, thus we free the SKB
and return 1.
We need to figure out why this isn't working properly. Maybe it's some
bug we fixed, or some weird change in the SUSE Xen mods this used has
applied.
I also took a quick look at 2.6.26.6 and I don't see any bugs in this
area there.
next prev parent reply other threads:[~2008-11-19 10:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-06 17:40 two warns on slowpath Ferenc Wagner
2008-11-17 13:35 ` [PATCH] softirq: Use local_irq_save() in local_bh_enable() Jarek Poplawski
2008-11-17 14:18 ` Johannes Berg
2008-11-18 7:49 ` Jarek Poplawski
2008-11-17 16:16 ` Ingo Molnar
2008-11-18 7:38 ` Jarek Poplawski
2008-11-19 8:41 ` [PATCH] netconsole: Disable softirqs in write_msg() Jarek Poplawski
2008-11-19 9:30 ` Ingo Molnar
2008-11-19 9:42 ` David Miller
2008-11-19 10:14 ` Ingo Molnar
2008-11-19 10:17 ` David Miller
2008-11-19 10:21 ` Ingo Molnar
2008-11-19 10:22 ` David Miller
2008-11-19 10:10 ` David Miller [this message]
2008-11-19 8:41 ` [PATCH] softirq: Fix warnings triggered by netconsole Jarek Poplawski
2008-11-19 9:32 ` Ingo Molnar
2008-11-19 11:07 ` Jarek Poplawski
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=20081119.021045.222679286.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=jarkao2@gmail.com \
--cc=jeff@garzik.org \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=netdev@vger.kernel.org \
--cc=wferi@niif.hu \
/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).