From: John Hubbard <jhubbard@nvidia.com>
To: Qian Cai <cai@lca.pw>, Jan Kara <jack@suse.cz>
Cc: David Hildenbrand <david@redhat.com>, <akpm@linux-foundation.org>,
<ira.weiny@intel.com>, <dan.j.williams@intel.com>,
<elver@google.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>, Marco Elver <elver@google.com>
Subject: Re: [PATCH] mm: fix a data race in put_page()
Date: Thu, 6 Feb 2020 15:36:37 -0800 [thread overview]
Message-ID: <1978a849-1db9-2d8a-d494-978eadc7d999@nvidia.com> (raw)
In-Reply-To: <079c4429-8a11-154d-cf5c-473d2698d18d@nvidia.com>
On 2/6/20 3:34 PM, John Hubbard wrote:
> On 2/6/20 7:23 AM, Qian Cai wrote:
>>
>>
>>> On Feb 6, 2020, at 9:55 AM, Jan Kara <jack@suse.cz> wrote:
>>>
>>> I don't think the problem is real. The question is how to make KCSAN happy
>>> in a way that doesn't silence other possibly useful things it can find and
>>> also which makes it most obvious to the reader what's going on... IMHO
>>> using READ_ONCE() fulfills these targets nicely - it is free
>>> performance-wise in this case, it silences the checker without impacting
>>> other races on page->flags, its kind of obvious we don't want the load torn
>>> in this case so it makes sense to the reader (although a comment may be
>>> nice).
>>
>> Actually, use the data_race() macro there fulfilling the same purpose too, i.e, silence the splat here but still keep searching for other races.
>>
>
> Yes, but both READ_ONCE() and data_race() would be saying untrue things about this code,
> and that somewhat offends my sense of perfection... :)
>
> * READ_ONCE(): this field need not be restricted to being read only once, so the
> name is immediately wrong. We're using side effects of READ_ONCE().
>
> * data_race(): there is no race on the N bits worth of page zone number data. There
> is only a perceived race, due to tools that look at word-level granularity.
>
> I'd propose one or both of the following:
>
> a) Hope that Marcus has an idea to enhance KCSAN so as to support this model of
> access, and/or
>
arggh, make that "Marco Elver"! Really sorry for the typo on your name.
thanks,
--
John Hubbard
NVIDIA
> b) Add a new, better-named macro to indicate what's going on. Initial bikeshed-able
> candidates:
>
> READ_RO_BITS()
> READ_IMMUTABLE_BITS()
> ...etc...
>
> thanks,
>
next prev parent reply other threads:[~2020-02-06 23:36 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-06 13:17 Qian Cai
2020-02-06 13:33 ` David Hildenbrand
2020-02-06 13:51 ` Qian Cai
2020-02-06 14:55 ` Jan Kara
2020-02-06 14:59 ` David Hildenbrand
2020-02-06 15:23 ` Qian Cai
2020-02-06 23:34 ` John Hubbard
2020-02-06 23:36 ` John Hubbard [this message]
2020-02-06 23:55 ` Qian Cai
2020-02-07 0:18 ` Qian Cai
2020-02-07 0:27 ` John Hubbard
2020-02-07 0:55 ` Qian Cai
2020-02-07 13:17 ` Marco Elver
2020-02-09 1:44 ` John Hubbard
2020-02-09 3:10 ` Qian Cai
2020-02-09 7:12 ` John Hubbard
2020-02-10 7:48 ` Marco Elver
2020-02-10 12:16 ` Qian Cai
2020-02-10 12:58 ` Marco Elver
2020-02-10 13:36 ` Qian Cai
2020-02-10 13:38 ` Marco Elver
2020-02-10 13:55 ` Qian Cai
2020-02-10 14:12 ` Marco Elver
2020-02-10 14:31 ` Qian Cai
2020-02-10 16:23 ` Qian Cai
2020-02-10 16:33 ` Marco Elver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1978a849-1db9-2d8a-d494-978eadc7d999@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=cai@lca.pw \
--cc=dan.j.williams@intel.com \
--cc=david@redhat.com \
--cc=elver@google.com \
--cc=ira.weiny@intel.com \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox