Received: by 10.223.185.116 with SMTP id b49csp3998610wrg; Mon, 19 Feb 2018 09:17:29 -0800 (PST) X-Google-Smtp-Source: AH8x2261lHF0Difsbm9E0JcveKmXb1btmNpmOh6Pp6pLQibGZSmyDRFjD8jYRW5F2ooM4F3KCzP6 X-Received: by 10.99.42.17 with SMTP id q17mr3033690pgq.6.1519060649706; Mon, 19 Feb 2018 09:17:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519060649; cv=none; d=google.com; s=arc-20160816; b=gdqJc1L9+c7jd0w9bzhe4zvojnelfRjHmHwZXKakIvYpK+nyVtkNxabGF7vi7q17Sl t6GB5V4SrOYqmxvWYUG7fffATuwqbX6/EeVN+twYznIgnDbaCoJX5g//aBjl1lhRoV9A UXPIafWKifpDAbyNfsSN3a9HdVsz63crvt5I5zVeDQD+Elwj3OQdFiaClx+VmM4CvYbt v4OWV6lXO0raf9NrNjzx/SNdZ6GXGmPyozCLXVm0zXI2F0OYuTKmBGUsqUchsw32E6+S 9i7I7qqPecW3rDqyE1Eileot6j56FTPXuUfBA11Fo+eS17/uX4pTrzyCBW8jCsKZs3E1 Kmuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date:arc-authentication-results; bh=rVtwaKk7RHcEWJPxOKs4STK8dtnYnv6/YG0YjVbKF0Y=; b=0br+UFi39Rx/ogC7vs0+3ZDgtYq1AUZtAtD4p+LYbLtwtdhm0cqI6yf7kcBLXPYwMR DmzABb92BYxEz2dGeUu1DHGyVVIi7nHMI8rYDhJFxp+mco2VxrAhyZh/+qsaEUGpjUJv XJLNFKiJdyyLEjpv3Rg3xJYJ15fH0gnuRN82XxOGUa9wXDKYrCp3UBu7D/lqNTx7l24G D9MQDHtQ8+3CFFbXWXnRtDcb5hCB496+IJmraxF5PTho7EKVBNXjDVjWDMJZHijdKGvS pPqzUJipHaAvHwtfd1L0W9DQGiEDtvN1mh8Va2c+JMeN18G6ggeyFL72itxZog7nrebn Jl0Q== ARC-Authentication-Results: i=1; mx.google.com; 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 w12si8282109pgr.211.2018.02.19.09.17.15; Mon, 19 Feb 2018 09:17:29 -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; 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 S1753471AbeBSRPE (ORCPT + 99 others); Mon, 19 Feb 2018 12:15:04 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:33116 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753265AbeBSROq (ORCPT ); Mon, 19 Feb 2018 12:14:46 -0500 Received: (qmail 3796 invoked by uid 2102); 19 Feb 2018 12:14:45 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 19 Feb 2018 12:14:45 -0500 Date: Mon, 19 Feb 2018 12:14:45 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Andrea Parri cc: "Paul E. McKenney" , Akira Yokosawa , Kernel development list , , Will Deacon , , , , , Jade Alglave , Luc Maranget , Patrick Bellasi Subject: Re: [PATCH] tools/memory-model: remove rb-dep, smp_read_barrier_depends, and lockless_dereference In-Reply-To: <20180217151413.GA3785@andrea> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 17 Feb 2018, Andrea Parri wrote: > > Akira's observation about READ_ONCE extends to all (annotated) loads. In > > fact, it also applies to loads corresponding to unsuccessful RMW operations; > > consider, for example, the following variation of MP+onceassign+derefonce: > > > > C T > > > > { > > y=z; > > z=0; > > } > > > > P0(int *x, int **y) > > { > > WRITE_ONCE(*x, 1); > > smp_store_release(y, x); > > } > > > > P1(int **y, int *z) > > { > > int *r0; > > int r1; > > > > r0 = cmpxchg_relaxed(y, z, z); > > r1 = READ_ONCE(*r0); > > } > > > > exists (1:r0=x /\ 1:r1=0) > > > > The final state is allowed w/o the patch, and forbidden w/ the patch. > > > > This also reminds me of > > > > 5a8897cc7631fa544d079c443800f4420d1b173f > > ("locking/atomics/alpha: Add smp_read_barrier_depends() to _release()/_relaxed() atomics") > > > > (that we probably want to mention in the commit message). > > Please also notice that 5a8897cc7631f only touched alpha's atomic.h: > I see no corresponding commit/change on {,cmp}xchg.h (where the "mb" > is currently conditionally executed). This leaves us with a question: Do we want to change the kernel by adding memory barriers after unsuccessful RMW operations on Alpha, or do we want to change the model by excluding such operations from address dependencies? Note that operations like atomic_add_unless() already include memory barriers. Alan