Received: by 10.223.185.116 with SMTP id b49csp7586140wrg; Thu, 1 Mar 2018 07:50:16 -0800 (PST) X-Google-Smtp-Source: AG47ELu+LiUIKxVeTS3q4/L0QyU8LyCKRiolZ8OYILKcBdwGCs0FQ/5rgq+Lcq6LEd4a+NhcDouv X-Received: by 10.101.99.17 with SMTP id g17mr1248799pgv.48.1519919416491; Thu, 01 Mar 2018 07:50:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519919416; cv=none; d=google.com; s=arc-20160816; b=Ub4NQ/hqw/he2Ai46BosmL+i2mn+h9HqIjPYaDQldth2WiE8NrVV82B9R67/e7LJZj iwdUWVgY/GDpOONU5gsZ+LByiQdJ2iznMU1a8k5/6aiszHWOE7R5yHS9MXNl+rYZ7kWV xsQYtcI+LTyjtgapy4a9HKl+ik2IBec0LFZPTjnQfY47+/a/JJswR0wAdfDTeQDa9Hoe PeaXJGdGExsyK/TCt1Pplw8P+nf9vhPhkeQ8qxpdeEk4+3R7p32xLji+uci/HSdSv7ry nsnL9deosi7WNt1GBgaQT1iVvDu3l79tcOeWTz5W1HZ8DX8UfTlJsZce+guwHa943dBf b3mg== 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=WPmky1abRKLAfB2Bv1JBLgokbF3lbv/jzmpIntydUfw=; b=t8nxg5JrJ/m4sMfn9Y6YCUfZPO4CL0i0Bc9RW8OHhXwftjjzZlKHfbQo2bDgUvGjEK mb0aVI6dtvi8akbNeFhmfjIQVpSDntrG1xsAhAQIGs0IDBLHQR8Ybazp/fMD3f76KZpi OPvMcXCQmnpwzYozW/FLOaSSOx0k2O8L7FAD+SfbbhRTV7sHyqVn9orSYXjeBpEU/Up7 6Uq9LZBh2ZK1s9K2Ohp64gsQ9WTVb+cuOuG3SlImmmMXTgrlDYYU+1miPrpoQXpsT1fI dMDv8XfaGzBYCPuJVnaCWXXI0zFhl67rLmpLu2Em0SXk4RJp9q1H8ZqeWc0sb8tHVrO9 us1Q== 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 m16-v6si3259494pls.471.2018.03.01.07.50.01; Thu, 01 Mar 2018 07:50:16 -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 S1032683AbeCAPtH (ORCPT + 99 others); Thu, 1 Mar 2018 10:49:07 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:36020 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1031899AbeCAPtG (ORCPT ); Thu, 1 Mar 2018 10:49:06 -0500 Received: (qmail 12378 invoked by uid 2102); 1 Mar 2018 10:49:05 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 1 Mar 2018 10:49:05 -0500 Date: Thu, 1 Mar 2018 10:49:05 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Boqun Feng cc: LKMM Maintainers -- Akira Yokosawa , Andrea Parri , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , "Paul E. McKenney" , Peter Zijlstra , Will Deacon , Kernel development list Subject: Re: [PATCH 2/2 v2 RFC] tools/memory-model: redefine rb in terms of rcu-fence In-Reply-To: <20180301015531.olvuu5g35eta5xhr@tardis> 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 Thu, 1 Mar 2018, Boqun Feng wrote: > > +let rec rcu-fence = gp | > > + (gp ; rcu-link ; rscs) | > > + (rscs ; rcu-link ; gp) | > > + (gp ; rcu-link ; rcu-fence ; rcu-link ; rscs) | > > + (rscs ; rcu-link ; rcu-fence ; rcu-link ; gp) | > > + (rcu-fence ; rcu-link ; rcu-fence) > > + > > +(* rb orders instructions just as pb does *) > > +let rb = prop ; rcu-fence ; hb* ; pb* > > > > irreflexive rb as rcu > > I wonder whether we can simplify things as: > > let rec rcu-fence = > (gp; rcu-link; rscs) | > (rscs; rcu-link; gp) | > (gp; rcu-link; rcu-fence; rcu-link; rscs) | > (rscs; rcu-link; rcu-fence; rcu-link; gp) > > (* gp and rcu-fence; rcu-link; rcu-fence removed *) > > let rb = prop; rcu-fence; hb*; pb* > > acycle rb as rcu > > In this way, "rcu-fence" is defined as "any sequence containing as many > grace periods as RCU read-side critical sections (joined by rcu-link)." > Note that "rcu-link" contains "gp", so we don't miss the case where > there are more grace periods. And since we use "acycle" now, so we don't > need "rcu-fence; rcu-link; rcu-fence" to build "rcu-fence" recursively. Would this definition of rcu-fence work for a sequence such as (leaving out the intermediate rcu-link parts): gp gp gp rscs rscs gp rscs rscs ? I don't think it would. Yes, if you had a cycle of that form then your "rcu" axiom would detect it, but at some point we might want to use rcu-fence for some other purpose, one that doesn't involve cycles. > I prefer this because we already treat "gp" as "strong-fence", which > already is a "rcu-link". That's a good point; it had not occurred to me. > Also, recurisively extending rcu-fence with > itself is exactly calculating the transitive closure, which we can avoid > by using a "acycle" rule. Besides, it looks more consistent with hb and > pb. That _had_ occurred to me. But I couldn't see any way to do it while still defining rcu-fence correctly. Alan