Re: [PATCH kcsan 8/9] tools/memory-model: Document categories of ordering primitives

From: Akira Yokosawa
Date: Mon Aug 31 2020 - 18:34:30 EST


On Mon, 31 Aug 2020 11:20:36 -0700, paulmck@xxxxxxxxxx wrote:
> From: "Paul E. McKenney" <paulmck@xxxxxxxxxx>
>
> The Linux kernel has a number of categories of ordering primitives, which
> are recorded in the LKMM implementation and hinted at by cheatsheet.txt.
> But there is no overview of these categories, and such an overview
> is needed in order to understand multithreaded LKMM litmus tests.
> This commit therefore adds an ordering.txt as well as extracting a
> control-dependencies.txt from memory-barriers.txt. It also updates the
> README file.
>
> Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
> ---
> tools/memory-model/Documentation/README | 24 +-
> tools/memory-model/Documentation/ordering.txt | 462 ++++++++++++++++++++++++++
> tools/memory-model/control-dependencies.txt | 256 ++++++++++++++
> 3 files changed, 740 insertions(+), 2 deletions(-)
> create mode 100644 tools/memory-model/Documentation/ordering.txt
> create mode 100644 tools/memory-model/control-dependencies.txt

Hi Paul,

Didn't you mean to put control-dependencies.txt under tools/memory-model/Documentation/ ?

Thanks, Akira

>
> diff --git a/tools/memory-model/Documentation/README b/tools/memory-model/Documentation/README
> index 4326603..16177aa 100644
> --- a/tools/memory-model/Documentation/README
> +++ b/tools/memory-model/Documentation/README
> @@ -8,10 +8,19 @@ number of places.
>
> This document therefore describes a number of places to start reading
> the documentation in this directory, depending on what you know and what
> -you would like to learn:
> +you would like to learn. These are cumulative, that is, understanding
> +of the documents earlier in this list is required by the documents later
> +in this list.
>
> o You are new to Linux-kernel concurrency: simple.txt
>
> +o You have some background in Linux-kernel concurrency, and would
> + like an overview of the types of low-level concurrency primitives
> + that are provided: ordering.txt
> +
> + Here, "low level" means atomic operations to single locations in
> + memory.
> +
> o You are familiar with the concurrency facilities that you
> need, and just want to get started with LKMM litmus tests:
> litmus-tests.txt
> @@ -20,6 +29,9 @@ o You are familiar with Linux-kernel concurrency, and would
> like a detailed intuitive understanding of LKMM, including
> situations involving more than two threads: recipes.txt
>
> +o You would like a detailed understanding of what your compiler can
> + and cannot do to control dependencies: control-dependencies.txt
> +
> o You are familiar with Linux-kernel concurrency and the
> use of LKMM, and would like a cheat sheet to remind you
> of LKMM's guarantees: cheatsheet.txt
> @@ -37,12 +49,16 @@ o You are interested in the publications related to LKMM, including
> DESCRIPTION OF FILES
> ====================
>
> -Documentation/README
> +README
> This file.
>
> Documentation/cheatsheet.txt
> Quick-reference guide to the Linux-kernel memory model.
>
> +Documentation/control-dependencies.txt
> + A guide to preventing compiler optimizations from destroying
> + your control dependencies.
> +
> Documentation/explanation.txt
> Describes the memory model in detail.
[...]