From: Ingo Molnar <mingo@kernel.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: John Stultz <john.stultz@linaro.org>,
LKML <linux-kernel@vger.kernel.org>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Mirko Lindner <mlindner@marvell.com>,
Stephen Hemminger <stephen@networkplumber.org>,
Roger Luethi <rl@hellgate.ch>, Patrick McHardy <kaber@trash.net>,
Rusty Russell <rusty@rustcorp.com.au>,
"Michael S. Tsirkin" <mst@redhat.com>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
James Morris <jmorris@namei.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Wensong Zhang <wensong@linux-vs.org>,
Simon Horman <horms@verge.net.au>, Julian Anastasov <ja@ssi.bg>,
Jesse Gross <jesse@nicira.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Steven Rostedt <rostedt@goodmis.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, netfilter-devel@vger.kernel.
Subject: Re: [PATCH 1/4] [RFC] net: Explicitly initialize u64_stats_sync structures for lockdep
Date: Fri, 27 Sep 2013 07:44:55 +0200 [thread overview]
Message-ID: <20130927054455.GA6597@gmail.com> (raw)
In-Reply-To: <1380223585.3165.205.camel@edumazet-glaptop>
* Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2013-09-26 at 11:34 -0700, John Stultz wrote:
> > In order to enable lockdep on seqcount/seqlock structures, we
> > must explicitly initialize any locks.
> >
>
> > diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
> > index 8da8c4e..c450e11 100644
> > --- a/include/linux/u64_stats_sync.h
> > +++ b/include/linux/u64_stats_sync.h
> > @@ -67,6 +67,13 @@ struct u64_stats_sync {
> > #endif
> > };
> >
> > +
> > +#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
> > +#define u64_stats_init(syncp) seqcount_init(syncp.seq)
> > +#else
> > +#define u64_stats_init(syncp)
> > +#endif
> > +
>
> I would prefer a function.
C cannot pass along symbolic names, unfortunately, so we are stuck with
1970's tech and the C preprocessor.
There's a way to make such macros look a tiny bit more structured and thus
be more palatable:
#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
# define u64_stats_init(syncp) seqcount_init(syncp.seq)
#else
# define u64_stats_init(syncp)
#endif
Note, the 'else' branch should probably be:
# define u64_stats_init(syncp) do { } while (0)
Thanks,
Ingo
WARNING: multiple messages have this Message-ID (diff)
From: Ingo Molnar <mingo@kernel.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: John Stultz <john.stultz@linaro.org>,
LKML <linux-kernel@vger.kernel.org>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Mirko Lindner <mlindner@marvell.com>,
Stephen Hemminger <stephen@networkplumber.org>,
Roger Luethi <rl@hellgate.ch>, Patrick McHardy <kaber@trash.net>,
Rusty Russell <rusty@rustcorp.com.au>,
"Michael S. Tsirkin" <mst@redhat.com>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
James Morris <jmorris@namei.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Wensong Zhang <wensong@linux-vs.org>,
Simon Horman <horms@verge.net.au>, Julian Anastasov <ja@ssi.bg>,
Jesse Gross <jesse@nicira.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Steven Rostedt <rostedt@goodmis.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 1/4] [RFC] net: Explicitly initialize u64_stats_sync structures for lockdep
Date: Fri, 27 Sep 2013 07:44:55 +0200 [thread overview]
Message-ID: <20130927054455.GA6597@gmail.com> (raw)
In-Reply-To: <1380223585.3165.205.camel@edumazet-glaptop>
* Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2013-09-26 at 11:34 -0700, John Stultz wrote:
> > In order to enable lockdep on seqcount/seqlock structures, we
> > must explicitly initialize any locks.
> >
>
> > diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
> > index 8da8c4e..c450e11 100644
> > --- a/include/linux/u64_stats_sync.h
> > +++ b/include/linux/u64_stats_sync.h
> > @@ -67,6 +67,13 @@ struct u64_stats_sync {
> > #endif
> > };
> >
> > +
> > +#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
> > +#define u64_stats_init(syncp) seqcount_init(syncp.seq)
> > +#else
> > +#define u64_stats_init(syncp)
> > +#endif
> > +
>
> I would prefer a function.
C cannot pass along symbolic names, unfortunately, so we are stuck with
1970's tech and the C preprocessor.
There's a way to make such macros look a tiny bit more structured and thus
be more palatable:
#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
# define u64_stats_init(syncp) seqcount_init(syncp.seq)
#else
# define u64_stats_init(syncp)
#endif
Note, the 'else' branch should probably be:
# define u64_stats_init(syncp) do { } while (0)
Thanks,
Ingo
next prev parent reply other threads:[~2013-09-27 5:44 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-26 18:34 [PATCH 0/4][RFC] Lockdep enablement for seqcount/seqlocks John Stultz
2013-09-26 18:34 ` [PATCH 1/4] [RFC] net: Explicitly initialize u64_stats_sync structures for lockdep John Stultz
2013-09-26 19:26 ` Eric Dumazet
2013-09-26 19:34 ` John Stultz
2013-09-26 19:39 ` John Stultz
2013-09-26 19:46 ` Eric Dumazet
2013-09-27 5:44 ` Ingo Molnar [this message]
2013-09-27 5:44 ` Ingo Molnar
2013-09-27 9:15 ` Eric Dumazet
2013-09-27 9:15 ` Eric Dumazet
2013-09-26 18:34 ` [PATCH 2/4] [RFC] seqcount: Add lockdep functionality to seqcount/seqlock structures John Stultz
2013-09-26 20:46 ` Steven Rostedt
2013-09-26 20:59 ` John Stultz
2013-09-26 18:34 ` [PATCH 3/4] [RFC] cpuset: Fix potential deadlock w/ set_mems_allowed John Stultz
2013-09-26 18:34 ` [PATCH 4/4] [RFC] ipv6: Fix for possible ipv6 seqlock deadlock John Stultz
2013-09-26 19:30 ` Eric Dumazet
2013-09-26 19:46 ` John Stultz
2013-09-27 5:47 ` Ingo Molnar
2013-09-27 16:00 ` John Stultz
2013-09-27 17:51 ` Eric Dumazet
-- strict thread matches above, loose matches on Subject: below --
2013-10-07 22:51 [PATCH 0/4] Lockdep enablement for seqcount/seqlocks (v2) John Stultz
2013-10-07 22:51 ` [PATCH 1/4] [RFC] net: Explicitly initialize u64_stats_sync structures for lockdep John Stultz
2013-10-07 22:51 ` John Stultz
2013-10-23 18:23 ` John Stultz
2013-10-23 19:37 ` Julian Anastasov
2013-10-23 19:37 ` Julian Anastasov
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=20130927054455.GA6597@gmail.com \
--to=mingo@kernel.org \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=horms@verge.net.au \
--cc=ja@ssi.bg \
--cc=jesse@nicira.com \
--cc=jmorris@namei.org \
--cc=john.stultz@linaro.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mlindner@marvell.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel. \
--cc=peterz@infradead.org \
--cc=rl@hellgate.ch \
--cc=rostedt@goodmis.org \
--cc=rusty@rustcorp.com.au \
--cc=stephen@networkplumber.org \
--cc=tglx@linutronix.de \
--cc=thomas.petazzoni@free-electrons.com \
--cc=wensong@linux-vs.org \
--cc=yoshfuji@linux-ipv6.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.