Re: [PATCH] [RFC] seqcount: Add lockdep functionality to seqcount/seqlock structures

2013-09-10 Thread John Stultz
On 09/10/2013 01:55 AM, Peter Zijlstra wrote: > On Mon, Sep 09, 2013 at 09:42:46PM -0700, John Stultz wrote: >> @@ -38,10 +39,58 @@ >> */ >> typedef struct seqcount { >> unsigned sequence; >> +#ifdef CONFIG_DEBUG_LOCK_ALLOC >> +struct lockdep_map dep_map; >> +#endif >> } seqcount_t; >>

Re: [PATCH] [RFC] seqcount: Add lockdep functionality to seqcount/seqlock structures

2013-09-10 Thread John Stultz
On 09/10/2013 01:43 AM, Peter Zijlstra wrote: > On Mon, Sep 09, 2013 at 09:42:46PM -0700, John Stultz wrote: >> Currently seqlocks and seqcounts don't support lockdep. >> >> After running across a seqcount related deadlock in the timekeeping >> code, I used a less-refined and more focused varient o

Re: [PATCH] [RFC] seqcount: Add lockdep functionality to seqcount/seqlock structures

2013-09-10 Thread Peter Zijlstra
On Tue, Sep 10, 2013 at 10:11:56AM +0200, Peter Zijlstra wrote: > On Mon, Sep 09, 2013 at 09:42:46PM -0700, John Stultz wrote: > > +++ b/include/linux/lockdep.h > > @@ -510,6 +510,21 @@ static inline void print_irqtrace_events(struct > > task_struct *curr) > > > > #ifdef CONFIG_DEBUG_LOCK_ALLOC

Re: [PATCH] [RFC] seqcount: Add lockdep functionality to seqcount/seqlock structures

2013-09-10 Thread Peter Zijlstra
On Mon, Sep 09, 2013 at 09:42:46PM -0700, John Stultz wrote: > @@ -38,10 +39,58 @@ > */ > typedef struct seqcount { > unsigned sequence; > +#ifdef CONFIG_DEBUG_LOCK_ALLOC > + struct lockdep_map dep_map; > +#endif > } seqcount_t; > > -#define SEQCNT_ZERO { 0 } > -#define seqcount_ini

Re: [PATCH] [RFC] seqcount: Add lockdep functionality to seqcount/seqlock structures

2013-09-10 Thread Peter Zijlstra
On Mon, Sep 09, 2013 at 09:42:46PM -0700, John Stultz wrote: > Currently seqlocks and seqcounts don't support lockdep. > > After running across a seqcount related deadlock in the timekeeping > code, I used a less-refined and more focused varient of this patch > to narrow down the cause of the issu

Re: [PATCH] [RFC] seqcount: Add lockdep functionality to seqcount/seqlock structures

2013-09-10 Thread Peter Zijlstra
On Mon, Sep 09, 2013 at 09:42:46PM -0700, John Stultz wrote: > +++ b/include/linux/lockdep.h > @@ -510,6 +510,21 @@ static inline void print_irqtrace_events(struct > task_struct *curr) > > #ifdef CONFIG_DEBUG_LOCK_ALLOC > # ifdef CONFIG_PROVE_LOCKING > +# define seqcount_acquire(l, s, t, i)

[PATCH] [RFC] seqcount: Add lockdep functionality to seqcount/seqlock structures

2013-09-09 Thread John Stultz
Currently seqlocks and seqcounts don't support lockdep. After running across a seqcount related deadlock in the timekeeping code, I used a less-refined and more focused varient of this patch to narrow down the cause of the issue. This is a first-pass attempt to properly enable lockdep functionali