New locking test for the paulmckrcu/litmus github archive
From: Alan Stern
Date: Wed Jun 05 2024 - 10:47:19 EST
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)