From: Jeff Garzik <jgarzik@pobox.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: David Miller <davem@davemloft.net>,
linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
shemminger@linux-foundation.org
Subject: Re: [patch] forcedeth: fix the NAPI poll function
Date: Tue, 16 Oct 2007 17:20:50 -0400 [thread overview]
Message-ID: <47152B32.9020905@pobox.com> (raw)
In-Reply-To: <20071015223009.GA27425@elte.hu>
[-- Attachment #1: Type: text/plain, Size: 4127 bytes --]
Ingo Molnar wrote:
> * Ingo Molnar <mingo@elte.hu> wrote:
>
>>> but this one should be inactive (not plugged into the network).
>>> Should i try to get a debug print out of the actual 'weight' and
>>> 'work' integers, and of the n->poll function address?
>> ok, i've added such a patch.
>>
>> looking at the dev.c code - can napi_struct->weight be zero
>> legitimately? If yes then the 0 gets passed to the driver and the
>> driver would return 1 - violating the assertion.
>
> update:
>
> [ 186.635916] WARNING: at net/core/dev.c:2166 net_rx_action()
> [ 186.641351] [<c060d9f5>] net_rx_action+0x145/0x1b0
> [ 186.646191] [<c011d752>] __do_softirq+0x42/0x90
> [ 186.650784] [<c011d7c6>] do_softirq+0x26/0x30
> [ 186.655202] [<c011db48>] local_bh_enable+0x48/0xa0
> [ 186.660055] [<c06023e0>] lock_sock_nested+0xa0/0xc0
> [ 186.664995] [<c065da16>] tcp_recvmsg+0x16/0xbc0
> [ 186.669588] [<c013e94b>] __generic_file_aio_write_nolock+0x27b/0x520
> [ 186.676001] [<c0601d75>] sock_common_recvmsg+0x45/0x70
> [ 186.681202] [<c05ff5df>] sock_aio_read+0x11f/0x140
> [ 186.686054] [<c015c086>] do_sync_read+0xc6/0x110
> [ 186.690735] [<c012b9b0>] autoremove_wake_function+0x0/0x40
> [ 186.696280] [<c060dcfc>] net_tx_action+0x3c/0xe0
> [ 186.700961] [<c015c9c2>] vfs_read+0x132/0x140
> [ 186.705378] [<c015cd41>] sys_read+0x41/0x70
> [ 186.709625] [<c0102b66>] sysenter_past_esp+0x5f/0x89
> [ 186.714651] =======================
> [ 186.718210] work: 65, weight: 64
> [ 186.721414] ->poll: (nv_napi_poll+0x0/0x760)
>
> so nv_napi_poll() returned with 65. How is that possible? Ah ...:
>
> (rx_processed_cnt++ < limit)) {
>
> that should be:
>
> (++rx_processed_cnt < limit)) {
>
> right? Find the fix below.
>
> Ingo
>
> -------------------->
> Subject: forcedeth: fix the NAPI poll function
> From: Ingo Molnar <mingo@elte.hu>
>
> fix the forcedeth NAPI poll function to not emit this warning:
>
> [ 186.635916] WARNING: at net/core/dev.c:2166 net_rx_action()
> [ 186.641351] [<c060d9f5>] net_rx_action+0x145/0x1b0
> [ 186.646191] [<c011d752>] __do_softirq+0x42/0x90
> [ 186.650784] [<c011d7c6>] do_softirq+0x26/0x30
> [ 186.655202] [<c011db48>] local_bh_enable+0x48/0xa0
> [ 186.660055] [<c06023e0>] lock_sock_nested+0xa0/0xc0
> [ 186.664995] [<c065da16>] tcp_recvmsg+0x16/0xbc0
> [ 186.669588] [<c013e94b>] __generic_file_aio_write_nolock+0x27b/0x520
> [ 186.676001] [<c0601d75>] sock_common_recvmsg+0x45/0x70
> [ 186.681202] [<c05ff5df>] sock_aio_read+0x11f/0x140
> [ 186.686054] [<c015c086>] do_sync_read+0xc6/0x110
> [ 186.690735] [<c012b9b0>] autoremove_wake_function+0x0/0x40
> [ 186.696280] [<c060dcfc>] net_tx_action+0x3c/0xe0
> [ 186.700961] [<c015c9c2>] vfs_read+0x132/0x140
> [ 186.705378] [<c015cd41>] sys_read+0x41/0x70
> [ 186.709625] [<c0102b66>] sysenter_past_esp+0x5f/0x89
> [ 186.714651] =======================
>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> ---
> drivers/net/forcedeth.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux/drivers/net/forcedeth.c
> ===================================================================
> --- linux.orig/drivers/net/forcedeth.c
> +++ linux/drivers/net/forcedeth.c
> @@ -2274,7 +2274,7 @@ static int nv_rx_process(struct net_devi
>
> while((np->get_rx.orig != np->put_rx.orig) &&
> !((flags = le32_to_cpu(np->get_rx.orig->flaglen)) & NV_RX_AVAIL) &&
> - (rx_processed_cnt++ < limit)) {
> + (++rx_processed_cnt < limit)) {
>
> dprintk(KERN_DEBUG "%s: nv_rx_process: flags 0x%x.\n",
> dev->name, flags);
> @@ -2412,7 +2412,7 @@ static int nv_rx_process_optimized(struc
>
> while((np->get_rx.ex != np->put_rx.ex) &&
> !((flags = le32_to_cpu(np->get_rx.ex->flaglen)) & NV_RX2_AVAIL) &&
> - (rx_processed_cnt++ < limit)) {
> + (++rx_processed_cnt < limit)) {
Would the attached patch be ok with people?
It's basically the same thing, except that it aligns a bit more closely
with forcedeth rework stuff I'm doing.
I'll send upstream today unless people scream...
Jeff
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 955 bytes --]
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index dae30b7..2e70815 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -2268,13 +2268,13 @@ static int nv_rx_process(struct net_device *dev, int limit)
{
struct fe_priv *np = netdev_priv(dev);
u32 flags;
- u32 rx_processed_cnt = 0;
+ int rx_work = 0;
struct sk_buff *skb;
int len;
while((np->get_rx.orig != np->put_rx.orig) &&
!((flags = le32_to_cpu(np->get_rx.orig->flaglen)) & NV_RX_AVAIL) &&
- (rx_processed_cnt++ < limit)) {
+ (rx_work < limit)) {
dprintk(KERN_DEBUG "%s: nv_rx_process: flags 0x%x.\n",
dev->name, flags);
@@ -2396,9 +2396,11 @@ next_pkt:
np->get_rx.orig = np->first_rx.orig;
if (unlikely(np->get_rx_ctx++ == np->last_rx_ctx))
np->get_rx_ctx = np->first_rx_ctx;
+
+ rx_work++;
}
- return rx_processed_cnt;
+ return rx_work;
}
static int nv_rx_process_optimized(struct net_device *dev, int limit)
next prev parent reply other threads:[~2007-10-16 21:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-15 11:24 WARNING: at net/core/dev.c:2161 net_rx_action() Ingo Molnar
2007-10-15 11:27 ` Ingo Molnar
2007-10-15 16:18 ` Ingo Molnar
2007-10-15 19:57 ` David Miller
2007-10-15 22:03 ` Ingo Molnar
2007-10-15 22:07 ` Ingo Molnar
2007-10-15 22:21 ` David Miller
2007-10-15 22:30 ` [patch] forcedeth: fix the NAPI poll function Ingo Molnar
2007-10-15 22:39 ` David Miller
2007-10-15 22:40 ` Jeff Garzik
2007-10-15 22:41 ` Jeff Garzik
2007-10-16 5:42 ` Ingo Molnar
2007-10-16 5:47 ` Jeff Garzik
2007-10-16 6:40 ` Ingo Molnar
2007-10-16 7:17 ` Jeff Garzik
2007-10-16 7:49 ` Ingo Molnar
2007-10-16 16:52 ` Jeff Garzik
2007-10-16 21:20 ` Jeff Garzik [this message]
2007-10-17 7:25 ` Ingo Molnar
2007-10-17 10:18 ` [patch] forcedeth: fix the NAPI poll function, take #2 Ingo Molnar
2007-10-18 0:21 ` Jeff Garzik
2007-10-15 22:18 ` WARNING: at net/core/dev.c:2161 net_rx_action() David Miller
2007-10-15 22:20 ` Jeff Garzik
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=47152B32.9020905@pobox.com \
--to=jgarzik@pobox.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=shemminger@linux-foundation.org \
--cc=torvalds@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.