Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7553669imu; Tue, 22 Jan 2019 07:49:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN7/tKNHrNGahaBAzemyyDYyc9RI/EEdqCnDBQFvt/21O0eRqLq7KIFYf98QdGGNIbuXd/Cr X-Received: by 2002:a63:2054:: with SMTP id r20mr32146898pgm.328.1548172175967; Tue, 22 Jan 2019 07:49:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548172175; cv=none; d=google.com; s=arc-20160816; b=EiUfHjSpDqFQzR2XwFlv/kwNlxgCmqUubvKTeG46kabetkQUpvbGua+lNjMa3aL4xq 5pMwCuSw/j3yW8tVkB5z0bqNKrEKism/2zF+JqgF4DbBnIioevDC03Y5jW4271Jg02kL ZmsHcxD/3O3wvPE7oLFOVD0EiF8xb9Ot0uluEA2oDB9gHYudlRu81LJB9ORR2cHd8947 Urf8J6WCeFj/2kXvOOsmg9G3P5RSuR3h2n1K0PYy4zh7uO/RsseKhEOrjIEx0oxNo29i Rd6TRJQo5W+6PJPswnfimelhY8Eaiabq7cOjdu3ZmD1YdUcdG2oZigC2jmCnsa1aOkPo 6u8Q== 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=lhZYksM32IlFxixTYjrl2i9XhZaAp6algMTzXFMI9Eo=; b=R94Ek6r3uqNC8gSE3wIyBGSnjwdyiz5imwdKLFlmxCEx+vkvTFHw0CIBp5wWkVNW+1 Q4z9UtsYrN2ACgsBkY+lla869dvxoAC1ep8ETT9PanCtVBhyM9ZKFI2CUIrF1GdzAtPn Bf1HkMvwpnVp86fx7Jp9JXV3kzJkP9n9IkfnO8esiFBRBBEwhaOF/woLPWNdLJ6Nyx1f 0ajczJZPO5yY2ZLUe794wpgAfJ4V9dxQF+uHZHV3UzfDkuv+4AtG+JKsoOH0g7abcBlj fUfWzj4pCxkpyCLaMZ9EyAjQWhly+8URBQpRWMm0krEyodqA3LeJ1h+Pdr/xLFLMOnrM Iivg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=dxqLeUxA; 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 t23si15967589pgi.181.2019.01.22.07.49.19; Tue, 22 Jan 2019 07:49:35 -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=@amarulasolutions.com header.s=google header.b=dxqLeUxA; 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 S1729128AbfAVPrz (ORCPT + 99 others); Tue, 22 Jan 2019 10:47:55 -0500 Received: from mail-ed1-f50.google.com ([209.85.208.50]:33244 "EHLO mail-ed1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728835AbfAVPrz (ORCPT ); Tue, 22 Jan 2019 10:47:55 -0500 Received: by mail-ed1-f50.google.com with SMTP id p6so19740062eds.0 for ; Tue, 22 Jan 2019 07:47:54 -0800 (PST) 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=lhZYksM32IlFxixTYjrl2i9XhZaAp6algMTzXFMI9Eo=; b=dxqLeUxASZfmHGOCc8ln7NwA3yWfuqW9Rb4AwNgkoUb+vnxnJhxxJzJtbPniOxEdiX xJJ755bkojqXl/bAcbGY6ydui++qfLVrmy3S3k30hyybTqyEuryBp6PnBfEzv1IN0jVE y0X03D0reMwsLy6ZbLPmsuMFTBXgMnCM+ulu0= 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=lhZYksM32IlFxixTYjrl2i9XhZaAp6algMTzXFMI9Eo=; b=ftbCjUZS9ISg0raFdWDXAw56DXdvoZlSQ5ykx/dA5T8tO6RVrSblwj1m83iGeMZYBM uLTAcG+NLLOEg6tNXs1UeDsC0XBE6LslHVJ9yMa1eSUQC2iZCuLI21VW4mWhlZ+43wvn TIcag4TXeyfhkTLwjd9CMiBh6rUSVTePGZIAQhIOcZQFoLNGEQhXPLCdb9N+d8P8AUEe JkFfKKEV27+hlkFNJSbh4hHQBYwQfliew2u/ujzCrOnTxrTb9yGAX19i5wnnREjftQ8Q hR3/sIPU0JyNqs9zlTK2fIWVKgKkZR510VJAfYeouiwFuS9sKVoZEV8pVEolj4hG0ZMA dQqw== X-Gm-Message-State: AJcUukdX7WzGkhzNqvyNpDAS7hb56FZVeuJ8fXcTozdwdDY9pAqT9pMY 4/YaEu9uhWWqsvd1TiOyYWa5pA== X-Received: by 2002:a50:8bc9:: with SMTP id n9mr31645388edn.41.1548172073180; Tue, 22 Jan 2019 07:47:53 -0800 (PST) Received: from andrea (85.100.broadband17.iol.cz. [109.80.100.85]) by smtp.gmail.com with ESMTPSA id d27-v6sm5291043eja.20.2019.01.22.07.47.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Jan 2019 07:47:52 -0800 (PST) Date: Tue, 22 Jan 2019 16:47:45 +0100 From: Andrea Parri To: Alan Stern Cc: LKMM Maintainers -- Akira Yokosawa , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , "Paul E. McKenney" , Peter Zijlstra , Will Deacon , Dmitry Vyukov , linux-kernel@vger.kernel.org Subject: Re: Plain accesses and data races in the Linux Kernel Memory Model Message-ID: <20190122154745.GA13659@andrea> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 > @@ -131,7 +159,7 @@ let rec rcu-fence = rcu-gp | srcu-gp | > (rcu-fence ; rcu-link ; rcu-fence) > > (* rb orders instructions just as pb does *) > -let rb = prop ; po ; rcu-fence ; po? ; hb* ; pb* > +let rb = prop ; po ; rcu-fence ; po? ; hb* ; pb* ; [marked] Testing has revealed some subtle semantics changes for some RCU tests _without_ unmarked memory accesses; an example is reported at the end of this email. I suspect that the improvements you mentioned in this thread can restore the original semantics but I'm reporting this here for further reference. With the above definition of 'rb', we're losing links which originate or target RCU fences, so that this definition is in fact a relaxation w.r.t. the current semantics (even when limiting to marked accesses). The test below, for example, is currently forbidden by the LKMM, but it becomes allowed with this patch. FWIW, I checked that including the RCU fences in 'marked' can restore the original semantics of these tests; I'm still not sure whether this change can make sense though.... Thoughts? Oh, one last (and unrelated) nit before I forget: IIUC, we used to upper-case set names, so I'd also suggest s/marked/Marked, s/plain/Plain and similarly for the other sets to be introduced. Andrea C sync-rcu-is-not-idempotent { } P0(int *x, int *y) { int r0; WRITE_ONCE(*x, 1); synchronize_rcu(); synchronize_rcu(); r0 = READ_ONCE(*y); } P1(int *y, int *z) { int r0; rcu_read_lock(); WRITE_ONCE(*y, 1); r0 = READ_ONCE(*z); rcu_read_unlock(); } P2(int *z, int *x) { int r0; rcu_read_lock(); WRITE_ONCE(*z, 1); r0 = READ_ONCE(*x); rcu_read_unlock(); } exists (0:r0=0 /\ 1:r0=0 /\ 2:r0=0) > > irreflexive rb as rcu >