aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-04 19:40:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-04 19:40:11 -0400
commit92400b8c8b42e53abb0fcb4ac75cb85d4177a891 (patch)
treeb6c7ef758d1c2b5e32e2483a0dbde7cd23a6d8a0
parent31a85cb35c82d686a95f903fdf9a346aba818290 (diff)
parent1b22fc609cecd1b16c4a015e1a6b3c9717484e3a (diff)
Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking updates from Ingo Molnar: - Lots of tidying up changes all across the map for Linux's formal memory/locking-model tooling, by Alan Stern, Akira Yokosawa, Andrea Parri, Paul E. McKenney and SeongJae Park. Notable changes beyond an overall update in the tooling itself is the tidying up of spin_is_locked() semantics, which spills over into the kernel proper as well. - qspinlock improvements: the locking algorithm now guarantees forward progress whereas the previous implementation in mainline could starve threads indefinitely in cmpxchg() loops. Also other related cleanups to the qspinlock code (Will Deacon) - misc smaller improvements, cleanups and fixes all across the locking subsystem * 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (51 commits) locking/rwsem: Simplify the is-owner-spinnable checks tools/memory-model: Add reference for 'Simplifying ARM concurrency' tools/memory-model: Update ASPLOS information MAINTAINERS, tools/memory-model: Update e-mail address for Andrea Parri tools/memory-model: Fix coding style in 'lock.cat' tools/memory-model: Remove out-of-date comments and code from lock.cat tools/memory-model: Improve mixed-access checking in lock.cat tools/memory-model: Improve comments in lock.cat tools/memory-model: Remove duplicated code from lock.cat tools/memory-model: Flag "cumulativity" and "propagation" tests tools/memory-model: Add model support for spin_is_locked() tools/memory-model: Add scripts to test memory model tools/memory-model: Fix coding style in 'linux-kernel.def' tools/memory-model: Model 'smp_store_mb()' tools/memory-order: Update the cheat-sheet to show that smp_mb__after_atomic() orders later RMW operations tools/memory-order: Improve key for SELF and SV tools/memory-model: Fix cheat sheet typo tools/memory-model: Update required version of herdtools7 tools/memory-model: Redefine rb in terms of rcu-fence tools/memory-model: Rename link and rcu-path to rcu-link and rb ...
-rw-r--r--Documentation/core-api/atomic_ops.rst13
-rw-r--r--Documentation/memory-barriers.txt17
-rw-r--r--Documentation/translations/ko_KR/memory-barriers.txt50
-rw-r--r--MAINTAINERS3
-rw-r--r--arch/arm64/include/asm/spinlock.h5
-rw-r--r--arch/x86/include/asm/qspinlock.h21
-rw-r--r--arch/x86/include/asm/qspinlock_paravirt.h3
-rw-r--r--include/asm-generic/atomic-long.h19
-rw-r--r--include/asm-generic/barrier.h27
-rw-r--r--include/asm-generic/qspinlock.h4
-rw-r--r--include/asm-generic/qspinlock_types.h32
-rw-r--r--include/linux/atomic.h2
-rw-r--r--include/linux/delayacct.h2
-rw-r--r--include/linux/mutex.h3
-rw-r--r--include/linux/spinlock.h18
-rw-r--r--kernel/delayacct.c17
-rw-r--r--kernel/locking/lockdep.c70
-rw-r--r--kernel/locking/mcs_spinlock.h10
-rw-r--r--kernel/locking/mutex.c3
-rw-r--r--kernel/locking/qspinlock.c247
-rw-r--r--kernel/locking/qspinlock_paravirt.h49
-rw-r--r--kernel/locking/qspinlock_stat.h9
-rw-r--r--kernel/locking/rwsem-xadd.c25
-rw-r--r--kernel/stop_machine.c24
-rw-r--r--tools/memory-model/Documentation/cheatsheet.txt7
-rw-r--r--tools/memory-model/Documentation/explanation.txt221
-rw-r--r--tools/memory-model/Documentation/references.txt17
-rw-r--r--tools/memory-model/README2
-rw-r--r--tools/memory-model/linux-kernel.bell4
-rw-r--r--tools/memory-model/linux-kernel.cat41
-rw-r--r--tools/memory-model/linux-kernel.def34
-rw-r--r--tools/memory-model/litmus-tests/.gitignore1
-rw-r--r--tools/memory-model/litmus-tests/IRIW+mbonceonces+OnceOnce.litmus2
-rw-r--r--tools/memory-model/litmus-tests/MP+polockmbonce+poacquiresilsil.litmus35
-rw-r--r--tools/memory-model/litmus-tests/MP+polockonce+poacquiresilsil.litmus34
-rw-r--r--tools/memory-model/litmus-tests/README19
-rw-r--r--tools/memory-model/litmus-tests/WRC+pooncerelease+rmbonceonce+Once.litmus4
-rw-r--r--tools/memory-model/lock.cat107
-rw-r--r--tools/memory-model/scripts/checkalllitmus.sh73
-rw-r--r--tools/memory-model/scripts/checklitmus.sh86
40 files changed, 875 insertions, 485 deletions
diff --git a/Documentation/core-api/atomic_ops.rst b/Documentation/core-api/atomic_ops.rst
index fce929144ccd..2e7165f86f55 100644
--- a/Documentation/core-api/atomic_ops.rst
+++ b/Documentation/core-api/atomic_ops.rst
@@ -111,7 +111,6 @@ If the compiler can prove that do_something() does not store to the
111variable a, then the compiler is within its rights transforming this to 111variable a, then the compiler is within its rights transforming this to
112the following:: 112the following::
113 113
114 tmp = a;
115 if (a > 0) 114 if (a > 0)
116 for (;;) 115 for (;;)
117 do_something(); 116 do_something();
@@ -119,7 +118,7 @@ the following::
119If you don't want the compiler to do this (and you probably don't), then 118If you don't want the compiler to do this (and you probably don't), then
120you should use something like the following:: 119you should use something like the following::
121 120
122 while (READ_ONCE(a) < 0) 121 while (READ_ONCE(a) > 0)
123 do_something(); 122 do_something();
124 123
125Alternatively, you could place a barrier() call in the loop. 124Alternatively, you could place a barrier() call in the loop.
@@ -467,10 +466,12 @@ Like the above, except that these routines return a boolean which
467indicates whether the changed bit was set _BEFORE_ the atomic bit 466indicates whether the changed bit was set _BEFORE_ the atomic bit
468operation. 467operation.
469 468
470WARNING! It is incredibly important that the value be a boolean, 469
471ie. "0" or "1". Do not try to be fancy and save a few instructions by 470.. warning::
472declaring the above to return "long" and just returning something like 471 It is incredibly important that the value be a boolean, ie. "0" or "1".
473"old_val & mask" because that will not work. 472 Do not try to be fancy and save a few instructions by declaring the
473 above to return "long" and just returning something like "old_val &
474 mask" because that will not work.
474 475
475For one thing, this return value gets truncated to int in many code 476For one thing, this return value gets truncated to int in many code
476paths using these interfaces, so on 64-bit if the bit is set in the 477paths using these interfaces, so on 64-bit if the bit is set in the
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index 33b8bc9573f8..a02d6bbfc9d0 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -1920,9 +1920,6 @@ There are some more advanced barrier functions:
1920 /* assign ownership */ 1920 /* assign ownership */
1921 desc->status = DEVICE_OWN; 1921 desc->status = DEVICE_OWN;
1922 1922
1923 /* force memory to sync before notifying device via MMIO */
1924 wmb();
1925
1926 /* notify device of new descriptors */ 1923 /* notify device of new descriptors */
1927 writel(DESC_NOTIFY, doorbell); 1924 writel(DESC_NOTIFY, doorbell);
1928 } 1925 }
@@ -1930,11 +1927,15 @@ There are some more advanced barrier functions:
1930 The dma_rmb() allows us guarantee the device has released ownership 1927 The dma_rmb() allows us guarantee the device has released ownership
1931 before we read the data from the descriptor, and the dma_wmb() allows 1928 before we read the data from the descriptor, and the dma_wmb() allows
1932 us to guarantee the data is written to the descriptor before the device 1929 us to guarantee the data is written to the descriptor before the device
1933 can see it now has ownership. The wmb() is needed to guarantee that the 1930 can see it now has ownership. Note that, when using writel(), a prior
1934 cache coherent memory writes have completed before attempting a write to 1931 wmb() is not needed to guarantee that the cache coherent memory writes
1935 the cache incoherent MMIO region. 1932 have completed before writing to the MMIO region. The cheaper
1936 1933 writel_relaxed() does not provide this guarantee and must not be used
1937 See Documentation/DMA-API.txt for more information on consistent memory. 1934 here.
1935
1936 See the subsection "Kernel I/O barrier effects" for more information on
1937 relaxed I/O accessors and the Documentation/DMA-API.txt file for more
1938 information on consistent memory.
1938 1939
1939 1940
1940MMIO WRITE BARRIER 1941MMIO WRITE BARRIER
diff --git a/Documentation/translations/ko_KR/memory-barriers.txt b/Documentation/translations/ko_KR/memory-barriers.txt
index 2ec5fe0c9cf4..921739d00f69 100644
--- a/Documentation/translations/ko_KR/memory-barriers.txt
+++ b/Documentation/translations/ko_KR/memory-barriers.txt
@@ -36,6 +36,9 @@ Documentation/memory-barriers.txt
36부분도 있고, 의도하진 않았지만 사람에 의해 쓰였다보니 불완전한 부분도 있습니다. 36부분도 있고, 의도하진 않았지만 사람에 의해 쓰였다보니 불완전한 부분도 있습니다.
37이 문서는 리눅스에서 제공하는 다양한 메모리 배리어들을 사용하기 위한 37이 문서는 리눅스에서 제공하는 다양한 메모리 배리어들을 사용하기 위한
38안내서입니다만, 뭔가 이상하다 싶으면 (그런게 많을 겁니다) 질문을 부탁드립니다. 38안내서입니다만, 뭔가 이상하다 싶으면 (그런게 많을 겁니다) 질문을 부탁드립니다.
39일부 이상한 점들은 공식적인 메모리 일관성 모델과 tools/memory-model/ 에 있는
40관련 문서를 참고해서 해결될 수 있을 겁니다. 그러나, 이 메모리 모델조차도 그
41관리자들의 의견의 집합으로 봐야지, 절대 옳은 예언자로 신봉해선 안될 겁니다.
39 42
40다시 말하지만, 이 문서는 리눅스가 하드웨어에 기대하는 사항에 대한 명세서가 43다시 말하지만, 이 문서는 리눅스가 하드웨어에 기대하는 사항에 대한 명세서가
41아닙니다. 44아닙니다.
@@ -77,7 +80,7 @@ Documentation/memory-barriers.txt
77 80
78 - 메모리 배리어의 종류. 81 - 메모리 배리어의 종류.
79 - 메모리 배리어에 대해 가정해선 안될 것. 82 - 메모리 배리어에 대해 가정해선 안될 것.
80 - 데이터 의존성 배리어. 83 - 데이터 의존성 배리어 (역사적).
81 - 컨트롤 의존성. 84 - 컨트롤 의존성.
82 - SMP 배리어 짝맞추기. 85 - SMP 배리어 짝맞추기.
83 - 메모리 배리어 시퀀스의 예. 86 - 메모리 배리어 시퀀스의 예.
@@ -255,17 +258,20 @@ CPU 에게 기대할 수 있는 최소한의 보장사항 몇가지가 있습니
255 (*) 어떤 CPU 든, 의존성이 존재하는 메모리 액세스들은 해당 CPU 자신에게 258 (*) 어떤 CPU 든, 의존성이 존재하는 메모리 액세스들은 해당 CPU 자신에게
256 있어서는 순서대로 메모리 시스템에 수행 요청됩니다. 즉, 다음에 대해서: 259 있어서는 순서대로 메모리 시스템에 수행 요청됩니다. 즉, 다음에 대해서:
257 260
258 Q = READ_ONCE(P); smp_read_barrier_depends(); D = READ_ONCE(*Q); 261 Q = READ_ONCE(P); D = READ_ONCE(*Q);
259 262
260 CPU 는 다음과 같은 메모리 오퍼레이션 시퀀스를 수행 요청합니다: 263 CPU 는 다음과 같은 메모리 오퍼레이션 시퀀스를 수행 요청합니다:
261 264
262 Q = LOAD P, D = LOAD *Q 265 Q = LOAD P, D = LOAD *Q
263 266
264 그리고 그 시퀀스 내에서의 순서는 항상 지켜집니다. 대부분의 시스템에서 267 그리고 그 시퀀스 내에서의 순서는 항상 지켜집니다. 하지만, DEC Alpha 에서
265 smp_read_barrier_depends() 는 아무일도 안하지만 DEC Alpha 에서는