From: David Miller <davem@davemloft.net>
To: shemminger@linux-foundation.org
Cc: satyam@infradead.org, netdev@vger.kernel.org
Subject: Re: [PATCH 05/11] netpoll: dont need rx_flags
Date: Mon, 19 Nov 2007 19:39:28 -0800 (PST) [thread overview]
Message-ID: <20071119.193928.167909754.davem@davemloft.net> (raw)
In-Reply-To: <20071103184338.692312004@linux-foundation.org>
From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Sat, 03 Nov 2007 11:43:19 -0700
> The rx_flags variable is redundant. Turning rx on/off is done
> via setting the rx_np pointer.
>
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Not all of these transformations are equivalent, and as a result
you're adding a bug.
> @@ -51,12 +50,11 @@ static inline int netpoll_rx(struct sk_b
> unsigned long flags;
> int ret = 0;
>
> - if (!npinfo || (!npinfo->rx_np && !npinfo->rx_flags))
> + if (!npinfo || !npinfo->rx_np)
> return 0;
>
> spin_lock_irqsave(&npinfo->rx_lock, flags);
> - /* check rx_flags again with the lock held */
> - if (npinfo->rx_flags && __netpoll_rx(skb))
> + if (__netpoll_rx(skb))
> ret = 1;
> spin_unlock_irqrestore(&npinfo->rx_lock, flags);
If you're using ->rx_np == NULL as your new guard, you have
to duplicate that test inside of holding the lock.
->rx_np goes to NULL under the lock, but in the previous code if
the rx_flags is set we know that ->rx_np is also NULL, that's
why it was OK to only recheck ->rx_flags in the lock and not
->rx_np as well.
Therefore we have to replace the test on ->rx_flags with ->rx_np in
all spots to retain correct semantics.
I've made this correction to your patch and applied it to net-2.6.25
Thanks.
next prev parent reply other threads:[~2007-11-20 3:39 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-03 18:43 [PATCH 00/11] netpoll cleanups Stephen Hemminger
2007-11-03 18:43 ` [PATCH 01/11] netpoll: use skb_queue_purge Stephen Hemminger
2007-11-20 3:15 ` David Miller
2007-11-03 18:43 ` [PATCH 02/11] netpoll: netpoll_poll cleanup Stephen Hemminger
2007-11-20 3:21 ` David Miller
2007-11-03 18:43 ` [PATCH 03/11] netpoll: no need to store local_mac Stephen Hemminger
2007-11-20 3:23 ` David Miller
2007-11-03 18:43 ` [PATCH 04/11] netpoll: alternative implementation of dropping Stephen Hemminger
2007-11-20 3:25 ` David Miller
2007-11-03 18:43 ` [PATCH 05/11] netpoll: dont need rx_flags Stephen Hemminger
2007-11-20 3:39 ` David Miller [this message]
2007-11-03 18:43 ` [PATCH 06/11] netpoll: remove dev_name for npinfo Stephen Hemminger
2007-11-20 3:47 ` David Miller
2007-11-20 4:07 ` Stephen Hemminger
2007-11-03 18:43 ` [PATCH 07/11] netpoll: get rid of name parameter Stephen Hemminger
2007-11-20 3:49 ` David Miller
2007-11-03 18:43 ` [PATCH 08/11] netpoll: NETPOLL_TRAP configuration change Stephen Hemminger
2007-11-20 3:52 ` David Miller
2007-11-03 18:43 ` [PATCH 09/11] netpoll: ethernet devices only Stephen Hemminger
2007-11-20 3:55 ` David Miller
2007-11-20 4:14 ` Stephen Hemminger
2007-11-03 18:43 ` [PATCH 10/11] netpoll: rx optimization Stephen Hemminger
2007-11-20 4:00 ` David Miller
2007-11-03 18:43 ` [PATCH 11/11] netpoll: rx use RCU Stephen Hemminger
2007-11-20 4:00 ` David Miller
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=20071119.193928.167909754.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=satyam@infradead.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).