Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp535198lqt; Thu, 6 Jun 2024 10:25:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXx687htQbb8i3NTBAzD9sp7L7lJDRt03F0tmf69q9yGl0TjP54Ud5RQWszMTSYkaKOZ+LMRPKbsOmielJPu9LIgP/GqcjI6J3mST4EWQ== X-Google-Smtp-Source: AGHT+IFjv5ss56uRFLo4aAXwviR0bZwtTonvl+xAlHm1a1aAJVYm04HD/dU9BMkxcn98aDOAZc9c X-Received: by 2002:a17:90a:9f95:b0:2bd:d2f9:c22a with SMTP id 98e67ed59e1d1-2c2bcc0ddf0mr180725a91.29.1717694723313; Thu, 06 Jun 2024 10:25:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717694723; cv=pass; d=google.com; s=arc-20160816; b=qwE6pjOR9y5f60mgmJN1F3F5zVxE/7/EihQUltXAZyuPd59Cj68gnkV/DFBwQA3SB+ ZGpyCm354374nUYsoe64evgkytx1CO06Osz+9bCZ6V820T4wapmZRTKFTjOBx5oqFV6H Q5dtm6vJAQdy0EfayZ3AMRN5Pq3evdzbXY61YhsVK8Nu8ejF9n7RkkaaIRl/vFuPEYAO 8VxoGk4xYsgbvoXXkqGDzOslPUpNgvj0ZzTUj8p0B2b1+YTsxSQncU9s4gnAVjpaxIjJ bhWMH2ai+9gAn+NderwZWLNwZ1j1YBj3UwhUNP4gQTx4hMOrdRdLmc1Ta8C1GPSVIZai SC5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=tn6YnWgmb7OFbbfQyk7e4ykQKQ2avn9/GIdCC7ERTZw=; fh=0zCIpKUUfXNR4vgEGKRVdryXrgfIVE1T7Yen7VUJyhA=; b=1Hndmo1MS8fwYclUGScZYwEIZRv7/7SZ+kOBBIj0qhOVdEDzCFZGSVdtZydmz9TXan aMaNtW4xiKXrmkurOjTJXzTbUf6n/7YASNBncDosbukA57H22wonYYuMc722EynfUyM+ VZblK2iYK4DGn9dnJfdxxG4epPZFOR9BRyiMbI5NpuFoHoQVTrCcFDk8vPKSt9T//Yre SH2nD0KcMludlMYERS+ybBVG6Q85OHVR/D1RlVajz8hkte6eWcet0d5q6In56ph1Z4kD vS+77d7QEztKTkzTuBp66LpfO4S9gxnrDUJ0+M6wfuxRIOYcRogmdoQriGN5tnN1mmzf pLwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=netrider.rowland.org); spf=pass (google.com: domain of linux-kernel+bounces-204790-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204790-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c2806d1b81si1906813a91.133.2024.06.06.10.25.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 10:25:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204790-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=netrider.rowland.org); spf=pass (google.com: domain of linux-kernel+bounces-204790-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204790-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 04A32288C17 for ; Thu, 6 Jun 2024 17:21:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B1E8A198E90; Thu, 6 Jun 2024 17:21:37 +0000 (UTC) Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by smtp.subspace.kernel.org (Postfix) with SMTP id 6F204266AB for ; Thu, 6 Jun 2024 17:21:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.131.102.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717694497; cv=none; b=eSLn5CTnCqTv9/k7+4fjXeI2TNrzgaYelx0FiqKDOiRPY7am9MOBJB/cOwqYM7W0LsZHfpEa2q0PMTQVGuzGOv6sFST5gUDB2uG+zaDMcg/DOikbgMYiR7qELWeTnZypiSl4MRWrPdBSaR97U1eZdKNSd2lj8Y3os/jWHiOi36c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717694497; c=relaxed/simple; bh=frS/UngMOUTMkvobfMhI/dDnG5z34IDT7+8i/Wni88Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uxskTRQpfEJbl6HlHY+iQRqJgHOjlJC3t0a8UvHn1KGDz3eOKZRvTTVU2B59E5brDahjWCTv0ZNnoMXAZLobDon7Llnf4U2ZMbTIUUwFdI2uk0wRGlqRZShMwtNqlb7to/U15k+5o9lz+d2O4cLSKeQNuEWp/FJFWiN9itXbhGc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=rowland.harvard.edu; spf=pass smtp.mailfrom=netrider.rowland.org; arc=none smtp.client-ip=192.131.102.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netrider.rowland.org Received: (qmail 13406 invoked by uid 1000); 6 Jun 2024 13:21:28 -0400 Date: Thu, 6 Jun 2024 13:21:28 -0400 From: Alan Stern To: "Paul E. McKenney" Cc: Andrea Parri , will@kernel.org, peterz@infradead.org, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, akiyks@gmail.com, dlustig@nvidia.com, joel@joelfernandes.org, linux-kernel@vger.kernel.org, hernan.poncedeleon@huaweicloud.com, jonas.oberhauser@huaweicloud.com Subject: Re: New locking test for the paulmckrcu/litmus github archive Message-ID: <26aa2333-5e54-4dcd-b6df-f8f8545b2672@rowland.harvard.edu> References: <1d175b42-84b4-4a48-b1fb-ab6fd3566f75@rowland.harvard.edu> <64d944ff-b609-4977-a491-91ffc199a4cd@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <64d944ff-b609-4977-a491-91ffc199a4cd@paulmck-laptop> On Thu, Jun 06, 2024 at 10:07:35AM -0700, Paul E. McKenney wrote: > On Wed, Jun 05, 2024 at 02:40:05PM -0400, Alan Stern wrote: > > On Wed, Jun 05, 2024 at 11:25:11AM -0700, Paul E. McKenney wrote: > > > Thank you both! > > > > > > I queued and pushed the following commit, please let me know if it > > > needs adjustment. > > > > > > Thanx, Paul > > > > > > ------------------------------------------------------------------------ > > > > > > commit fb65813a7a181cd86c50bb03f9df1f6a398fa22b > > > Author: Alan Stern > > > Date: Wed Jun 5 11:20:47 2024 -0700 > > > > > > manual/locked: Add single-threaded spin_is_locked() test > > > > > > This new litmus test demonstrates a bug in the current LKMM lock.cat file. > > > This bug results in the following output: > > > > > > Test CoWWW+sil-lock-sil-unlock-sil Allowed > > > States 0 > > > No > > > Witnesses > > > Positive: 0 Negative: 0 > > > Condition exists (0:r0=0 /\ 0:r1=1 /\ 0:r2=0) > > > Observation CoWWW+sil-lock-sil-unlock-sil Never 0 0 > > > Time CoWWW+sil-lock-sil-unlock-sil 0.01 > > > Hash=cf12d53b4d1afec2e46bf9886af219c8 > > > > > > This is consistent with a deadlock. After the fix, there should be one > > > execution that matches the "exists" clause, hence an "Always" result. > > > > The part about being consistent with a deadlock is not very important; > > I'd omit it. Also, the second sentence is ambiguous; change it to: > > Good point, the deadlock is irrelevant. If I want to make that point, > I can add a test that really does deadlock. ;-) > > > After the fix, there should be one execution that matches the > > "exists" clause and no executions that don't match, hence an > > "Always" result. > > I ended up with the following: > > This has no executions. After the fix, there is one execution > that matches the "exists" clause and no executions that do not > match, hence an "Always" result. > > The reason for explicitly stating "This has no executions" is that a > lot of people never have seen such a thing. Okay. Don't we already have a litmus test in the archive that really does create a deadlock? Something like: Lock Lock Unlock Unlock, all using the same lock variable? > > > diff --git a/manual/locked/CoWWW+sil-lock-sil-unlock-sil.litmus b/manual/locked/CoWWW+sil-lock-sil-unlock-sil.litmus > > > new file mode 100644 > > > index 00000000..cee5abf4 > > > --- /dev/null > > > +++ b/manual/locked/CoWWW+sil-lock-sil-unlock-sil.litmus > > > @@ -0,0 +1,24 @@ > > > +C CoWWW+sil-lock-sil-unlock-sil.litmus > > > > Where does the "CoWWW" part of the name come from? If it refers to > > coherence order and three writes, I'll point out that the litmus test > > contains only two writes -- which would better be described as a lock > > and an unlock. (Or are you counting the "write" that sets the lock's > > initial value?) > > The CoWWW comes from me having been confused. The new filename is > CoWW+sil-lock-sil-unlock-sil.litmus. Thank you for spotting this! All right, but what does the "CoWW" part stand for? > > > + > > > +(* > > > + * Result: Always > > > + * > > > + * This tests the memory model's implementation of spin_is_locked(). > > > + *) > > > + > > > +{} > > > + > > > +P0(spinlock_t *x) > > > +{ > > > + int r0; > > > > Oops! Apparently I managed not to convert the spaces on that line to a > > tab. Can you take care of that? > > Done! Please see below for the updated commit. > > Thanx, Paul > > ------------------------------------------------------------------------ > > commit d4d216a08b4bedb8cdb0f57a224a4e331b35b931 > Author: Alan Stern > Date: Wed Jun 5 11:20:47 2024 -0700 > > manual/locked: Add single-threaded spin_is_locked() test > > This new litmus test demonstrates a bug in the current LKMM lock.cat file. > This bug results in the following output: > > Test CoWW+sil-lock-sil-unlock-sil Allowed > States 0 > No > Witnesses > Positive: 0 Negative: 0 > Condition exists (0:r0=0 /\ 0:r1=1 /\ 0:r2=0) > Observation CoWWW+sil-lock-sil-unlock-sil Never 0 0 > Time CoWWW+sil-lock-sil-unlock-sil 0.01 Maybe you better re-run this with the updated litmus test file. Those two lines aren't right. Alan