Message ID | 20200324153643.15527-9-will@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Improve list integrity checking | expand |
On Tue, Mar 24, 2020 at 03:36:30PM +0000, Will Deacon wrote: > This reverts commit 2f073848c3cc8aff2655ab7c46d8c0de90cf4e50. > > There is no need to use WRITE_ONCE() to initialise a non-RCU 'list_head'. > > Cc: Paul E. McKenney <paulmck@kernel.org> > Cc: Peter Zijlstra <peterz@infradead.org> > Signed-off-by: Will Deacon <will@kernel.org> And attention to lockless uses of list_empty() here, correct? Depending on the outcome of discussions on 3/21, I should have added in all three cases. Thanx, Paul > --- > include/linux/list.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/list.h b/include/linux/list.h > index c7331c259792..b86a3f9465d4 100644 > --- a/include/linux/list.h > +++ b/include/linux/list.h > @@ -32,7 +32,7 @@ > */ > static inline void INIT_LIST_HEAD(struct list_head *list) > { > - WRITE_ONCE(list->next, list); > + list->next = list; > list->prev = list; > } > > -- > 2.20.1 >
On Mon, Mar 30, 2020 at 04:25:05PM -0700, Paul E. McKenney wrote: > On Tue, Mar 24, 2020 at 03:36:30PM +0000, Will Deacon wrote: > > This reverts commit 2f073848c3cc8aff2655ab7c46d8c0de90cf4e50. > > > > There is no need to use WRITE_ONCE() to initialise a non-RCU 'list_head'. > > > > Cc: Paul E. McKenney <paulmck@kernel.org> > > Cc: Peter Zijlstra <peterz@infradead.org> > > Signed-off-by: Will Deacon <will@kernel.org> > > And attention to lockless uses of list_empty() here, correct? > > Depending on the outcome of discussions on 3/21, I should have added in > all three cases. Yes, patch 3 is where this will get sorted. It looks like we'll have to disable KCSAN around the READ_ONCE() over there, but I also need to finish wrapping my head around list_empty_careful() because I'm deeply suspicious! Will
On Tue, Mar 31, 2020 at 02:11:54PM +0100, Will Deacon wrote: > On Mon, Mar 30, 2020 at 04:25:05PM -0700, Paul E. McKenney wrote: > > On Tue, Mar 24, 2020 at 03:36:30PM +0000, Will Deacon wrote: > > > This reverts commit 2f073848c3cc8aff2655ab7c46d8c0de90cf4e50. > > > > > > There is no need to use WRITE_ONCE() to initialise a non-RCU 'list_head'. > > > > > > Cc: Paul E. McKenney <paulmck@kernel.org> > > > Cc: Peter Zijlstra <peterz@infradead.org> > > > Signed-off-by: Will Deacon <will@kernel.org> > > > > And attention to lockless uses of list_empty() here, correct? > > > > Depending on the outcome of discussions on 3/21, I should have added in > > all three cases. > > Yes, patch 3 is where this will get sorted. It looks like we'll have to > disable KCSAN around the READ_ONCE() over there, but I also need to finish > wrapping my head around list_empty_careful() because I'm deeply suspicious! At the very least, it does have the disadvantage of touching an additional cache line, and up to two additional cache lines in the non-empty case. :-( Thanx, Paul
diff --git a/include/linux/list.h b/include/linux/list.h index c7331c259792..b86a3f9465d4 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -32,7 +32,7 @@ */ static inline void INIT_LIST_HEAD(struct list_head *list) { - WRITE_ONCE(list->next, list); + list->next = list; list->prev = list; }
This reverts commit 2f073848c3cc8aff2655ab7c46d8c0de90cf4e50. There is no need to use WRITE_ONCE() to initialise a non-RCU 'list_head'. Cc: Paul E. McKenney <paulmck@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Will Deacon <will@kernel.org> --- include/linux/list.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)