Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1570455imu; Thu, 13 Dec 2018 18:28:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/XtPHymoEjoSoBBbyq34N9XsDK8846v7q0anFJnO2QN5U/UCqp0Q4d5Z9UhfiDrwoAKl1wL X-Received: by 2002:a17:902:9305:: with SMTP id bc5mr1227821plb.86.1544754481005; Thu, 13 Dec 2018 18:28:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544754480; cv=none; d=google.com; s=arc-20160816; b=TvqdzlwQ6mYP5KESqxqV+7B+0Y6AC7C59HRcsrVrnec0vo6aHuELcNNDm3oW6aDoKR rWxDTy310FiYclN+4hnOt5i2w2rLiv1Q/TRO1jOboommWLX52OnWUUnMJFYjbsdxyfKC 4KGLLOimrS63MpfjQ+6t8+hL16L6pk7zfK5KgaWzRqPVQ5rA1YEv7zuV1NchhFe1mG/Y CqodZaGrjmdb7EsTsuNhLeupVJgZ3YsDPMY9RHM3oCNf7A7h9zV0XsEfmyrkmRK8fe1K jKLdAMook04Th4YpKDX+XiQSTRINHMSHlGE/SP3ZNDTusP5vrWa61Kne5TrzaioY+URn 2gNw== 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=ryqhTTAUpu5DJIx8JQRrsB4rvQnklkalHZw4n8ybt3w=; b=S8+QEvDfK9PsghFmhXBUwwuiddQXZJo4kIoedlC6sY0xlvkiiqXT6EYwfA/7PeZWT9 kfMtNfwojanLwCDd7pCo5Fg9aHlCo4w9JkDJ7cJljZADsT81RQkwVlGq6E/CI/3Hvpnd h8owPNwSfFTxujExixMofR1u/ije0+jnIrOFRD1CmA08gkfAemLMfyvNa9qvR/rljWfI jAzI6mo5G6pgx+SY3ExHGloUSvVZ+IDU8m58QHFHQSPuqqvZ+B189MHMH49gUdXsLTyk vP3LWYle7UC1m7Z3qO7XWNyDRXdcmYbLNTcVjQfBPQCqAX2ZqPoQN221ELwFEWBLT0Mb hOIw== 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 l186si2891735pge.205.2018.12.13.18.27.45; Thu, 13 Dec 2018 18:28:00 -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 S1728952AbeLNC0s (ORCPT + 99 others); Thu, 13 Dec 2018 21:26:48 -0500 Received: from netrider.rowland.org ([192.131.102.5]:58087 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728517AbeLNC0s (ORCPT ); Thu, 13 Dec 2018 21:26:48 -0500 Received: (qmail 27930 invoked by uid 500); 13 Dec 2018 21:26:47 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 13 Dec 2018 21:26:47 -0500 Date: Thu, 13 Dec 2018 21:26:47 -0500 (EST) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: "Paul E. McKenney" cc: David Goldblatt , , Florian Weimer , , , , , , , , , , , , , , Subject: Re: [PATCH] Linux: Implement membarrier function In-Reply-To: <20181214002043.GP4170@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, 13 Dec 2018, Paul E. McKenney wrote: > > > A good next step would be to automatically generate random tests along > > > with an automatically generated prediction, like I did for RCU a few > > > years back. I should be able to generalize my time-based cheat for RCU to > > > also cover SRCU, though sys_membarrier() will require a bit more thought. > > > (The time-based cheat was to have fixed duration RCU grace periods and > > > RCU read-side critical sections, with the grace period duration being > > > slightly longer than that of the critical sections. The number of > > > processes is of course limited by the chosen durations, but that limit > > > can easily be made insanely large.) > > > > Imagine that each sys_membarrier call takes a fixed duration and each > > other instruction takes slightly less (the idea being that each > > instruction is a critical section). Instructions can be reordered > > (although not across a sys_membarrier call), but no matter how the > > reordering is done, the result is disallowed. This turns out not to be right. Instead, imagine that each sys_membarrier call takes a fixed duration, T. Other instructions can take arbitrary amounts of time and can be reordered abitrarily, with two restrictions: Instructions cannot be reordered past a sys_membarrier call; If instructions A and B are reordered then the time duration from B to A must be less than T. If you prefer, you can replace the second restriction with something a little more liberal: If A and B are reordered and A ends up executing after a sys_membarrier call (on any CPU) then B cannot execute before that sys_membarrier call. Of course, this form is a consequence of the more restrictive form. > It gets a bit trickier with interleavings of different combinations > of RCU, SRCU, and sys_membarrier(). Yes, your cat code very elegantly > sorts this out, but my goal is to be able to explain a given example > to someone. I don't think you're going to be able to fit different combinations of RCU, SRCU, and sys_membarrier into this picture. How would you allow tests with incorrect interleaving, such as GP - memb - RSCS - nothing, while forbidding similar tests with correct interleaving? Alan