linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>,
	Marco Elver <elver@google.com>,
	jhubbard@nvidia.com, ira.weiny@intel.com,
	dan.j.williams@intel.com, jack@suse.cz, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next v2] mm: mark an intentional data race in page_zonenum
Date: Sun, 9 Feb 2020 21:41:56 -0500	[thread overview]
Message-ID: <2B333FA6-AB17-4169-B9EE-9355FF9C42A4@lca.pw> (raw)
In-Reply-To: <20200209182008.008c06f1cf4347a95f9de0a5@linux-foundation.org>



> On Feb 9, 2020, at 9:20 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> Using data_race() here seems misleading - there is no race, but we're
> using data_race() to suppress a false positive warning from KCSAN, yes?

It is a data race in the sense of compilers, i.e., KCSAN is a compiler instrumentation, so here the load and store are both in word-size, but code here is only interested in 3 bits which are never changed. Thus, it is a harmless data race.

Marco also mentioned,

“Various options were considered, and based on feedback from Linus,
decided 'data_race(..)' is the best option:”

lore.kernel.org/linux-fsdevel/CAHk-=wg5CkOEF8DTez1Qu0XTEFw_oHhxN98bDnFqbY7HL5AB2g@mail.gmail.com/

Paul also said,

”People will get used to the name more quickly than they will get used
to typing the extra seven characters.  Here is the current comment header:

/*
 * data_race(): macro to document that accesses in an expression may conflict with
 * other concurrent accesses resulting in data races, but the resulting
 * behaviour is deemed safe regardless.
 *
 * This macro *does not* affect normal code generation, but is a hint to tooling
 * that data races here should be ignored.
 */

I will be converting this to docbook form.

In addition, in the KCSAN documentation:

* KCSAN understands the ``data_race(expr)`` annotation, which tells KCSAN that
  any data races due to accesses in ``expr`` should be ignored and resulting
  behaviour when encountering a data race is deemed safe.”

  reply	other threads:[~2020-02-10  2:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 18:30 Qian Cai
2020-02-06 20:20 ` Matthew Wilcox
2020-02-06 20:25   ` Qian Cai
2020-02-10  2:20     ` Andrew Morton
2020-02-10  2:41       ` Qian Cai [this message]
2020-02-10  4:06         ` Andrew Morton
2020-02-10  7:58           ` 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=2B333FA6-AB17-4169-B9EE-9355FF9C42A4@lca.pw \
    --to=cai@lca.pw \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=elver@google.com \
    --cc=ira.weiny@intel.com \
    --cc=jack@suse.cz \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.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