Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp481427lqr; Wed, 5 Jun 2024 11:25:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX3KauurPTzmppO2F0OCeg189DP2IB9Vfhr7GRQA/V2QnsEgS1IDvMoYS3vsjtWq0Nicw1GPFZJX6QqzmUKF4RdcUWrVKXeOgVBX1b7tw== X-Google-Smtp-Source: AGHT+IF4xT5fxEKQ9K1rOWYS7i1y+N5nuDh4JFTxAdTMX5XwigtPnSBrMTn8a7v0iEO2Po4G5WMD X-Received: by 2002:aca:2405:0:b0:3d1:ff1d:400e with SMTP id 5614622812f47-3d20425e4bdmr3648698b6e.11.1717611919496; Wed, 05 Jun 2024 11:25:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717611919; cv=pass; d=google.com; s=arc-20160816; b=f97SenawpDsHMxCNH1Jgr+W+DsWba3GVHlOdpi3bL8wYho6PqGJMYa8IU7uNfCXfSF X71uRab3BDVcXKiSAdITHL8LomjoIiDYoBnf8YUGYiHfH0WQO3B0PF1D4WHZWYXJwd70 sMw3Pbe8iLXgOUVvAwDAx/jFlCk7ZMXx8bsvjmT26rzYYpiS+hhjAU5ev2N3eaPzOe// Ap885YuwB0jn8wJF4+Yrks2P3JcVuKypEzparQZNamVw4FVtnpObi/mwPZZxOajviacn J1e04jEGofEE5EYP43Q40e0mOxTccQV1iRcwaO1Ljcya45VPvJ4/AhC+gcjU78h7NaX6 2H7A== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=jutmJWSQh8Cme+iVj379E7ks0iz//Xu7RLLAoukaE8Y=; fh=QLH454h22Mwkg2VINqOwRlAZNmVQ+x6WDFIUHixW9QI=; b=tDDRBvkoTXki0zCuXs6xV+DrJfTpRW3a6kodiymH5a16D47m1fYZGwYXTAdMCLN7Ke NTkublyza5Y7mYvLyTc6o8Mlv+1ZU8n2Yv17ViEcDAyMwiWavRvF5KF7C8CsYlpylrZ6 FSu8AF56G8I0wSsKLBkj06jFx5HiwOe5NX5OtRf6n0ZK/9qg4coyBIsgks4kKPsK62b0 ik1lQp/sdK2EvPKVBjIp5u+HBGPOykY9nHJxVT7+qPj03p4rx6ATrVaiHKVIREjKTVt9 NeDfcOyDhoE2bxsMBLMwGPvVD6sCFaekMLb4JvLOtCvA2Gr5tkmcAfJVMYY/eobY6Haa RQJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hPH/7uys"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-203054-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203054-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-79524408c65si240963785a.502.2024.06.05.11.25.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 11:25:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203054-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hPH/7uys"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-203054-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203054-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0BA1F1C21A01 for ; Wed, 5 Jun 2024 18:25:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA824179B2; Wed, 5 Jun 2024 18:25:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hPH/7uys" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E724210A1F for ; Wed, 5 Jun 2024 18:25:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717611913; cv=none; b=DfRiAaxC3kUmFo/yA1GWNEMLzaSnl8zJbkoHoYcb1MFUCadM1Kd72IVmddP0TWT8jQvdy3prriOUOkejT0KZesAwATWUfVcMmQh4W5L6z0NYJTqfVPTWUZJeZ6p7BVEx4KdO5SKIw0ph7u7ReRROdFjGj9j42HAuVYStBIwslTE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717611913; c=relaxed/simple; bh=IMwUdBLrRm8LKyLiAuB6TGiaYLCpZWO3X31B4ozJMOQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qRvC4auiuZhG0hCfDxUeBzPzIEANXWq1AYy92sKoMFCIVaJmezKmj5rjM+5TBlHhCw4BkDaU+VZhpJxugxdMgxtSbpFRzMfLZYdQHyrXOIDk9eycSukxUrQ8WrrlhIYHrmQyQ6HbUxlzSy4tZS4wC6zae4gzXFiv/0shYtVmpSQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hPH/7uys; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 599EBC2BD11; Wed, 5 Jun 2024 18:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717611912; bh=IMwUdBLrRm8LKyLiAuB6TGiaYLCpZWO3X31B4ozJMOQ=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=hPH/7uysJHP2PVfKDxdgSwLfG83AKLjVkVrndzatKnrCpSP0QxttUizkTZhEpuiiN 1foUXN0cNAHkhcvrA1HQwUZ43w1icEpXyp+66TWusAHDquiwcPD55970f4TeQZfspS +bsCSOD25h//8JBSxL5n/CQf4aUga8tf4vDWCj26M+wgpj579GDhmhBKUrzfxOPRZ+ KbvZgmoBEMtPKAvV5BTf23yLX5ejqsPkHZPK5zaFWFKFdVaJIW+oq69xql1oXYG0Cj Tlbd0/qQPXF8td5+EXYX/WhsCw6Mbe9Mcq7AgcQ6ZMHOxLUrEnXiv2TAQPMujhSbpN I3B8BK2PMyh1A== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E68FBCE0A73; Wed, 5 Jun 2024 11:25:11 -0700 (PDT) Date: Wed, 5 Jun 2024 11:25:11 -0700 From: "Paul E. McKenney" To: Alan Stern 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: Reply-To: paulmck@kernel.org References: 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: On Wed, Jun 05, 2024 at 10:47:03AM -0400, Alan Stern wrote: > Paul: > > Below is a new litmus test for the manual/locked directory in your > github archive. It is based on a suggestion from Andrea Parri, and it > demonstrates a bug in the current LKMM lock.cat file. Patches to fix > that file will be sent shortly. > > Alan > > --- > > C islocked+lock+islocked+unlock+islocked.litmus > > (* > * Result: Always > * > * This tests the memory model's implementation of spin_is_locked(). > *) > > {} > > P0(spinlock_t *x) > { > int r0; > int r1; > int r2; > > r0 = spin_is_locked(x); > spin_lock(x); > r1 = spin_is_locked(x); > spin_unlock(x); > r2 = spin_is_locked(x); > } > > exists (0:r0=0 /\ 0:r1=1 /\ 0:r2=0) 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. Suggested-by: Andrea Parri Signed-off-by: Alan Stern Signed-off-by: Paul E. McKenney 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 + +(* + * Result: Always + * + * This tests the memory model's implementation of spin_is_locked(). + *) + +{} + +P0(spinlock_t *x) +{ + int r0; + int r1; + int r2; + + r0 = spin_is_locked(x); + spin_lock(x); + r1 = spin_is_locked(x); + spin_unlock(x); + r2 = spin_is_locked(x); +} + +exists (0:r0=0 /\ 0:r1=1 /\ 0:r2=0)