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=-2.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 C9009C18E5A for ; Tue, 10 Mar 2020 15:47:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4B21215A4 for ; Tue, 10 Mar 2020 15:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583855271; bh=fxXBC6mLqLhF630XcKwvNoA3xYL1Mgjsv4/cnzDW8FE=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:List-ID: From; b=1H8Qsrp8rbBMNcYSI+w31V6Vmrk0bmWM1oAiHBOsZB4Fyc1kBtlyTZXJq0xmcSdVx WYpu7qAa0meadNKPKTcAuaKk2yIncJQR4M0qy07M5/v7+80asGsj5cf973unZGGvQV 3gg1pr84vQu+v6S8qjCq6zJhnrWqhAuiPYntmgys= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726830AbgCJPru (ORCPT ); Tue, 10 Mar 2020 11:47:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:58010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbgCJPru (ORCPT ); Tue, 10 Mar 2020 11:47:50 -0400 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 D5C0320866; Tue, 10 Mar 2020 15:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583855269; bh=fxXBC6mLqLhF630XcKwvNoA3xYL1Mgjsv4/cnzDW8FE=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=t6BwwWyfltp0cLV9XE4wIgEp201EDrtvpsCABAtdCg+fbpp7EdL6PG2iWnkxtPkQd Ik604FbqVyTy4wadVmpZAsXt2e7bm7XDJ3DIRBnb1ZhLVa1qlnYu0lMu71TBYTjzys EuahFLGqKgSz2Vm3dRqAs7NvA4Js9NZR3HqrOCFE= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id ACDAD35226CF; Tue, 10 Mar 2020 08:47:49 -0700 (PDT) Date: Tue, 10 Mar 2020 08:47:49 -0700 From: "Paul E. McKenney" To: David Laight Cc: 'Marco Elver' , Chris Wilson , "linux-kernel@vger.kernel.org" , "intel-gfx@lists.freedesktop.org" , Andrew Morton , Randy Dunlap , "stable@vger.kernel.org" Subject: Re: [PATCH] list: Prevent compiler reloads inside 'safe' list iteration Message-ID: <20200310154749.GZ2935@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200310092119.14965-1-chris@chris-wilson.co.uk> <2e936d8fd2c445beb08e6dd3ee1f3891@AcuMS.aculab.com> <158384100886.16414.15741589015363013386@build.alporthouse.com> <723d527a4ad349b78bf11d52eba97c0e@AcuMS.aculab.com> <20200310125031.GY2935@paulmck-ThinkPad-P72> <77ff4da6b0a7448c947af6de4fb43cdb@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <77ff4da6b0a7448c947af6de4fb43cdb@AcuMS.aculab.com> 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 Tue, Mar 10, 2020 at 03:05:57PM +0000, David Laight wrote: > From: Marco Elver > > Sent: 10 March 2020 14:10 > ... > > FWIW, for writes we're already being quite generous, in that plain > > aligned writes up to word-size are assumed to be "atomic" with the > > default (conservative) config, i.e. marking such writes is optional. > > Although, that's a generous assumption that is not always guaranteed > > to hold (https://lore.kernel.org/lkml/20190821103200.kpufwtviqhpbuv2n@willie-the-truck/). > > Remind me to start writing everything in assembler. Been there, done that. :-/ > That and to mark all structure members 'volatile'. Indeed. READ_ONCE() and WRITE_ONCE() get this same effect, but without pessimizing non-concurrent accesses to those same members. Plus KCSAN knows about READ_ONCE(), WRITE_ONCE(), and also volatile members. Thanx, Paul