Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5139696yba; Tue, 30 Apr 2019 09:45:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwH1+scDqVvjeLTeFVoXBRhaDIopPDnNujp0FI3SmXJBPncUpI7iTAsqS05LGZBCzz+eqTU X-Received: by 2002:a63:3284:: with SMTP id y126mr68028950pgy.424.1556642726179; Tue, 30 Apr 2019 09:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556642726; cv=none; d=google.com; s=arc-20160816; b=00nQt2JuGzZq6X0YYxC1RTl+MLMougtzihxs74Qs3SZmrtnY+ZneQno4WCCCSDJ/tT aJ52gHbHwg86oLFL2ccjosh4wEDxaNFA0/9qPdiuqmTtLu5/tQnNMiCt3R1+jT0qg5tC Q2RnHs7gq8GmMNrV90IEBm2x7TqxbOM1i8AJsA2XFvCvn9CRV+yQFg2pexDWQOysopNq z3t8Q54gs5Cyqj7LeHaYthVSDwhi2xDE0aFm9sJkUq8lizLtLS9IRAqUQbkK8yPCpcLc vERaWGJVdLuMyMIKcbw3l4W/Jpc3DGTW0Py0AMa1+NWjrSBh7H3XrR89H3dQQRLKgxFk Rj7w== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6a++kp7rZSqO56147GgKvyNl/WmQw5p2F4HTj/YvBwo=; b=mFb+ISVB0pi39moR9OO6fRDIWsWS9pcsw7V+jnM7PIyU9wdZVVuWiXKMHUsQwpuNWr G6IerPFZGA57SxCTsG88v6A8hcmK0rY9GPf0ddq0ubOAIfydArCSG/nXQUyPQJ9agcU/ ouJaA8A7rCStKG/xvyWinTL8N4zcpSgfHjQqdJMg9Pt/+9E6HPQ0psHahXdRPirxKjQ7 Tktlrte2Wq260BdSSaHnpYCn2ntF8XmEdRmB3YCNAZH4rBIFcSHxL0qZDlHyLmUE7xwT uSJiiuL/f3Qy8dRRm6uOOp+H4EGvZAm3PMluPPhfI7QqFT57W3K+zbvAqPVyJDLUgBJt l84w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JywicDci; 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 m64si9211328pfm.188.2019.04.30.09.45.09; Tue, 30 Apr 2019 09:45:26 -0700 (PDT) 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=@amarulasolutions.com header.s=google header.b=JywicDci; 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 S1726155AbfD3QoP (ORCPT + 99 others); Tue, 30 Apr 2019 12:44:15 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33115 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725950AbfD3QoO (ORCPT ); Tue, 30 Apr 2019 12:44:14 -0400 Received: by mail-wr1-f67.google.com with SMTP id s18so21891794wrp.0 for ; Tue, 30 Apr 2019 09:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=6a++kp7rZSqO56147GgKvyNl/WmQw5p2F4HTj/YvBwo=; b=JywicDcin0PEkXHlmOEx44gGwJpwcMFiLKCQpuSba8BdnyTjTAX37whDXyUIhYNhGT kj2wkan4ypqehPT7qsZYHXCn0+XciKhB28IqcMs/HskCH+WmFvuXj9yszN5TPu6JnYKL KV1EAiv9jORb17I8fAFZGUTxDD7rtPMeqQXyk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=6a++kp7rZSqO56147GgKvyNl/WmQw5p2F4HTj/YvBwo=; b=DxMgQJasgG7cvEwJv/lmYdYAY7ZY51nB08wTBB7HAapUTmPhCm48QKlJGA4pNe0MCG u3IR3cX+z1Ea6oxBrCkQNgtbgIiTSE6Bk/oozTceOqnJC6BRi9JcT//DBxMGJ5BhKiwp SD6EBbhtK5notv5i+L1eZATTtprl0sSJleyxS4eQuZ3MerLDKGkOQNAhfO+Zt5F+Mofc XAIBTXRkJ5IexwLaJttHkkKtaUrobydC9om5DE01eW4eGCMGULnq2uKq5olT8qvAHR6s k9e78j2hzpEuyTvHRAnLO39Dm9kzHyNgmIxhaTwCjU+3DE+N43zkO8eRnB0BcaRXPQWV CXCg== X-Gm-Message-State: APjAAAUfu/wXlzDs9PGyez2+7OTMsvvx9HMFzkQTjuju7UGw2RyFKkzE gtGAXRjXlrV+CbmNbEb36BhqfA== X-Received: by 2002:a5d:408e:: with SMTP id o14mr12597110wrp.318.1556642652888; Tue, 30 Apr 2019 09:44:12 -0700 (PDT) Received: from andrea ([37.227.24.188]) by smtp.gmail.com with ESMTPSA id z15sm26391666wrv.80.2019.04.30.09.44.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Apr 2019 09:44:11 -0700 (PDT) Date: Tue, 30 Apr 2019 18:44:04 +0200 From: Andrea Parri To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, "Paul E. McKenney" , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Jordan Crouse , Jens Axboe , Omar Sandoval , "Yan, Zheng" , Sage Weil , Ilya Dryomov , Dennis Dalessandro , Mike Marciniszyn , Doug Ledford , Jason Gunthorpe Subject: Re: [PATCH 0/5] Fix improper uses of smp_mb__{before,after}_atomic() Message-ID: <20190430164404.GA2874@andrea> References: <1556568902-12464-1-git-send-email-andrea.parri@amarulasolutions.com> <20190430083409.GD2677@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190430083409.GD2677@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 30, 2019 at 10:34:09AM +0200, Peter Zijlstra wrote: > On Mon, Apr 29, 2019 at 10:14:56PM +0200, Andrea Parri wrote: > > Hello! > > > > A relatively common misuse of these barriers is to apply these to > > operations which are not read-modify-write operations, such as > > atomic_set() and atomic_read(); examples were discussed in [1]. > > > > This series attempts to fix those uses by (conservatively) replacing > > the smp_mb__{before,after}_atomic() barriers with full memory barriers. > > I don't think blindly doing this replacement makes the code any better; > much of the code you found is just straight up dodgy to begin with. > > I think the people should mostly just consider this a bug report. Bug, misuse, patch, and rfc seem all appropriate to me in this context. > Also, remember a memory barrier without a coherent comment is most > likely a bug anyway. Right. Hopefully, the people in Cc: will want to shed some light about this: I know what these smp_mb__{before,after}_atomic() can not do, but I can only guess (I won't!) what they are supposed to accomplish (e.g., which mem. accesses are being ordered, what are the matching barriers); maybe this can also justify the "conservative" approach presented here. Andrea