* [PATCH] Revert lockdep check in raw_seqcount_begin
@ 2014-06-05 15:31 Trond Myklebust
2014-06-06 14:07 ` Peter Zijlstra
2014-06-11 18:39 ` John Stultz
0 siblings, 2 replies; 4+ messages in thread
From: Trond Myklebust @ 2014-06-05 15:31 UTC (permalink / raw)
To: Peter Zijlstra
Cc: linux-kernel, John Stultz, Ingo Molnar, David S. Miller, Al Viro
This commit reverts the addition of lockdep checking to raw_seqcount_begin
for the following reasons:
1) It violates the naming convention that raw_* functions should not
do lockdep checks (a convention that is also followed by the other
raw_*_seqcount_begin functions).
2) raw_seqcount_begin does not spin, so it can only be part of an ABBA
deadlock in very special circumstances (for instance if a lock
is held across the entire raw_seqcount_begin()+read_seqcount_retry()
loop while also being taken inside the write_seqcount protected area).
3) It is causing false positives with some existing callers, and there
is no non-lockdep alternative for those callers to use.
None of the three existing callers (__d_lookup_rcu, netdev_get_name, and
the NFS state code) appear to use the function in a manner that is ABBA
deadlock prone.
Fixes: 1ca7d67cf5d5: seqcount: Add lockdep functionality to seqcount/seqlock
Cc: John Stultz <john.stultz@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Link: http://lkml.kernel.org/r/CAHQdGtRR6SvEhXiqWo24hoUh9AU9cL82Z8Z-d8-7u951F_d+5g@mail.gmail.com
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
include/linux/seqlock.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 535f158977b9..8cf350325dc6 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -164,8 +164,6 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s)
static inline unsigned raw_seqcount_begin(const seqcount_t *s)
{
unsigned ret = ACCESS_ONCE(s->sequence);
-
- seqcount_lockdep_reader_access(s);
smp_rmb();
return ret & ~1;
}
--
1.9.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Revert lockdep check in raw_seqcount_begin
2014-06-05 15:31 [PATCH] Revert lockdep check in raw_seqcount_begin Trond Myklebust
@ 2014-06-06 14:07 ` Peter Zijlstra
2014-06-11 18:39 ` John Stultz
1 sibling, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2014-06-06 14:07 UTC (permalink / raw)
To: Trond Myklebust
Cc: linux-kernel, John Stultz, Ingo Molnar, David S. Miller, Al Viro
On Thu, Jun 05, 2014 at 11:31:01AM -0400, Trond Myklebust wrote:
> This commit reverts the addition of lockdep checking to raw_seqcount_begin
> for the following reasons:
>
> 1) It violates the naming convention that raw_* functions should not
> do lockdep checks (a convention that is also followed by the other
> raw_*_seqcount_begin functions).
> 2) raw_seqcount_begin does not spin, so it can only be part of an ABBA
> deadlock in very special circumstances (for instance if a lock
> is held across the entire raw_seqcount_begin()+read_seqcount_retry()
> loop while also being taken inside the write_seqcount protected area).
> 3) It is causing false positives with some existing callers, and there
> is no non-lockdep alternative for those callers to use.
>
> None of the three existing callers (__d_lookup_rcu, netdev_get_name, and
> the NFS state code) appear to use the function in a manner that is ABBA
> deadlock prone.
>
> Fixes: 1ca7d67cf5d5: seqcount: Add lockdep functionality to seqcount/seqlock
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Link: http://lkml.kernel.org/r/CAHQdGtRR6SvEhXiqWo24hoUh9AU9cL82Z8Z-d8-7u951F_d+5g@mail.gmail.com
> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Thanks Trond!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Revert lockdep check in raw_seqcount_begin
2014-06-05 15:31 [PATCH] Revert lockdep check in raw_seqcount_begin Trond Myklebust
2014-06-06 14:07 ` Peter Zijlstra
@ 2014-06-11 18:39 ` John Stultz
2014-06-11 18:44 ` John Stultz
1 sibling, 1 reply; 4+ messages in thread
From: John Stultz @ 2014-06-11 18:39 UTC (permalink / raw)
To: Trond Myklebust
Cc: Peter Zijlstra, lkml, Ingo Molnar, David S. Miller, Al Viro
On Thu, Jun 5, 2014 at 8:31 AM, Trond Myklebust
<trond.myklebust@primarydata.com> wrote:
> This commit reverts the addition of lockdep checking to raw_seqcount_begin
> for the following reasons:
>
> 1) It violates the naming convention that raw_* functions should not
> do lockdep checks (a convention that is also followed by the other
> raw_*_seqcount_begin functions).
> 2) raw_seqcount_begin does not spin, so it can only be part of an ABBA
> deadlock in very special circumstances (for instance if a lock
> is held across the entire raw_seqcount_begin()+read_seqcount_retry()
> loop while also being taken inside the write_seqcount protected area).
> 3) It is causing false positives with some existing callers, and there
> is no non-lockdep alternative for those callers to use.
>
> None of the three existing callers (__d_lookup_rcu, netdev_get_name, and
> the NFS state code) appear to use the function in a manner that is ABBA
> deadlock prone.
>
> Fixes: 1ca7d67cf5d5: seqcount: Add lockdep functionality to seqcount/seqlock
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Link: http://lkml.kernel.org/r/CAHQdGtRR6SvEhXiqWo24hoUh9AU9cL82Z8Z-d8-7u951F_d+5g@mail.gmail.com
> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> ---
> include/linux/seqlock.h | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
> index 535f158977b9..8cf350325dc6 100644
> --- a/include/linux/seqlock.h
> +++ b/include/linux/seqlock.h
> @@ -164,8 +164,6 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s)
> static inline unsigned raw_seqcount_begin(const seqcount_t *s)
> {
> unsigned ret = ACCESS_ONCE(s->sequence);
> -
> - seqcount_lockdep_reader_access(s);
> smp_rmb();
> return ret & ~1;
> }
Just back from vacation, sorry for the slow response. Thanks for
submitting this! Also sorry for my confusion mixing
raw_seqcount_begin() and raw_seqlock_begin() in our earlier discussion
(I blame the hectic vacation prep ;).
Acked-by: John Stultz <john.stultz@linaro.org>
thanks
-john
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Revert lockdep check in raw_seqcount_begin
2014-06-11 18:39 ` John Stultz
@ 2014-06-11 18:44 ` John Stultz
0 siblings, 0 replies; 4+ messages in thread
From: John Stultz @ 2014-06-11 18:44 UTC (permalink / raw)
To: Trond Myklebust
Cc: Peter Zijlstra, lkml, Ingo Molnar, David S. Miller, Al Viro
On Wed, Jun 11, 2014 at 11:39 AM, John Stultz <john.stultz@linaro.org> wrote:
> Just back from vacation, sorry for the slow response. Thanks for
> submitting this! Also sorry for my confusion mixing
> raw_seqcount_begin() and raw_seqlock_begin() in our earlier discussion
Bah. Not raw_seqlock_begin.. I meant raw_read_seqcount_begin().
-john
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-11 18:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-05 15:31 [PATCH] Revert lockdep check in raw_seqcount_begin Trond Myklebust
2014-06-06 14:07 ` Peter Zijlstra
2014-06-11 18:39 ` John Stultz
2014-06-11 18:44 ` John Stultz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome