From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 998D4C352A4 for ; Mon, 10 Feb 2020 04:06:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5985321556 for ; Mon, 10 Feb 2020 04:06:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="roX/OaMP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5985321556 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E47816B00A4; Sun, 9 Feb 2020 23:06:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DF8186B00A5; Sun, 9 Feb 2020 23:06:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D0E746B00A6; Sun, 9 Feb 2020 23:06:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0078.hostedemail.com [216.40.44.78]) by kanga.kvack.org (Postfix) with ESMTP id B72F06B00A4 for ; Sun, 9 Feb 2020 23:06:22 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 801658248047 for ; Mon, 10 Feb 2020 04:06:22 +0000 (UTC) X-FDA: 76472880204.30.berry62_54b8d86157f22 X-HE-Tag: berry62_54b8d86157f22 X-Filterd-Recvd-Size: 3586 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Feb 2020 04:06:22 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 131AA20870; Mon, 10 Feb 2020 04:06:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581307581; bh=mgQgZnHgJLUe03AmTrnxQLHDg/eEeWeFgD4hyyYyxP4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=roX/OaMPuaOv9ISVlRhS8nrMi9iND/OqFcBkES9ueWrlcDx64VzCadTQKwBbre8iM hwBbMd4Qi1C6yYmyiossT24qhGZlW6MjKtT647usK5EpaYia6+geLFpXS1Awr1tvUE +eUX7COsz5JFthVysynN0wpwQhohR5qSKA8lksP8= Date: Sun, 9 Feb 2020 20:06:20 -0800 From: Andrew Morton To: Qian Cai Cc: Matthew Wilcox , Marco Elver , 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 Message-Id: <20200209200620.883ad431b01bcd38939ff5b4@linux-foundation.org> In-Reply-To: <2B333FA6-AB17-4169-B9EE-9355FF9C42A4@lca.pw> References: <20200209182008.008c06f1cf4347a95f9de0a5@linux-foundation.org> <2B333FA6-AB17-4169-B9EE-9355FF9C42A4@lca.pw> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, 9 Feb 2020 21:41:56 -0500 Qian Cai wrote: >=20 >=20 > > On Feb 9, 2020, at 9:20 PM, Andrew Morton = wrote: > >=20 > > Using data_race() here seems misleading - there is no race, but we're > > using data_race() to suppress a false positive warning from KCSAN, ye= s? >=20 > 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 co= de here is only interested in 3 bits which are never changed. Thus, it is= a harmless data race. >=20 > Marco also mentioned, >=20 > =E2=80=9CVarious options were considered, and based on feedback from Li= nus, > decided 'data_race(..)' is the best option:=E2=80=9D >=20 > lore.kernel.org/linux-fsdevel/CAHk-=3Dwg5CkOEF8DTez1Qu0XTEFw_oHhxN98bDn= FqbY7HL5AB2g@mail.gmail.com/ >=20 > Paul also said, >=20 > =E2=80=9DPeople will get used to the name more quickly than they will g= et used > to typing the extra seven characters. Here is the current comment head= er: >=20 > /* > * data_race(): macro to document that accesses in an expression may co= nflict 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 t= o tooling > * that data races here should be ignored. > */ >=20 > I will be converting this to docbook form. >=20 > In addition, in the KCSAN documentation: >=20 > * KCSAN understands the ``data_race(expr)`` annotation, which tells KCS= AN that > any data races due to accesses in ``expr`` should be ignored and resu= lting > behaviour when encountering a data race is deemed safe.=E2=80=9D OK. But I believe page_zonenum() still deserves a comment explaining that there is no race and explaining why we're using data_race() anyway. Otherwise the use of data_race() is simply misleading.