diff options
| author | Ingo Molnar <mingo@kernel.org> | 2018-04-05 09:20:34 +0200 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2018-04-05 09:20:34 +0200 |
| commit | ea2a6af517714c52a1209795a03e863e96b460bb (patch) | |
| tree | 3bd443bc9b23ceeaf3743eaf2d6d35ec63c620c9 /tools/memory-model/linux-kernel.bell | |
| parent | 1b5d43cfb69759d8ef8d30469cea31d0c037aed5 (diff) | |
| parent | 642e7fd23353e22290e3d51719fcb658dc252342 (diff) | |
Merge branch 'linus' into sched/urgent, to pick up fixes and updates
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/memory-model/linux-kernel.bell')
| -rw-r--r-- | tools/memory-model/linux-kernel.bell | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tools/memory-model/linux-kernel.bell b/tools/memory-model/linux-kernel.bell new file mode 100644 index 000000000000..432c7cf71b23 --- /dev/null +++ b/tools/memory-model/linux-kernel.bell @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0+ +(* + * Copyright (C) 2015 Jade Alglave <j.alglave@ucl.ac.uk>, + * Copyright (C) 2016 Luc Maranget <luc.maranget@inria.fr> for Inria + * Copyright (C) 2017 Alan Stern <stern@rowland.harvard.edu>, + * Andrea Parri <parri.andrea@gmail.com> + * + * An earlier version of this file appears in the companion webpage for + * "Frightening small children and disconcerting grown-ups: Concurrency + * in the Linux kernel" by Alglave, Maranget, McKenney, Parri, and Stern, + * which is to appear in ASPLOS 2018. + *) + +"Linux-kernel memory consistency model" + +enum Accesses = 'once (*READ_ONCE,WRITE_ONCE,ACCESS_ONCE*) || + 'release (*smp_store_release*) || + 'acquire (*smp_load_acquire*) || + 'noreturn (* R of non-return RMW *) +instructions R[{'once,'acquire,'noreturn}] +instructions W[{'once,'release}] +instructions RMW[{'once,'acquire,'release}] + +enum Barriers = 'wmb (*smp_wmb*) || + 'rmb (*smp_rmb*) || + 'mb (*smp_mb*) || + 'rcu-lock (*rcu_read_lock*) || + 'rcu-unlock (*rcu_read_unlock*) || + 'sync-rcu (*synchronize_rcu*) || + 'before-atomic (*smp_mb__before_atomic*) || + 'after-atomic (*smp_mb__after_atomic*) || + 'after-spinlock (*smp_mb__after_spinlock*) +instructions F[Barriers] + +(* Compute matching pairs of nested Rcu-lock and Rcu-unlock *) +let matched = let rec + unmatched-locks = Rcu-lock \ domain(matched) + and unmatched-unlocks = Rcu-unlock \ range(matched) + and unmatched = unmatched-locks | unmatched-unlocks + and unmatched-po = [unmatched] ; po ; [unmatched] + and unmatched-locks-to-unlocks = + [unmatched-locks] ; po ; [unmatched-unlocks] + and matched = matched | (unmatched-locks-to-unlocks \ + (unmatched-po ; unmatched-po)) + in matched + +(* Validate nesting *) +flag ~empty Rcu-lock \ domain(matched) as unbalanced-rcu-locking +flag ~empty Rcu-unlock \ range(matched) as unbalanced-rcu-locking + +(* Outermost level of nesting only *) +let crit = matched \ (po^-1 ; matched ; po^-1) |
