lkml.org 
[lkml]   [2020]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -next] lib: disable KCSAN for XArray
On Tue, Mar 03, 2020 at 10:55:02PM -0500, Qian Cai wrote:
>
>
> > On Mar 3, 2020, at 10:33 PM, Matthew Wilcox <willy@infradead.org> wrote:
> >
> > On Tue, Mar 03, 2020 at 10:15:51PM -0500, Qian Cai wrote:
> >> Functions like xas_find_marked(), xas_set_mark(), and xas_clear_mark()
> >> could happen concurrently result in data races, but those operate only
> >> on a single bit that are pretty much harmless. For example,
> >
> > Those aren't data races. The writes are protected by a spinlock and the
> > reads by the RCU read lock. If the tool can't handle RCU protection,
> > it's not going to be much use.
> >
>
> Maybe the commit log is a bit confusing if you did not look at the example closely
> enough. It is actually one read and one write result in data races where one spin_lock()
> and one rcu_read_lock() can’t prevent that from happening. We also have,

Yes. All these examples have the reader protected by the RCU read lock
and the writer protected by the spinlock. Does the tool need some kind
of extra annotation here?

> [19522.548668][T39646] BUG: KCSAN: data-race in xas_clear_mark / xas_find_marked
> [19522.583776][T39646]
> [19522.593816][T39646] write to 0xffff9ffb56c5c238 of 8 bytes by interrupt on cpu 16:
> [19522.628560][T39646] xas_clear_mark+0x8e/0x1a0
> [19522.648993][T39646] __xa_clear_mark+0xe7/0x110
> [19522.669367][T39646] test_clear_page_writeback+0x3e9/0x712 [19522.694638][T39646] end_page_writeback+0xaa/0x2b0

Spinlock taken here ^^^

> [19523.533125][T39646] read to 0xffff9ffb56c5c238 of 8 bytes by task 39646 on cpu 16:
> [19523.570758][T39646] xas_find_marked+0xe9/0x750
> [19523.594276][T39646] find_get_pages_range_tag+0x1bf/0xa90

RCU read lock taken here ^^^

\
 
 \ /
  Last update: 2020-03-04 05:01    [W:0.085 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site