Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2082696ybv; Thu, 6 Feb 2020 15:38:15 -0800 (PST) X-Google-Smtp-Source: APXvYqxBOaolnQPtBLJHx7lXviLpA7P8C20gbgm1aovcGznjQWsXOqmVlvLdwIW3RIq/Ss1IqIqk X-Received: by 2002:a05:6830:22ca:: with SMTP id q10mr535003otc.280.1581032295252; Thu, 06 Feb 2020 15:38:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581032295; cv=none; d=google.com; s=arc-20160816; b=D5hcFx4Db5siVBoobrVp0ROxssjAtp4+fU55jXcQHQQ2mnnzT9j3HT3NMRCLaxzlnR 4xShGbI0XF5H1ZvWrYmaS410ecCtmZ0iA+YN6bl40npX0OYzWiXVB21gSHQuCHKTQ7xD +Q/PeJBWKN30S2hbigdAmDrYYE32KS0VPGw2qWddf+Fh0Ul5ugpQpcu2REYb0s3XbsQV mK0/LDQQ4IokP4xMezQilqXV5Sdo/8tqatYjLLkD4qMzHq6GTy3xy41i+ihH8q+2yolN pRgZnxZzdkDzXSDfO0F/Mdme81p7WIYhqkJ+nyuAvbxRusgWtQoTY4PtP7FGPovw9KT5 2e1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=QfvWhgIyJ16nW5czUmXs6GNFz2v/B+IzL+b/xu15Az4=; b=uEue+Qjvgrvo/EK2KuQ6fbVOE0hFNHNDwfkAr24VbGXdVqJwBEA+IP+PApoN6jwrDh eYpRVKlOF/xvmpg6YFj86EUNg8vNetZzWUl9WEEXNO29hMXTpDDFL6k0+Y2wHOzlnU2m xsN7Ki4yLQIwUDWw7E2KkLE4dss9O0baSjC3JXD9ptnrpsVg3WL2DpRQEWxRBtB99KXc eZ1aOVrsVtJxppl4/baUpjr3ThLEAXYejoP69hRtFt4ACJSZpWwvDSmLkrJ5aCn6PfOF wICd8Dy5KPSXTMiEbPxcD4Zn9p5K7qb1fGrvfFgi6E/ZVHutZo8HrNzh2QKo+a0EIDHn ZOwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=mtUcIQa5; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r14si2858774oic.12.2020.02.06.15.38.00; Thu, 06 Feb 2020 15:38: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=@nvidia.com header.s=n1 header.b=mtUcIQa5; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726709AbgBFXgj (ORCPT + 99 others); Thu, 6 Feb 2020 18:36:39 -0500 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:19247 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726502AbgBFXgj (ORCPT ); Thu, 6 Feb 2020 18:36:39 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 06 Feb 2020 15:36:13 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 06 Feb 2020 15:36:38 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 06 Feb 2020 15:36:38 -0800 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 6 Feb 2020 23:36:38 +0000 Subject: Re: [PATCH] mm: fix a data race in put_page() From: John Hubbard To: Qian Cai , Jan Kara CC: David Hildenbrand , , , , , , , Marco Elver References: <20200206145501.GD26114@quack2.suse.cz> <079c4429-8a11-154d-cf5c-473d2698d18d@nvidia.com> X-Nvconfidentiality: public Message-ID: <1978a849-1db9-2d8a-d494-978eadc7d999@nvidia.com> Date: Thu, 6 Feb 2020 15:36:37 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <079c4429-8a11-154d-cf5c-473d2698d18d@nvidia.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1581032173; bh=QfvWhgIyJ16nW5czUmXs6GNFz2v/B+IzL+b/xu15Az4=; h=X-PGP-Universal:Subject:From:To:CC:References:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=mtUcIQa5HqcEJuyfO/kq4QLOD2SkmY/1PmuqRULzeQlJCYFWLYDlVR6YRVI/MXgGU ffhlajXj1n3CU25R7p7eeCF6gyGCKOU5C76gaUuf6Y0SUjL7R0pUdY4t+zkjq+kSL/ 9pVi+V2kQwNChMx26YAkGddURZb5qdySj7ChUkJTX5pRN5kW9wWniCAediOEWk/TAc dO1I9s4+Yr6HaxD8A/gzSt1mgM0C2qrJEH79WzTZilqEalUhvLHXpuJi+qLUKmlWjU VMeDH13tL9c23FVB9tptlIf1clceOaHmr8H9TpSRRZlmeUl1L36yZCbSgNmtiBmNrZ 6hJg8aJl7zupg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/6/20 3:34 PM, John Hubbard wrote: > On 2/6/20 7:23 AM, Qian Cai wrote: >> >> >>> On Feb 6, 2020, at 9:55 AM, Jan Kara wrote: >>> >>> I don't think the problem is real. The question is how to make KCSAN happy >>> in a way that doesn't silence other possibly useful things it can find and >>> also which makes it most obvious to the reader what's going on... IMHO >>> using READ_ONCE() fulfills these targets nicely - it is free >>> performance-wise in this case, it silences the checker without impacting >>> other races on page->flags, its kind of obvious we don't want the load torn >>> in this case so it makes sense to the reader (although a comment may be >>> nice). >> >> Actually, use the data_race() macro there fulfilling the same purpose too, i.e, silence the splat here but still keep searching for other races. >> > > Yes, but both READ_ONCE() and data_race() would be saying untrue things about this code, > and that somewhat offends my sense of perfection... :) > > * READ_ONCE(): this field need not be restricted to being read only once, so the > name is immediately wrong. We're using side effects of READ_ONCE(). > > * data_race(): there is no race on the N bits worth of page zone number data. There > is only a perceived race, due to tools that look at word-level granularity. > > I'd propose one or both of the following: > > a) Hope that Marcus has an idea to enhance KCSAN so as to support this model of > access, and/or > arggh, make that "Marco Elver"! Really sorry for the typo on your name. thanks, -- John Hubbard NVIDIA > b) Add a new, better-named macro to indicate what's going on. Initial bikeshed-able > candidates: > > READ_RO_BITS() > READ_IMMUTABLE_BITS() > ...etc... > > thanks, >