From: Florian Westphal <fw@strlen.de>
To: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 08/10] netfilter: ipset: Introduce RCU in all set types instead of rwlock per set
Date: Wed, 26 Nov 2014 16:41:13 +0100 [thread overview]
Message-ID: <20141126154113.GD24801@breakpoint.cc> (raw)
In-Reply-To: <alpine.DEB.2.10.1411261538080.9422@blackhole.kfki.hu>
Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> wrote:
> On Wed, 26 Nov 2014, Pablo Neira Ayuso wrote:
>
> > > diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
> > > index f1606fa..418d360 100644
> > > --- a/include/linux/netfilter/ipset/ip_set.h
> > > +++ b/include/linux/netfilter/ipset/ip_set.h
> > > @@ -113,10 +113,10 @@ struct ip_set_comment {
> > > };
> > >
> > > struct ip_set_skbinfo {
> > > - u32 skbmark;
> > > - u32 skbmarkmask;
> > > - u32 skbprio;
> > > - u16 skbqueue;
> > > + u32 __rcu skbmark;
> > > + u32 __rcu skbmarkmask;
> > > + u32 __rcu skbprio;
> > > + u16 __rcu skbqueue;
> > > };
This looks weird...
What is rcu protecting here?
> > > +#define IP_SET_RCU_ASSIGN(ptr, value) \
> > > +do { \
> > > + smp_wmb(); \
Whats this barrier for?
> > > + *(ptr) = value; \
> > > +} while (0)
> > > +static inline void
> > > +ip_set_rcu_assign_ulong(unsigned long *v, unsigned long value)
> > > +{
> > > + IP_SET_RCU_ASSIGN(v, value);
> > > +}
> > > +
> > > +static inline void
> > > +ip_set_rcu_assign_u32(u32 *v, u32 value)
> > > +{
> > > + IP_SET_RCU_ASSIGN(v, value);
> > > +}
> > > +
> > > +static inline void
> > > +ip_set_rcu_assign_u16(u16 *v, u16 value)
> > > +{
> > > + IP_SET_RCU_ASSIGN(v, value);
> > > +}
> > > +
> > > +static inline void
> > > +ip_set_rcu_assign_u8(u8 *v, u8 value)
> > > +{
> > > + IP_SET_RCU_ASSIGN(v, value);
> > > +}
These macros look dodgy... Why are they needed?
> - elem extensions: the manipulations of the extensions are
> either atomic operations or integer settings. The inline functions
> above provide those RCU safe integer settings: they are the same
> as rcu_assign_pointer(), but that one can be used for pointers only.
Yes, because it doesn't make sense to me to have something NOT for
pointers.
rcu_assign_pointer() is there to make sure that when you "publish" the
memory whose address is given, all the content is visible to all the
cpus, this is also why it has the barrier.
I don't see why you'd need a special function otherwise, unless you
want some explicit documentation as to where you're changing/updating
content of structures protected by rcu. But, in those sections you
already need to hold some type of lock, so I don't think its needed.
Cheers,
Florian
next prev parent reply other threads:[~2014-11-26 15:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-24 20:46 [PATCH 00/10] ipset patches for nf-next Jozsef Kadlecsik
2014-11-24 20:46 ` [PATCH 01/10] netfilter: ipset: Support updating extensions when the set is full Jozsef Kadlecsik
2014-11-24 20:46 ` [PATCH 02/10] netfilter: ipset: Alignment problem between 64bit kernel 32bit userspace Jozsef Kadlecsik
2014-11-24 20:46 ` [PATCH 03/10] netfilter: ipset: Indicate when /0 networks are supported Jozsef Kadlecsik
2014-11-24 20:46 ` [PATCH 04/10] netfilter: ipset: Simplify cidr handling for hash:*net* types Jozsef Kadlecsik
2014-11-24 20:46 ` [PATCH 05/10] netfilter: ipset: Allocate the proper size of memory when /0 networks are supported Jozsef Kadlecsik
2014-11-24 20:46 ` [PATCH 06/10] netfilter: ipset: Explicitly add padding elements to hash:net,net and hash:net,port,net Jozsef Kadlecsik
2014-11-24 20:46 ` [PATCH 07/10] netfilter: ipset: Remove rbtree from hash:net,iface in order to run under RCU Jozsef Kadlecsik
2014-11-24 20:46 ` [PATCH 08/10] netfilter: ipset: Introduce RCU in all set types instead of rwlock per set Jozsef Kadlecsik
2014-11-26 13:14 ` Pablo Neira Ayuso
2014-11-26 14:58 ` Jozsef Kadlecsik
2014-11-26 15:41 ` Florian Westphal [this message]
2014-11-26 16:01 ` Jozsef Kadlecsik
2014-11-26 17:18 ` Pablo Neira Ayuso
2014-11-27 8:23 ` Jozsef Kadlecsik
2014-11-24 20:46 ` [PATCH 09/10] netfilter: ipset: styles warned by checkpatch.pl fixed Jozsef Kadlecsik
2014-11-24 20:46 ` [PATCH 10/10] netfilter: ipset: Fix parallel resizing and listing of the same set Jozsef Kadlecsik
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=20141126154113.GD24801@breakpoint.cc \
--to=fw@strlen.de \
--cc=kadlec@blackhole.kfki.hu \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).