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=-5.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 1B9E0C5ACC4 for ; Wed, 19 Feb 2020 23:47:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D4C4624671 for ; Wed, 19 Feb 2020 23:47:54 +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="mHTgAVE0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4C4624671 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6B5DD6B0005; Wed, 19 Feb 2020 18:47:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 666BF6B0006; Wed, 19 Feb 2020 18:47:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57CD56B0007; Wed, 19 Feb 2020 18:47:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0159.hostedemail.com [216.40.44.159]) by kanga.kvack.org (Postfix) with ESMTP id 3E01A6B0005 for ; Wed, 19 Feb 2020 18:47:54 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id F1933180AD80F for ; Wed, 19 Feb 2020 23:47:53 +0000 (UTC) X-FDA: 76508516826.12.grain24_ab4e49636a15 X-HE-Tag: grain24_ab4e49636a15 X-Filterd-Recvd-Size: 4735 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Wed, 19 Feb 2020 23:47:53 +0000 (UTC) Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (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 910DE24656; Wed, 19 Feb 2020 23:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582156072; bh=mbaeW+r88KjheUsIl1WTzCrvEHuy4ZUe2qcfaQLZbWs=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=mHTgAVE0Is2l111GAs7w6Uvt8bMY2fBOu+n/NgR1ntTYp+sKgu+IQ9Bxo5vdW+icR oGJCqM1sqw4V4FCWn19FC5CGnT1d8/0nVxDTdiid4yBqIGCJ0BCilkoOXn6KWEVMv2 OrmdHfLR0eL1qq0LmkelsjgPz33uG9TPO+fzY7KQ= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 1E5563520BB6; Wed, 19 Feb 2020 15:47:52 -0800 (PST) Date: Wed, 19 Feb 2020 15:47:52 -0800 From: "Paul E. McKenney" To: Qian Cai Cc: akpm@linux-foundation.org, John Hubbard , elver@google.com, david@redhat.com, jack@suse.cz, ira.weiny@intel.com, dan.j.williams@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next v2] mm: annotate a data race in page_zonenum() Message-ID: <20200219234752.GS2935@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <1581619089-14472-1-git-send-email-cai@lca.pw> <1582149340.7365.103.camel@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1582149340.7365.103.camel@lca.pw> User-Agent: Mutt/1.9.4 (2018-02-28) Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000018, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Feb 19, 2020 at 04:55:40PM -0500, Qian Cai wrote: > Andrew, since you had picked the similar one which also depends > on=A0ASSERT_EXCLUSIVE_*,=A0can you pick up this patch as well? >=20 > On Thu, 2020-02-13 at 13:20 -0800, John Hubbard wrote: > > On 2/13/20 10:38 AM, Qian Cai wrote: > > > BUG: KCSAN: data-race in page_cpupid_xchg_last / put_page > > >=20 > > > write (marked) to 0xfffffc0d48ec1a00 of 8 bytes by task 91442 on c= pu 3: > > > page_cpupid_xchg_last+0x51/0x80 > > > page_cpupid_xchg_last at mm/mmzone.c:109 (discriminator 11) > > > wp_page_reuse+0x3e/0xc0 > > > wp_page_reuse at mm/memory.c:2453 > > > do_wp_page+0x472/0x7b0 > > > do_wp_page at mm/memory.c:2798 > > > __handle_mm_fault+0xcb0/0xd00 > > > handle_pte_fault at mm/memory.c:4049 > > > (inlined by) __handle_mm_fault at mm/memory.c:4163 > > > handle_mm_fault+0xfc/0x2f0 > > > handle_mm_fault at mm/memory.c:4200 > > > do_page_fault+0x263/0x6f9 > > > do_user_addr_fault at arch/x86/mm/fault.c:1465 > > > (inlined by) do_page_fault at arch/x86/mm/fault.c:1539 > > > page_fault+0x34/0x40 > > >=20 > > > read to 0xfffffc0d48ec1a00 of 8 bytes by task 94817 on cpu 69: > > > put_page+0x15a/0x1f0 > > > page_zonenum at include/linux/mm.h:923 > > > (inlined by) is_zone_device_page at include/linux/mm.h:929 > > > (inlined by) page_is_devmap_managed at include/linux/mm.h:948 > > > (inlined by) put_page at include/linux/mm.h:1023 > > > wp_page_copy+0x571/0x930 > > > wp_page_copy at mm/memory.c:2615 > > > do_wp_page+0x107/0x7b0 > > > __handle_mm_fault+0xcb0/0xd00 > > > handle_mm_fault+0xfc/0x2f0 > > > do_page_fault+0x263/0x6f9 > > > page_fault+0x34/0x40 > > >=20 > > > Reported by Kernel Concurrency Sanitizer on: > > > CPU: 69 PID: 94817 Comm: systemd-udevd Tainted: G W O L 5.= 5.0-next-20200204+ #6 > > > Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS= A40 07/10/2019 > > >=20 > > > A page never changes its zone number. The zone number happens to be > > > stored in the same word as other bits which are modified, but the z= one > > > number bits will never be modified by any other write, so it can ac= cept > > > a reload of the zone bits after an intervening write and it don't n= eed > > > to use READ_ONCE(). Thus, annotate this data race using > > > ASSERT_EXCLUSIVE_BITS() to also assert that there are no concurrent > > > writes to it. > > >=20 > > > Suggested-by: Marco Elver > > > Signed-off-by: Qian Cai > > > --- > > >=20 > > > v2: use ASSERT_EXCLUSIVE_BITS(). > >=20 > >=20 > > Much cleaner, thanks to this new macro. You can add: > >=20 > >=20 > > Reviewed-by: John Hubbard It looks like Andrew already pulled this one in, but let me know if he drops it for whatever reason. Thanx, Paul