lkml.org 
[lkml]   [2018]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH RFC tools/memory-model] Model effects of volatile on ctrl
This commit models the fact that compilers are not allowed to reorder
volatile accesses. This modeling is at best approximate, although it
does correctly handle C-RomanPenyaev-list-rcu-rr.litmus from the litmus
github archive. The approach is to extend control dependencies to
subsequent volatiles accesses.

Probable issues with this change:

1. It does not correctly handle the case of identical WRITE_ONCE()
invocations at the beginning of both legs of an "if" statement.
(Of course, the current state does not correctly handle this
either.)

2. It might not correctly handle the ARMv8 conditional-move instruction.

3. It is probably missing some handling of atomic RWM operations.

4. It does not insist that the initial ctrl dependency end in
a volatile access. This is not yet a problem because we
don't yet model unmarked accesses.

That said, this patch is not intended for inclusion, but rather in the
hope that it inspires someone to come up with something better.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/tools/memory-model/linux-kernel.cat b/tools/memory-model/linux-kernel.cat
index 882fc33274ac..f745337ba10e 100644
--- a/tools/memory-model/linux-kernel.cat
+++ b/tools/memory-model/linux-kernel.cat
@@ -57,7 +57,9 @@ empty rmw & (fre ; coe) as atomic

(* Preserved Program Order *)
let dep = addr | data
-let rwdep = (dep | ctrl) ; [W]
+let volatile = [Once] | [Release] | [Acquire] (* No unmarked accesses. *)
+let ctrl-volatile = ctrl ; (po ; volatile)*
+let rwdep = (dep | ctrl-volatile) ; [W]
let overwrite = co | fr
let to-w = rwdep | (overwrite & int)
let to-r = addr | (dep ; rfi)
\
 
 \ /
  Last update: 2018-07-17 19:08    [W:0.965 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site