[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200304040051.GB29971@bombadil.infradead.org>
Date: Tue, 3 Mar 2020 20:00:51 -0800
From: Matthew Wilcox <willy@...radead.org>
To: Qian Cai <cai@....pw>
Cc: paulmck@...nel.org, elver@...gle.com, linux-kernel@...r.kernel.org
Subject: Re: [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@...radead.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 ^^^
Powered by blists - more mailing lists