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.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 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 4A6ECC34022 for ; Wed, 19 Feb 2020 21:55:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F2EAC20656 for ; Wed, 19 Feb 2020 21:55:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=lca.pw header.i=@lca.pw header.b="W7yNuWHa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2EAC20656 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lca.pw Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9A2BC6B0008; Wed, 19 Feb 2020 16:55:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 953036B007B; Wed, 19 Feb 2020 16:55:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81ADB6B007D; Wed, 19 Feb 2020 16:55:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0152.hostedemail.com [216.40.44.152]) by kanga.kvack.org (Postfix) with ESMTP id 65F796B0008 for ; Wed, 19 Feb 2020 16:55:44 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 32AAB180AD815 for ; Wed, 19 Feb 2020 21:55:44 +0000 (UTC) X-FDA: 76508234208.14.trade06_31fead6674c57 X-HE-Tag: trade06_31fead6674c57 X-Filterd-Recvd-Size: 5720 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Wed, 19 Feb 2020 21:55:43 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id a2so1641910qko.12 for ; Wed, 19 Feb 2020 13:55:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=oXUWpHjcjyL4pSSPcqAy+aUHyOM86zgY+JkKG4C5ctI=; b=W7yNuWHaso4wSD6j2o5+l5mVwMu9RJEBlknWjo7qilDmUG0xrNgU/CCQ2z+5CLdugK 3w0HKJ/k3ChIh1hbkERSWPCbctvcD7KzwHbYCb5L+JfoxnOLxQUhkJCzaiwaRoaXP/jU QckrX373TLmPxqD9ygxVWvZVp6+pwtA6GwnfkVyemHw1+199XPSHk7s8/oarWvBrFOHE HedqezkTVG23hiBpZqK7aBlSH3SR4buAuuWkk3tYLMGQApiHYLYHdncRq8Trg/DegAGa Lr6J8GO/oP2Fa/uWSQF/fYy2jLSDFDxzXBxrI3+Urz1lzYT9glxIdZ5FQVf3RQFPMOyN uDig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=oXUWpHjcjyL4pSSPcqAy+aUHyOM86zgY+JkKG4C5ctI=; b=YKxpzqogMbQ7VH4/pZLJc/MC1lAlnTNbPiIthneptoBj5Djaq46Ikk2Mg+qKse+CpA AuLRKpz3WcEEpx1eq+lsBYfPajNCz8LhZKe2HiNZQkP6g8YQlyf8TpMUs5+QyhH3WmKa i3SxHQBqAVpHn81SkgusLHpqnBYCa0cWRxylHX68EARahGeXubEW15Vo1h6qFIpSBcD4 k4iK2z6EXpfFajn9+B92lsFAZbCbmXj4FhVbeQ8+a5e1+naCkQADskf38ghQtp2VVZx7 iiX57Pjf057LAzQJFSVJtnw48leIgjkTP3bwd2oHZtpmfwxwZPtbsnkn6PuSTHDKO84i hzVQ== X-Gm-Message-State: APjAAAWcT/Ucc2NBKDMckoecPG8sghHeTj7/eI2Bk62oe6SEc7m/nyhG nhTH6Tq2V5YrXq5HJdA1smcozA== X-Google-Smtp-Source: APXvYqzY/nMwCyJtH8MQqZfF5V4++1XVUG9pp0fuYGJTlO+mA1LnWn3bx0Nt6VcYLFuCcH2eJ+fEVw== X-Received: by 2002:a05:620a:13a7:: with SMTP id m7mr25240325qki.500.1582149342702; Wed, 19 Feb 2020 13:55:42 -0800 (PST) Received: from dhcp-41-57.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id 193sm581254qki.38.2020.02.19.13.55.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Feb 2020 13:55:42 -0800 (PST) Message-ID: <1582149340.7365.103.camel@lca.pw> Subject: Re: [PATCH -next v2] mm: annotate a data race in page_zonenum() From: Qian Cai To: akpm@linux-foundation.org Cc: John Hubbard , paulmck@kernel.org, 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 Date: Wed, 19 Feb 2020 16:55:40 -0500 In-Reply-To: References: <1581619089-14472-1-git-send-email-cai@lca.pw> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 (3.22.6-10.el7) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000008, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Andrew, since you had picked the similar one which also depends on=C2=A0ASSERT_EXCLUSIVE_*,=C2=A0can you pick up this patch as well? 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 cpu= 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 A= 40 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 zon= e > > number bits will never be modified by any other write, so it can acce= pt > > a reload of the zone bits after an intervening write and it don't nee= d > > 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 >=20 >=20 > thanks,