Skip to contentSkip to conversation

tools/memory-model: Remove lock-final checking in lock.cat

PATCH In review Boqun Feng 2 participants 3 messages Feb 26, 2020

Subsystems (3)
lore
Share & tools
lore

Boqun Feng

author
#0 lore raw

PATCH 1/1 tools/memory-model: Remove lock-final checking in lock.cat

In commit 30b795df11a1 ("tools/memory-model: Improve mixed-access checking in lock.cat"), we have added the checking to disallow any normal memory access to lock variables, and this checking is stronger than lock-final. So remove the lock-final checking as it's unnecessary now.

---
 tools/memory-model/lock.cat | 3 ---
 1 file changed, 3 deletions(-)
tools/memory-model/lock.cat +0 -3
index 6b52f365d73a..827a3646607c 100644
@@ -54,9 +54,6 @@ flag ~empty LKR \ domain(lk-rmw) as unpaired-LKR
  *)
 empty ([LKW] ; po-loc ; [LKR]) \ (po-loc ; [UL] ; po-loc) as lock-nest
 
-(* The final value of a spinlock should not be tested *)
-flag ~empty [FW] ; loc ; [ALL-LOCKS] as lock-final
-
 (*
  * Put lock operations in their appropriate classes, but leave UL out of W
  * until after the co relation has been generated.
Signature · 1 line
2.25.0
maintainer
#1 lore raw
Quoted 5 lines · Boqun Feng

In commit 30b795df11a1 ("tools/memory-model: Improve mixed-access checking in lock.cat"), we have added the checking to disallow any normal memory access to lock variables, and this checking is stronger than lock-final. So remove the lock-final checking as it's unnecessary now.

I don't understand this description. Why do you say that the normal-access checking is stronger than the lock-final check?

Quoted 10 lines
---
 tools/memory-model/lock.cat | 3 ---
 1 file changed, 3 deletions(-)
tools/memory-model/lock.cat +0 -0
index 6b52f365d73a..827a3646607c 100644

tools/memory-model/lock.cat flag ~empty LKR \ domain(lk-rmw) as unpaired-LKR · line 59

Quoted 9 lines
tools/memory-model/lock.cat +0 -3
@@ -54,9 +54,6 @@ flag ~empty LKR \ domain(lk-rmw) as unpaired-LKR
  *)
 empty ([LKW] ; po-loc ; [LKR]) \ (po-loc ; [UL] ; po-loc) as lock-nest
 
-(* The final value of a spinlock should not be tested *)
-flag ~empty [FW] ; loc ; [ALL-LOCKS] as lock-final
-
 (*
  * Put lock operations in their appropriate classes, but leave UL out of W
  * until after the co relation has been generated.

With this check removed, what will prevent people from writing litmus tests like this?

C test

{
	spinlock_t s;
}

...

exists (s=0)

Alan

author
#2 lore raw
Quoted 24 lines · Alan Stern
Quoted 5 lines · Boqun Feng

In commit 30b795df11a1 ("tools/memory-model: Improve mixed-access checking in lock.cat"), we have added the checking to disallow any normal memory access to lock variables, and this checking is stronger than lock-final. So remove the lock-final checking as it's unnecessary now.

I don't understand this description. Why do you say that the normal-access checking is stronger than the lock-final check?

Quoted 13 lines
---
 tools/memory-model/lock.cat | 3 ---
 1 file changed, 3 deletions(-)
tools/memory-model/lock.cat +0 -0
index 6b52f365d73a..827a3646607c 100644
@@ -54,9 +54,6 @@ flag ~empty LKR \ domain(lk-rmw) as unpaired-LKR
  *)
 empty ([LKW] ; po-loc ; [LKR]) \ (po-loc ; [UL] ; po-loc) as lock-nest
 
Quoted 10 lines

tools/memory-model/lock.cat flag ~empty LKR \ domain(lk-rmw) as unpaired-LKR · line 59

Quoted 6 lines
tools/memory-model/lock.cat +0 -3
-(* The final value of a spinlock should not be tested *)
-flag ~empty [FW] ; loc ; [ALL-LOCKS] as lock-final
-
 (*
  * Put lock operations in their appropriate classes, but leave UL out of W
  * until after the co relation has been generated.

With this check removed, what will prevent people from writing litmus tests like this?

You are right, one thing I was missing is although FW is a subset of M, however FW & IW is not empty. Thanks! I will drop this.

Regards,
Boqun

Quoted 12 lines

C test

{
	spinlock_t s;
}

...

exists (s=0)

Alan