From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: Eric Dumazet <dada1@cosmosbay.com>,
netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH] dropmon: add ability to detect when hardware dropsrxpackets
Date: Wed, 13 May 2009 18:03:59 -0700 [thread overview]
Message-ID: <20090514010359.GL6752@linux.vnet.ibm.com> (raw)
In-Reply-To: <20090514004548.GA14428@localhost.localdomain>
On Wed, May 13, 2009 at 08:45:48PM -0400, Neil Horman wrote:
> On Wed, May 13, 2009 at 11:23:54AM -0700, Paul E. McKenney wrote:
> > On Tue, May 12, 2009 at 12:30:44PM -0400, Neil Horman wrote:
> > > On Sat, May 09, 2009 at 08:30:35AM +0200, Eric Dumazet wrote:
> > > >
> > > > I dont fully understand your patch, but at least have some questions
> > > > about rcu stuff.
> > > >
> > >
> > >
> > > Ok, so I went back and I think I managed to better understand the RCU interface.
> > > New patch attached, works the same way, saving for the gross previous misuse of
> > > rcu.
> > >
> > >
> > > Patch to add the ability to detect drops in hardware interfaces via dropwatch.
> > > Adds a tracepoint to net_rx_action to signal everytime a napi instance is
> > > polled. The dropmon code then periodically checks to see if the rx_frames
> > > counter has changed, and if so, adds a drop notification to the netlink
> > > protocol, using the reserved all-0's vector to indicate the drop location was in
> > > hardware, rather than somewhere in the code.
> >
> > One concern shown below.
> >
> <snip>
> > tracepoint_synchronize_unregister();
> > > +
> > > + /*
> > > + * Clean the device list
> > > + */
> > > + list_for_each_entry_rcu(new_stat, &hw_stats_list, list) {
> > > + if (new_stat->dev == NULL) {
> > > + list_del_rcu(&new_stat->list);
> > > + call_rcu(&new_stat->rcu, free_dm_hw_stat);
> >
> > Much better! ;-)
> >
> Thanks! :)
> <snip>
>
> > > +
> > > + switch (event) {
> > > + case NETDEV_REGISTER:
> > > + new_stat = kzalloc(sizeof(struct dm_hw_stat_delta), GFP_KERNEL);
> > > +
> > > + if (!new_stat)
> > > + goto out;
> > > +
> > > + new_stat->dev = dev;
> > > + INIT_RCU_HEAD(&new_stat->rcu);
> > > + list_add_rcu(&new_stat->list, &hw_stats_list);
> >
> > Don't we need to be holding trace_state_lock at this point? Otherwise,
> > can't we mangle the list with a concurrent list_add_rcu() and
> > list_del_rcu()?
> >
> I thought the purpose of list_add_rcu and list_del_rcu was to be
> able to modify lists without needing to hold additional locks. Or am
> I missing something else about the nuance of how RCU works?
The purpose of list_add_rcu() and list_del_rcu() is to be able to permit
concurrent readers to traverse the list while you are modifying that same
list. You still need something to handle concurrent updates to the list.
The usual approach is to use locks, in this case, to hold trace_state_lock
across the addition, given that it is already held across the removal.
The reason that I expect holding the lock to be OK is that you cannot
add elements faster than you delete them long-term, so given that you
are willing to hold the lock over deletions, you are probably OK also
holding that same lock over additions. But please let me know if that
is not the case!
Thanx, Paul
next prev parent reply other threads:[~2009-05-14 1:04 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-08 19:50 [PATCH] dropmon: add ability to detect when hardware drops rx packets Neil Horman
2009-05-09 6:30 ` Eric Dumazet
2009-05-09 18:07 ` Neil Horman
2009-05-12 16:30 ` Neil Horman
2009-05-13 18:23 ` [PATCH] dropmon: add ability to detect when hardware drops rxpackets Paul E. McKenney
2009-05-14 0:45 ` Neil Horman
2009-05-14 1:03 ` Paul E. McKenney [this message]
2009-05-14 12:33 ` [PATCH] dropmon: add ability to detect when hardware dropsrxpackets Neil Horman
2009-05-14 12:44 ` Jiri Pirko
2009-05-14 16:17 ` [PATCH] dropmon: add ability to detect when hardwaredropsrxpackets Paul E. McKenney
2009-05-14 17:29 ` [PATCH] dropmon: add ability to detect when hardware dropsrxpackets Neil Horman
2009-05-15 5:49 ` Jarek Poplawski
2009-05-15 11:01 ` Neil Horman
2009-05-15 11:12 ` Jarek Poplawski
2009-05-15 11:15 ` Neil Horman
2009-05-15 11:40 ` Jarek Poplawski
2009-05-16 0:07 ` Paul E. McKenney
2009-05-15 6:51 ` Jiri Pirko
2009-05-15 7:37 ` Eric Dumazet
2009-05-15 11:12 ` Neil Horman
2009-05-15 10:59 ` Neil Horman
2009-05-15 11:27 ` Jiri Pirko
2009-05-15 16:07 ` Neil Horman
2009-05-15 18:11 ` Eric Dumazet
2009-05-15 18:23 ` Stephen Hemminger
2009-05-15 19:53 ` Neil Horman
2009-05-15 19:23 ` Neil Horman
2009-05-16 12:40 ` Neil Horman
2009-05-18 14:46 ` Neil Horman
2009-05-21 7:17 ` David Miller
2009-05-21 17:36 ` Neil Horman
2009-05-21 22:15 ` David Miller
2009-05-22 0:09 ` Neil Horman
2009-05-15 18:18 ` Stephen Hemminger
2009-05-15 19:12 ` Neil Horman
2009-05-14 16:18 ` [PATCH] dropmon: add ability to detect when hardwaredropsrxpackets Paul E. McKenney
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=20090514010359.GL6752@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=dada1@cosmosbay.com \
--cc=davem@davemloft.net \
--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;
as well as URLs for NNTP newsgroup(s).