xref: /kernel/linux/linux-6.6/tools/memory-model/litmus-tests/SB+rfionceonce-poonceonces.litmus
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-6.6/tools/memory-model/litmus-tests/
162306a36Sopenharmony_ciC SB+rfionceonce-poonceonces
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci(*
462306a36Sopenharmony_ci * Result: Sometimes
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * This litmus test demonstrates that LKMM is not fully multicopy atomic.
762306a36Sopenharmony_ci *)
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci{}
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ciP0(int *x, int *y)
1262306a36Sopenharmony_ci{
1362306a36Sopenharmony_ci	int r1;
1462306a36Sopenharmony_ci	int r2;
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci	WRITE_ONCE(*x, 1);
1762306a36Sopenharmony_ci	r1 = READ_ONCE(*x);
1862306a36Sopenharmony_ci	r2 = READ_ONCE(*y);
1962306a36Sopenharmony_ci}
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciP1(int *x, int *y)
2262306a36Sopenharmony_ci{
2362306a36Sopenharmony_ci	int r3;
2462306a36Sopenharmony_ci	int r4;
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci	WRITE_ONCE(*y, 1);
2762306a36Sopenharmony_ci	r3 = READ_ONCE(*y);
2862306a36Sopenharmony_ci	r4 = READ_ONCE(*x);
2962306a36Sopenharmony_ci}
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_cilocations [0:r1; 1:r3; x; y] (* Debug aid: Print things not in "exists". *)
3262306a36Sopenharmony_ciexists (0:r2=0 /\ 1:r4=0)
33

Indexes created Thu Nov 07 10:32:03 CST 2024