From: John Stultz <john.stultz@linaro•org>
To: Eric Dumazet <eric.dumazet@gmail•com>
Cc: 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>,
Ingo Molnar <mingo@kernel•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: Thu, 26 Sep 2013 12:39:04 -0700 [thread overview]
Message-ID: <52448D58.9060503@linaro.org> (raw)
In-Reply-To: <52448C46.2050107@linaro.org>
On 09/26/2013 12:34 PM, John Stultz wrote:
> On 09/26/2013 12:26 PM, Eric Dumazet 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.
>>
>> static inline void u64_stats_init(struct u64_stats_sync *syncp)
>> {
>> #if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
>> seqcount_init(&syncp->seq);
>> #endif
>> }
> No objection, though I worry that will obscure the lockdep key name,
> causing all the u64_stat_sync locks to appear the same.
>
> I'll give it a quick shot to see if the compiler inlines it well enough
> to preserve the name.
Yea, unfortunately this causes the reports to all look like:
[ 10.370105] Possible unsafe locking scenario:
[ 10.370105]
[ 10.370105] CPU0
[ 10.370105] ----
[ 10.370105] lock(&syncp->seq#5);
[ 10.370105] <Interrupt>
[ 10.370105] lock(&syncp->seq#5);
[ 10.370105]
[ 10.370105] *** DEADLOCK ***
Rather then:
[ 12.150105] Possible unsafe locking scenario:
[ 12.150105]
[ 12.150105] CPU0
[ 12.150105] ----
[ 12.150105] lock(&af_inet6_stats->syncp.seq);
[ 12.150105] <Interrupt>
[ 12.150105] lock(&af_inet6_stats->syncp.seq);
[ 12.150105]
[ 12.150105] *** DEADLOCK ***
So I suspect using the macro is the best approach here. Is that ok?
thanks
-john
next prev parent reply other threads:[~2013-09-26 19:39 UTC|newest]
Thread overview: 11+ 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 [this message]
2013-09-26 19:46 ` Eric Dumazet
2013-09-27 5:44 ` Ingo Molnar
2013-09-27 9:15 ` Eric Dumazet
[not found] <1381186321-4906-1-git-send-email-john.stultz@linaro.org>
2013-10-07 22:51 ` John Stultz
2013-10-23 18:23 ` John Stultz
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=52448D58.9060503@linaro.org \
--to=john.stultz@linaro$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=eric.dumazet@gmail$(echo .)com \
--cc=horms@verge$(echo .)net.au \
--cc=ja@ssi$(echo .)bg \
--cc=jesse@nicira$(echo .)com \
--cc=jmorris@namei$(echo .)org \
--cc=kaber@trash$(echo .)net \
--cc=kuznet@ms2$(echo .)inr.ac.ru \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=mathieu.desnoyers@efficios$(echo .)com \
--cc=mingo@kernel$(echo .)org \
--cc=mlindner@marvell$(echo .)com \
--cc=mst@redhat$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=netfilter-devel@vger$(echo .)kernel.org \
--cc=peterz@infradead$(echo .)org \
--cc=rl@hellgate$(echo .)ch \
--cc=rostedt@goodmis$(echo .)org \
--cc=rusty@rustcorp$(echo .)com.au \
--cc=stephen@networkplumber$(echo .)org \
--cc=tglx@linutronix$(echo .)de \
--cc=thomas.petazzoni@free-electrons$(echo .)com \
--cc=wensong@linux-vs$(echo .)org \
--cc=yoshfuji@linux-ipv6$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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