Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1006825ybv; Wed, 19 Feb 2020 13:57:18 -0800 (PST) X-Google-Smtp-Source: APXvYqxFLveQBEm9iGFf0hAtW3RZ0woB0ccpVJWvVNMPVL41DEu7rCyOPJKaC4Wlqn/1+lIEWeZk X-Received: by 2002:a9d:6647:: with SMTP id q7mr22009700otm.35.1582149438657; Wed, 19 Feb 2020 13:57:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582149438; cv=none; d=google.com; s=arc-20160816; b=HsCAt89G59i/JrlQitl865797rrFaj4VpDwy1i8Z6p282aX5S72c5ba98rHm3Q1tkd tl38QQozjscEgNGKQB24brz5cNI9E79mOTm3EuqrekRavSGqZpmiqr7148Xzt+lkL78G RB5MNuY1cKKu+O2XL+BDrzEqAo73Au2b9ynzclB707OVXRBJTzgVESKCRxs2G2SD1Vek 7PbrfvsmO0hfDfY56lDL8uFrXzf2yjqCh6H+niK5QN8hlEV5tzZ7ZXeZx2hf0ksjW5H0 yxjpK0x8g0oytrrADZxinEon6jQaQ66igYDAIJb6MKy35c5mFkGYL0BAa120FjmeyiFm SKAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=oXUWpHjcjyL4pSSPcqAy+aUHyOM86zgY+JkKG4C5ctI=; b=a3VG5lp4/5nZo7B+Trurg2zZgzUhFccVOC4H79Adk+AQBo9kRTFTPXkG8HD5OiIcGi /ykWa/7OBodjPoaA/Rxm58u4dPA2RsCC6ObduK0sR+XhppYrnJKzcV57cJxWzW93CVe0 Y22l/WhQnIS3Z8mUPwtEdxl5s2pf4NdAXTDmdXrHMkh9CdzamGoClTrMmZeQ9UwVGQfD Etay+WD5eLPCVH0fXq2oR0NZXd2yWn+0cC7ej7CcerOmF2gFk7DOk988FFtY73eh45d/ ulXnhR0lSI0f2qf4M0nNba9iVvOCs2ivbictXFZkuh+bKapqyg0RJHFVLN4UQKrqW1ow u3dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=W7yNuWHa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9si535711otp.139.2020.02.19.13.57.06; Wed, 19 Feb 2020 13:57:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=W7yNuWHa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727646AbgBSVzp (ORCPT + 99 others); Wed, 19 Feb 2020 16:55:45 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:34708 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726760AbgBSVzo (ORCPT ); Wed, 19 Feb 2020 16:55:44 -0500 Received: by mail-qk1-f193.google.com with SMTP id c20so1708524qkm.1 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=CxT6i4mg205Za886/OdFbGlLunbHoDPzLXUR58oAE0RiSFgVMxO1+83MmzhrghVLlX lwfn7m5VKOXBZqBpiq4MVNGW/rwR5yNxySH1LtCUTy+cGxIoWspYlRaTP9vBoVAFYErz qbN9tjbTM8B0V+Whp68tejGBjm9fwo4xi/6NvSePXNiLFlJVJk+pHQpJldjaUZ7eNonl WFChbScLgaUrlugi/erIabdixI9OsoBL0dLZcKKDH5+0a8MDjw5DlMrZn8VpNUM4eoVk bweJO5twyZs2KMc8ubtust230P42UYCNzvlXJjTsIxn61oTl3LBIpDnV8EjXoykpi3qB pJHA== X-Gm-Message-State: APjAAAXTK7hYqvpM1TnlPhPAkXF0ilDFulidGM2MJ55rqi9tXMpJcRds Agtp1ncTgZW322YUDQY/p1irHQ== 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: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrew, since you had picked the similar one which also depends on ASSERT_EXCLUSIVE_*, can 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 > > > > 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 > > > > 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 > > > > 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 > > > > 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 zone > > number bits will never be modified by any other write, so it can accept > > a reload of the zone bits after an intervening write and it don't need > > to use READ_ONCE(). Thus, annotate this data race using > > ASSERT_EXCLUSIVE_BITS() to also assert that there are no concurrent > > writes to it. > > > > Suggested-by: Marco Elver > > Signed-off-by: Qian Cai > > --- > > > > v2: use ASSERT_EXCLUSIVE_BITS(). > > > Much cleaner, thanks to this new macro. You can add: > > > Reviewed-by: John Hubbard > > > thanks,