linux/tools/memory-model/Documentation
Paul Heidekrüger fc13b47692 tools/memory-model: Weaken ctrl dependency definition in explanation.txt
The current informal control dependency definition in explanation.txt is
too broad and, as discussed, needs to be updated.

Consider the following example:

> if(READ_ONCE(x))
>   return 42;
>
> WRITE_ONCE(y, 42);
>
> return 21;

The read event determines whether the write event will be executed "at all"
- as per the current definition - but the formal LKMM does not recognize
this as a control dependency.

Introduce a new definition which includes the requirement for the second
memory access event to syntactically lie within the arm of a non-loop
conditional.

Link: https://lore.kernel.org/all/20220615114330.2573952-1-paul.heidekrueger@in.tum.de/
Cc: Marco Elver <elver@google.com>
Cc: Charalampos Mainas <charalampos.mainas@gmail.com>
Cc: Pramod Bhatotia <pramod.bhatotia@in.tum.de>
Cc: Soham Chakraborty <s.s.chakraborty@tudelft.nl>
Cc: Martin Fink <martin.fink@in.tum.de>
Co-developed-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Paul Heidekrüger <paul.heidekrueger@in.tum.de>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2022-10-18 15:14:52 -07:00
..
access-marking.txt tools/memory-model: Document data_race(READ_ONCE()) 2021-07-27 11:48:55 -07:00
cheatsheet.txt tools/memory-model: Expand the cheatsheet.txt notion of relaxed 2020-09-04 11:58:15 -07:00
control-dependencies.txt tools/memory-model: Document categories of ordering primitives 2020-11-06 17:24:50 -08:00
explanation.txt tools/memory-model: Weaken ctrl dependency definition in explanation.txt 2022-10-18 15:14:52 -07:00
glossary.txt doc: Update rcu_dereference.rst reference 2021-03-08 14:29:22 -08:00
litmus-tests.txt tools/memory-model: Clarify LKMM's limitations in litmus-tests.txt 2022-08-31 05:15:31 -07:00
ordering.txt tools/memory-model: Document categories of ordering primitives 2020-11-06 17:24:50 -08:00
README tools/memory-model: Document categories of ordering primitives 2020-11-06 17:24:50 -08:00
recipes.txt tools/memory-model: Update recipes.txt prime_numbers.c path 2020-09-03 09:51:00 -07:00
references.txt Replace HTTP links with HTTPS ones: LKMM 2020-09-03 09:51:00 -07:00
simple.txt tools/memory-model: Remove reference to atomic_ops.rst 2021-03-08 14:29:22 -08:00

It has been said that successful communication requires first identifying
what your audience knows and then building a bridge from their current
knowledge to what they need to know.  Unfortunately, the expected
Linux-kernel memory model (LKMM) audience might be anywhere from novice
to expert both in kernel hacking and in understanding LKMM.

This document therefore points out a number of places to start reading,
depending on what you know and what you would like to learn.  Please note
that the documents later in this list assume that the reader understands
the material provided by documents earlier 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 the Linux kernel provides:  ordering.txt

	Here, "low level" means atomic operations to single variables.

o	You are familiar with the Linux-kernel concurrency primitives
	that you need, and just want to get started with LKMM litmus
	tests:  litmus-tests.txt

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 quick reference:  cheatsheet.txt

o	You are familiar with Linux-kernel concurrency and the use
	of LKMM, and would like to learn about LKMM's requirements,
	rationale, and implementation:	explanation.txt

o	You are interested in the publications related to LKMM, including
	hardware manuals, academic literature, standards-committee
	working papers, and LWN articles:  references.txt


====================
DESCRIPTION OF FILES
====================

README
	This file.

cheatsheet.txt
	Quick-reference guide to the Linux-kernel memory model.

control-dependencies.txt
	Guide to preventing compiler optimizations from destroying
	your control dependencies.

explanation.txt
	Detailed description of the memory model.

litmus-tests.txt
	The format, features, capabilities, and limitations of the litmus
	tests that LKMM can evaluate.

ordering.txt
	Overview of the Linux kernel's low-level memory-ordering
	primitives by category.

recipes.txt
	Common memory-ordering patterns.

references.txt
	Background information.

simple.txt
	Starting point for someone new to Linux-kernel concurrency.
	And also a reminder of the simpler approaches to concurrency!