Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp614693imu; Fri, 16 Nov 2018 07:35:27 -0800 (PST) X-Google-Smtp-Source: AFSGD/X0cxlAR3fWgk6szcFYTui9PCcIC83ymulWJFgWNys6gErXMA5Qx3+UX1dI/cNQV4dnXj7v X-Received: by 2002:a17:902:887:: with SMTP id 7mr1416726pll.164.1542382526992; Fri, 16 Nov 2018 07:35:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542382526; cv=none; d=google.com; s=arc-20160816; b=KKVRXIBycl/8QV4w+Z3gZzaxOjjGTKHGmHfeBNEGToEyE7NHW0baTcM7rpZ+tscTb3 P0dT6lJZ67zC9zONot+KkGHHovAbB42lz0zFdJgtt9txgzS/okF/f7eAGO3oRQFHgoht Nwi+0pVo4gcrl77g1EnGAlPk6V0TX7f9Ug9lQVH6RiGxCrpQx3iDGwwzMndPDMqwwYG5 ACtIc5cUE88bgFXBHTqkZVYVqZvTzMKpzMIJZYJ7C6l1E1f3pg9wTxirYt1JX4sMeIaF XgTLLDGTqF/e7EaERBydFJ6SUcHT0gHka7l1I859c4SWYOcISY5akImVdAG2zMWVFJy5 8/XQ== 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; bh=wBo+wYOTULucl3r2fXh1ID4kgkH0lWkzc8xtXE9ydSY=; b=tCqkWiG7ge0yth4puTKPshGJyQIT+wQ/KorFwm+HtKi6e8o2DPMxsVY10HVtMJJNVb Hhz/oU8GAU5oX80hv0RyZiYSrlVRE0VHnHZgS3d20lKjjlAtqbY8Bbl6y2s7CTodm+Gb LyvKO6iPQ0qj2/iAeOr8TEJEYnewF7zlGcspPNlD98TBzsGTIYUxrIUtZakYhhC7ug2C KTW5PMPoq3jzXV35ji1FzMtrRdOUXn4JWRKT2sw9+VxPb1ZwTUSIR3sJ5JutT+2i3x8k hHlmvBt8Al7v4THiLqi+9EJhEEb+tMVKVglTiKVNget+qDH9ZslS2rKLNdAHi7IATeXZ U2pA== 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 x9si31992885pge.76.2018.11.16.07.35.11; Fri, 16 Nov 2018 07:35:26 -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 S1728483AbeKQBr0 (ORCPT + 99 others); Fri, 16 Nov 2018 20:47:26 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:34450 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728169AbeKQBrZ (ORCPT ); Fri, 16 Nov 2018 20:47:25 -0500 Received: (qmail 1692 invoked by uid 2102); 16 Nov 2018 10:34:34 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 16 Nov 2018 10:34:34 -0500 Date: Fri, 16 Nov 2018 10:34:34 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: "Paul E. McKenney" cc: LKMM Maintainers -- Akira Yokosawa , Andrea Parri , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , Peter Zijlstra , Will Deacon , Kernel development list Subject: Re: [PATCH 0/3] tools/memory-model: Add SRCU support In-Reply-To: <20181116064310.GU4170@linux.ibm.com> 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, 15 Nov 2018, Paul E. McKenney wrote: > On Thu, Nov 15, 2018 at 11:19:24AM -0500, Alan Stern wrote: > > Paul and other LKMM maintainers: > > > > The following series of patches adds support for SRCU to the Linux > > Kernel Memory Model. That is, it adds the srcu_read_lock(), > > srcu_read_unlock(), and synchronize_srcu() primitives to the model. > > > > Patch 1/3 does some renaming of the RCU parts of the > > memory model's existing CAT code, to help distinguish them > > from the upcoming SRCU parts. > > > > Patch 2/3 refactors the definitions of some RCU relations > > in the CAT code, in a way that the SRCU portions will need. > > > > Patch 3/3 actually adds the SRCU support. > > > > This new code requires herd7 version 7.51+4(dev) or later (now > > available in the herdtools7 github repository) to run. Thanks to Luc > > for making the necessary changes to support SRCU. > > These patches pass the tests that I have constructed, and also regression > tests, very nice! Applied and pushed, thank you. > > > The code does not check that the index argument passed to > > srcu_read_unlock() is the same as the value returned by the > > corresponding srcu_read_lock() call. This is deemed to be a semantic > > issue, not directly relevant to the memory model. > > Agreed. > > If I understand correctly, there are in theory some use cases that these > patches do not support, for example: > > r1 = srcu_read_lock(a); > do_1(); > r2 = srcu_read_lock(a); > do_2(); > srcu_read_unlock(a, r1); > do_3(); > srcu_read_unlock(a, r2); Yes, this sort of thing will be misinterpreted as two nested critical sections rather than two overlapping critical sections. > In practice, I would be more worried about this had I ever managed to > find a non-bogus use case for this pattern. ;-) The example is also a little difficult for humans to follow, at least without an explanatory comment. Alan