Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp31209ybv; Wed, 19 Feb 2020 15:48:15 -0800 (PST) X-Google-Smtp-Source: APXvYqycmCh0lIkaR7tYKrGsXU8ZOAMB89yHm24QrkcikN7mhTaa5k/v4gozK1Ht3sB5ebzexdSr X-Received: by 2002:a05:6830:2102:: with SMTP id i2mr20871044otc.123.1582156095804; Wed, 19 Feb 2020 15:48:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582156095; cv=none; d=google.com; s=arc-20160816; b=EjM8KpIG9c0A+z70vLwFhcBP7UsYnEmzSI4RD+4ZMQAajqcAoqp+ZmY22By6glBSLL 0EmHF8QfAIsvTnR6l7DbssQgDWyZuulzktYG15UdgizRNj8+S2287TBzJG8z/0n6i1D4 3n2Di9BZCYFsnW7D7gmGMvWClr0SObU2MFF+91IRAGAWWNH3ah1eGP3qporwmfasJ/Xs IdJXhjz4nyIG65/7VxIFs9EweRWG4hE0gmP/362VQ3tdMP2rzkHB0AIdfD4tLjB5jFeZ vQr/O+8O+INRPMDK3Br9u2PuxERcxAff/vvAWR/1EEvYnYyhxe03kaG3RF1p3qzg+QV1 fNCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=yfnUwfzJlZBR73jWTonPLuxOqad5A2WInKW/eaU3wMc=; b=AVRw+ShSO7jiLEquXJiwc5vmJjPolGEEZ1jSO1IKI8YB2lRldsD8ArD9guwqsfBVZU SKZe+AMFZ1CHaggoW3XBZisPzjDD8+b6Z1PQ/9G4BY5KY2tezCh/1FAjB27LuODHfkor HOjbaQwD7IJUnUGIOqDEdYyPE6dGElTvneK+Jt/i/aWFEjVQLDdqGcc0h/8RaxDbngwb o3mAOYsOdB6MNpMcgEml8/orpm0Mrvvwt4WwIzbh9EAYWZWvA1aeo7H0Yoz6GF2gzjZ2 SXFqUJSbAlP54kdOwqo8UWvKINc77705sypTVLaG7tqd6/+3mZ7XKpnersx9kxXWdwnt NxoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mHTgAVE0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i3si692212otc.272.2020.02.19.15.48.00; Wed, 19 Feb 2020 15:48:15 -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=@kernel.org header.s=default header.b=mHTgAVE0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726767AbgBSXrx (ORCPT + 99 others); Wed, 19 Feb 2020 18:47:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:49698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726681AbgBSXrx (ORCPT ); Wed, 19 Feb 2020 18:47:53 -0500 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 Content-Transfer-Encoding: 8bit In-Reply-To: <1582149340.7365.103.camel@lca.pw> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?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 It looks like Andrew already pulled this one in, but let me know if he drops it for whatever reason. Thanx, Paul