[PATCH tip/core/rcu 03/10] rculist: Add ASSERT_EXCLUSIVE_ACCESS() to __list_splice_init_rcu()

2020-06-22 Thread paulmck
From: "Paul E. McKenney" After the sync() in __list_splice_init_rcu(), there should be no readers traversing the old list. This commit therefore enlists the help of KCSAN to verify this condition via a pair of calls to ASSERT_EXCLUSIVE_ACCESS(). Signed-off-by: Paul E. McKenney Cc: Marco Elver

[PATCH tip/core/rcu 02/10] x86/mm/pat: Mark an intentional data race

2020-06-22 Thread paulmck
From: Qian Cai cpa_4k_install could be accessed concurrently as noticed by KCSAN, read to 0xaa59a000 of 8 bytes by interrupt on cpu 7: cpa_inc_4k_install arch/x86/mm/pat/set_memory.c:131 [inline] __change_page_attr+0x10cf/0x1840 arch/x86/mm/pat/set_memory.c:1514 __change_page_attr_set_cl

[PATCH tip/core/rcu 08/10] kcsan: Rename test.c to selftest.c

2020-06-22 Thread paulmck
From: Marco Elver Rename 'test.c' to 'selftest.c' to better reflect its purpose (Kconfig variable and code inside already match this). This is to avoid confusion with the test suite module in 'kcsan-test.c'. No functional change. Signed-off-by: Marco Elver Signed-off-by: Paul E. McKenney ---

[PATCH tip/core/rcu 23/23] rcutorture: Remove KCSAN stubs

2020-06-22 Thread paulmck
From: "Paul E. McKenney" KCSAN is now in mainline, so this commit removes the stubs for the data_race(), ASSERT_EXCLUSIVE_WRITER(), and ASSERT_EXCLUSIVE_ACCESS() macros. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 13 - 1 file changed, 13 deletions(-) diff --git

[PATCH tip/core/rcu 10/14] tools/memory-model: Fix reference to litmus test in recipes.txt

2020-06-22 Thread paulmck
From: Akira Yokosawa The name of litmus test doesn't match the one described below. Fix the name of litmus test. Acked-by: Andrea Parri Acked-by: Joel Fernandes (Google) Signed-off-by: Akira Yokosawa Signed-off-by: Paul E. McKenney --- tools/memory-model/Documentation/recipes.txt | 2 +- 1

[PATCH tip/core/rcu 02/14] tools/memory-model: Fix "conflict" definition

2020-06-22 Thread paulmck
From: Marco Elver The definition of "conflict" should not include the type of access nor whether the accesses are concurrent or not, which this patch addresses. The definition of "data race" remains unchanged. The definition of "conflict" as we know it and is cited by various papers on memory co

[PATCH tip/core/rcu 07/14] Documentation/litmus-tests: Introduce atomic directory

2020-06-22 Thread paulmck
From: Boqun Feng Although we have atomic_t.txt and its friends to describe the semantics of atomic APIs and lib/atomic64_test.c for build testing and testing in UP mode, the tests for our atomic APIs in real SMP mode are still missing. Since now we have the LKMM tool in kernel and litmus tests ca

[PATCH tip/core/rcu 14/14] docs: fix references for DMA*.txt files

2020-06-22 Thread paulmck
From: Mauro Carvalho Chehab As we moved those files to core-api, fix references to point to their newer locations. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Paul E. McKenney --- Documentation/memory-barriers.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git

[PATCH tip/core/rcu 03/14] Documentation: LKMM: Add litmus test for RCU GP guarantee where updater frees object

2020-06-22 Thread paulmck
From: "Joel Fernandes (Google)" This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period. Acked-by: Andrea Parri Signed-off-by: Joel Fernandes (Google) Signed-off-by: Paul E. McKenney --- .../litmus-tests/rcu/RCU+sync+free.lit

[PATCH tip/core/rcu 11/14] Documentation/litmus-tests: Merge atomic's README into top-level one

2020-06-22 Thread paulmck
From: Akira Yokosawa Where Documentation/litmus-tests/README lists RCU litmus tests, Documentation/litmus-tests/atomic/README lists atomic litmus tests. For symmetry, merge the latter into former, with some context adjustment in the introduction. Acked-by: Andrea Parri Acked-by: Joel Fernandes

[PATCH tip/core/rcu 04/14] Documentation: LKMM: Add litmus test for RCU GP guarantee where reader stores

2020-06-22 Thread paulmck
From: "Joel Fernandes (Google)" This adds an example for the important RCU grace period guarantee, which shows an RCU reader can never span a grace period. Acked-by: Andrea Parri Signed-off-by: Joel Fernandes (Google) Signed-off-by: Paul E. McKenney --- Documentation/litmus-tests/README

[PATCH tip/core/rcu 13/14] tools/memory-model/README: Expand dependency of klitmus7

2020-06-22 Thread paulmck
From: Akira Yokosawa klitmus7 is independent of the memory model but depends on the build-target kernel release. It occasionally lost compatibility due to kernel API changes [1, 2, 3]. It was remedied in a backwards-compatible manner respectively [4, 5, 6]. Reflect this fact in README. [1]: b89

[PATCH tip/core/rcu 09/14] Documentation/litmus-tests/atomic: Add a test for smp_mb__after_atomic()

2020-06-22 Thread paulmck
From: Boqun Feng We already use a litmus test in atomic_t.txt to describe atomic RMW + smp_mb__after_atomic() is stronger than acquire (both the read and the write parts are ordered). So make it a litmus test in atomic-tests directory, so that people can access the litmus easily. Additionally, c

[PATCH tip/core/rcu 06/14] tools/memory-model: Add an exception for limitations on _unless() family

2020-06-22 Thread paulmck
From: Boqun Feng According to Luc, atomic_add_unless() is directly provided by herd7, therefore it can be used in litmus tests. So change the limitation section in README to unlimit the use of atomic_add_unless(). Cc: Luc Maranget Acked-by: Andrea Parri Reviewed-by: Joel Fernandes (Google) Si

[PATCH tip/core/rcu 01/14] tools/memory-model: Add recent references

2020-06-22 Thread paulmck
t; Linux Weekly News. https://lwn.net/Articles/720550/ +o Jade Alglave, Luc Maranget, Paul E. McKenney, Andrea Parri, and + Alan Stern. 2017-2019. "A Formal Model of Linux-Kernel Memory + Ordering" (backup material for the LWN articles) + https://m

[PATCH tip/core/rcu 12/14] Documentation/litmus-tests: Cite an RCU litmus test

2020-06-22 Thread paulmck
From: "Joel Fernandes (Google)" This commit cites a pertinent RCU-related litmus test. Co-developed-by: Joel Fernandes (Google) Co-developed-by: Akira Yokosawa [Alan: grammar nit] [ paulmck: Update commit log and title per Akira feedback. ] Suggested-by: Alan Stern Signed-of

[PATCH tip/core/rcu 08/14] Documentation/litmus-tests/atomic: Add a test for atomic_set()

2020-06-22 Thread paulmck
From: Boqun Feng We already use a litmus test in atomic_t.txt to describe the behavior of an atomic_set() with the an atomic RMW, so add it into atomic-tests directory to make it easily accessible for anyone who cares about the semantics of our atomic APIs. Besides currently the litmus test "ato

[PATCH tip/core/rcu 05/14] MAINTAINERS: Update maintainers for new Documentation/litmus-tests

2020-06-22 Thread paulmck
From: "Joel Fernandes (Google)" This commit adds Joel Fernandes as official LKMM reviewer. Acked-by: Boqun Feng Acked-by: Andrea Parri Signed-off-by: Joel Fernandes (Google) [ paulmck: Apply Joe Perches alphabetization feedback. ] Signed-off-by: Paul E. McKenney --- MAINTAINERS

[PATCH tip/core/rcu 12/15] rcutorture: Cleanup PREEMPT_COUNT leftovers

2020-09-28 Thread paulmck
From: Thomas Gleixner CONFIG_PREEMPT_COUNT is now unconditionally enabled and will be removed. Cleanup the leftovers before doing so. Signed-off-by: Thomas Gleixner Cc: "Paul E. McKenney" Cc: Josh Triplett Cc: Steven Rostedt Cc: Mathieu Desnoyers Cc: Lai Jiangshan Cc: Shuah Khan Cc: r...@

[PATCH tip/core/rcu 14/15] rcu/tree: Allocate a page when caller is preemptible

2020-09-28 Thread paulmck
From: "Uladzislau Rezki (Sony)" The current memory-allocation interface poses the following challenges: a) In kernels built with CONFIG_PROVE_RAW_LOCK_NESTING, lockdep complains ("BUG: Invalid wait context"). This complaint is due to the memory allocator acquiring non-raw s

[PATCH tip/core/rcu 02/15] preempt: Make preempt count unconditional

2020-09-28 Thread paulmck
From: Thomas Gleixner The handling of preempt_count() is inconsistent across kernel configurations. On kernels which have PREEMPT_COUNT=n preempt_disable/enable() and the lock/unlock functions are not affecting the preempt count, only local_bh_disable/enable() and _bh variants of locking, soft in

[PATCH tip/core/rcu 03/15] preempt: Cleanup PREEMPT_COUNT leftovers

2020-09-28 Thread paulmck
From: Thomas Gleixner CONFIG_PREEMPT_COUNT is now unconditionally enabled and will be removed. Cleanup the leftovers before doing so. Signed-off-by: Thomas Gleixner Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Juri Lelli Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Steven Rostedt Cc: Ben Segall

[PATCH tip/core/rcu 09/15] ARM: Cleanup PREEMPT_COUNT leftovers

2020-09-28 Thread paulmck
From: Thomas Gleixner CONFIG_PREEMPT_COUNT is now unconditionally enabled and will be removed. Cleanup the leftovers before doing so. Signed-off-by: Thomas Gleixner Cc: Russell King Cc: linux-arm-ker...@lists.infradead.org Signed-off-by: Paul E. McKenney --- arch/arm/include/asm/assembler.h

[PATCH tip/core/rcu 05/15] mm/pagemap: Cleanup PREEMPT_COUNT leftovers

2020-09-28 Thread paulmck
From: Thomas Gleixner CONFIG_PREEMPT_COUNT is now unconditionally enabled and will be removed. Cleanup the leftovers before doing so. Signed-off-by: Thomas Gleixner Cc: Andrew Morton Cc: linux...@kvack.org [ paulmck: Fix !SMP build error per kernel test robot feedback. ] Signed-off-by: Paul E

[PATCH tip/core/rcu 04/15] lockdep: Cleanup PREEMPT_COUNT leftovers

2020-09-28 Thread paulmck
From: Thomas Gleixner CONFIG_PREEMPT_COUNT is now unconditionally enabled and will be removed. Cleanup the leftovers before doing so. Signed-off-by: Thomas Gleixner Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Will Deacon Acked-by: Will Deacon Signed-off-by: Paul E. McKenney --- include/linux/l

[PATCH tip/core/rcu 01/15] lib/debug: Remove pointless ARCH_NO_PREEMPT dependencies

2020-09-28 Thread paulmck
From: Thomas Gleixner ARCH_NO_PREEMPT disables the selection of CONFIG_PREEMPT_VOLUNTARY and CONFIG_PREEMPT, but architectures which set this config option still support preempt count for hard and softirq accounting. There is absolutely no reason to prevent lockdep from using the preempt counter

[PATCH tip/core/rcu 13/15] preempt: Remove PREEMPT_COUNT from Kconfig

2020-09-28 Thread paulmck
From: Thomas Gleixner All conditionals and irritations are gone. Signed-off-by: Thomas Gleixner Signed-off-by: Paul E. McKenney --- kernel/Kconfig.preempt | 3 --- 1 file changed, 3 deletions(-) diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt index 3f4712f..120b63f 100644 --- a/

[PATCH tip/core/rcu 10/15] xtensa: Cleanup PREEMPT_COUNT leftovers

2020-09-28 Thread paulmck
From: Thomas Gleixner CONFIG_PREEMPT_COUNT is now unconditionally enabled and will be removed. Cleanup the leftovers before doing so. Signed-off-by: Thomas Gleixner Cc: Chris Zankel Cc: Max Filippov Cc: linux-xte...@linux-xtensa.org Signed-off-by: Paul E. McKenney --- arch/xtensa/kernel/ent

[PATCH tip/core/rcu 15/15] kvfree_rcu(): Fix ifnullfree.cocci warnings

2020-09-28 Thread paulmck
From: kernel test robot NULL check before kfree is not needed. Generated by: scripts/coccinelle/free/ifnullfree.cocci Fixes: 9f7e887e648c ("rcu/tree: Allocate a page when caller is preemptible") Acked-by: Joel Fernandes (Google) Signed-off-by: kernel test robot Signed-off-by: Julia Lawall Si

[PATCH tip/core/rcu 06/15] locking/bitspinlock: Cleanup PREEMPT_COUNT leftovers

2020-09-28 Thread paulmck
From: Thomas Gleixner CONFIG_PREEMPT_COUNT is now unconditionally enabled and will be removed. Cleanup the leftovers before doing so. Signed-off-by: Thomas Gleixner Acked-by: Will Deacon Signed-off-by: Paul E. McKenney --- include/linux/bit_spinlock.h | 4 +--- 1 file changed, 1 insertion(+)

[PATCH tip/core/rcu 11/15] drm/i915: Cleanup PREEMPT_COUNT leftovers

2020-09-28 Thread paulmck
From: Thomas Gleixner CONFIG_PREEMPT_COUNT is now unconditionally enabled and will be removed. Cleanup the leftovers before doing so. Signed-off-by: Thomas Gleixner Cc: Jani Nikula Cc: Joonas Lahtinen Cc: Rodrigo Vivi Cc: David Airlie Cc: Daniel Vetter Cc: intel-...@lists.freedesktop.org C

[PATCH tip/core/rcu 07/15] uaccess: Cleanup PREEMPT_COUNT leftovers

2020-09-28 Thread paulmck
From: Thomas Gleixner CONFIG_PREEMPT_COUNT is now unconditionally enabled and will be removed. Cleanup the leftovers before doing so. Signed-off-by: Thomas Gleixner Signed-off-by: Paul E. McKenney --- include/linux/uaccess.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --

[PATCH tip/core/rcu 08/15] sched: Cleanup PREEMPT_COUNT leftovers

2020-09-28 Thread paulmck
From: Thomas Gleixner CONFIG_PREEMPT_COUNT is now unconditionally enabled and will be removed. Cleanup the leftovers before doing so. Signed-off-by: Thomas Gleixner Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Juri Lelli Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Steven Rostedt Cc: Ben Segall

[PATCH tip/core/rcu 1/3] docs: Fix typo in synchronize_rcu() function name

2020-08-31 Thread paulmck
From: Tobias Klauser s/sychronize_rcu/synchronize_rcu/ Signed-off-by: Tobias Klauser Signed-off-by: Paul E. McKenney --- Documentation/RCU/whatisRCU.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/RCU/whatisRCU.rst b/Documentation/RCU/whatisRCU.rst index

[PATCH tip/core/rcu 2/3] doc: Drop doubled words from RCU Data-Structures.rst

2020-08-31 Thread paulmck
From: Randy Dunlap Drop the doubled word "the". Signed-off-by: Randy Dunlap Cc: Jonathan Corbet Cc: linux-...@vger.kernel.org Cc: "Paul E. McKenney" Cc: Josh Triplett Cc: Steven Rostedt Cc: Mathieu Desnoyers Cc: Lai Jiangshan Cc: Joel Fernandes Cc: r...@vger.kernel.org Signed-off-by: Pau

[PATCH tip/core/rcu 3/3] doc: Drop doubled words from RCU requirements documentation

2020-08-31 Thread paulmck
From: Randy Dunlap Drop the doubled words "to" and "for". Signed-off-by: Randy Dunlap Cc: Jonathan Corbet Cc: linux-...@vger.kernel.org Cc: "Paul E. McKenney" Cc: Josh Triplett Cc: Steven Rostedt Cc: Mathieu Desnoyers Cc: Lai Jiangshan Cc: Joel Fernandes Cc: r...@vger.kernel.org Signed-o

[PATCH tip/core/rcu 11/24] rcu: Add READ_ONCE() to rcu_do_batch() access to rcu_divisor

2020-08-31 Thread paulmck
From: "Paul E. McKenney" Given that sysfs can change the value of rcu_divisor at any time, this commit adds a READ_ONCE to the sole access to that variable. While in the area, this commit also adds bounds checking, clamping the value to a shift that makes sense for a signed long. Signed-off-by:

[PATCH tip/core/rcu 08/24] rcu/tree: Force quiescent state on callback overload

2020-08-31 Thread paulmck
From: Neeraj Upadhyay On callback overload, it is necessary to quickly detect idle CPUs, and rcu_gp_fqs_check_wake() checks for this condition. Unfortunately, the code following the call to this function does not repeat this check, which means that in reality no actual quiescent-state forcing, i

[PATCH tip/core/rcu 19/24] rcu/nocb: Add a warning for non-GP kthread running GP code

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit increases RCU's ability to defend itself by emitting a warning if one of the nocb CB kthreads invokes the GP kthread's wait function. This warning augments a similar check that is carried out at the end of rcutorture testing and when RCU CPU stall warnings are

[PATCH tip/core/rcu 24/24] rcu: Shrink each possible cpu krcp

2020-08-31 Thread paulmck
From: Zqiang CPUs can go offline shortly after kfree_call_rcu() has been invoked, which can leave memory stranded until those CPUs come back online. This commit therefore drains the kcrp of each CPU, not just the ones that happen to be online. Acked-by: Joel Fernandes Signed-off-by: Zqiang Sig

[PATCH tip/core/rcu 21/24] rcu: Make FQS more aggressive in complaining about offline CPUs

2020-08-31 Thread paulmck
From: "Joel Fernandes (Google)" The RCU grace-period kthread's force-quiescent state (FQS) loop should never see an offline CPU that has not yet reported a quiescent state. After all, the offline CPU should have reported a quiescent state during the CPU-offline process, or, failing that, by rcu_g

[PATCH tip/core/rcu 13/24] rcu: Add READ_ONCE() to rcu_do_batch() access to rcu_kick_kthreads

2020-08-31 Thread paulmck
From: "Paul E. McKenney" Given that sysfs can change the value of rcu_kick_kthreads at any time, this commit adds a READ_ONCE() to the sole access to that variable. Signed-off-by: Paul E. McKenney --- kernel/rcu/tree_stall.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH tip/core/rcu 03/24] srcu: Remove KCSAN stubs

2020-08-31 Thread paulmck
From: "Paul E. McKenney" KCSAN is now in mainline, so this commit removes the stubs for the data_race(), ASSERT_EXCLUSIVE_WRITER(), and ASSERT_EXCLUSIVE_ACCESS() macros. Signed-off-by: Paul E. McKenney --- kernel/rcu/srcutree.c | 13 - 1 file changed, 13 deletions(-) diff --git a/

[PATCH tip/core/rcu 22/24] rcu: Remove unused __rcu_is_watching() function

2020-08-31 Thread paulmck
From: "Paul E. McKenney" The x86/entry work removed all uses of __rcu_is_watching(), therefore this commit removes it entirely. Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: Signed-off-by: Paul E. McKenney --- include/linux/rcutiny.h

[PATCH tip/core/rcu 23/24] rcu/segcblist: Prevent useless GP start if no CBs to accelerate

2020-08-31 Thread paulmck
-+-+ The reduction in the number of wakeups ranges from 5% to 40%. Cc: ure...@gmail.com [ paulmck: Rework commit log and comment. ] Signed-off-by: Joel Fernandes (Google) Signed-off-by: Paul E. McKenney --- kernel/rcu/rcu_segcblist.c | 10 +- 1 file changed, 9 insertion

[PATCH tip/core/rcu 18/24] rcu: Move rcu_cpu_started per-CPU variable to rcu_data

2020-08-31 Thread paulmck
From: "Paul E. McKenney" When the rcu_cpu_started per-CPU variable was added by commit f64c6013a202 ("rcu/x86: Provide early rcu_cpu_starting() callback"), there were multiple sets of per-CPU rcu_data structures. Therefore, the rcu_cpu_started flag was added as a separate per-CPU variable. But

[PATCH tip/core/rcu 02/24] rcu: Remove KCSAN stubs from update.c

2020-08-31 Thread paulmck
From: "Paul E. McKenney" KCSAN is now in mainline, so this commit removes the stubs for the data_race(), ASSERT_EXCLUSIVE_WRITER(), and ASSERT_EXCLUSIVE_ACCESS() macros. Signed-off-by: Paul E. McKenney --- kernel/rcu/update.c | 13 - 1 file changed, 13 deletions(-) diff --git a/ke

[PATCH tip/core/rcu 17/24] kvm: mmu: page_track: Fix RCU list API usage

2020-08-31 Thread paulmck
From: Madhuparna Bhowmik Use hlist_for_each_entry_srcu() instead of hlist_for_each_entry_rcu() as it also checkes if the right lock is held. Using hlist_for_each_entry_rcu() with a condition argument will not report the cases where a SRCU protected list is traversed using rcu_read_lock(). Hence,

[PATCH tip/core/rcu 04/24] rcu: Initialize at declaration time in rcu_exp_handler()

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit moves the initialization of the CONFIG_PREEMPT=n version of the rcu_exp_handler() function's rdp and rnp local variables into their respective declarations to save a couple lines of code. Signed-off-by: Paul E. McKenney --- kernel/rcu/tree_exp.h | 6 ++

[PATCH tip/core/rcu 14/24] rcu: Add READ_ONCE() to rcu_do_batch() access to rcu_cpu_stall_ftrace_dump

2020-08-31 Thread paulmck
From: "Paul E. McKenney" Given that sysfs can change the value of rcu_cpu_stall_ftrace_dump at any time, this commit adds a READ_ONCE() to the accesses to that variable. Signed-off-by: Paul E. McKenney --- kernel/rcu/tree_stall.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

[PATCH tip/core/rcu 09/24] rcu/tree: Remove CONFIG_PREMPT_RCU check in force_qs_rnp()

2020-08-31 Thread paulmck
From: Neeraj Upadhyay Originally, the call to rcu_preempt_blocked_readers_cgp() from force_qs_rnp() had to be conditioned on CONFIG_PREEMPT_RCU=y, as in commit a77da14ce9af ("rcu: Yet another fix for preemption and CPU hotplug"). However, there is now a CONFIG_PREEMPT_RCU=n definition of rcu_pre

[PATCH tip/core/rcu 15/24] rcu: Fix kerneldoc comments in rcupdate.h

2020-08-31 Thread paulmck
From: Tobias Klauser This commit fixes the kerneldoc comments for rcu_read_unlock_bh(), rcu_read_unlock_sched() and rcu_head_after_call_rcu() so they e.g. get properly linked in the API documentation. Also add parenthesis after function names to match the notation used in other kerneldoc comments

[PATCH tip/core/rcu 01/24] rcu: Remove KCSAN stubs

2020-08-31 Thread paulmck
From: "Paul E. McKenney" KCSAN is now in mainline, so this commit removes the stubs for the data_race(), ASSERT_EXCLUSIVE_WRITER(), and ASSERT_EXCLUSIVE_ACCESS() macros. Signed-off-by: Paul E. McKenney --- kernel/rcu/tree.c | 13 - 1 file changed, 13 deletions(-) diff --git a/kern

[PATCH tip/core/rcu 10/24] nocb: Remove show_rcu_nocb_state() false positive printout

2020-08-31 Thread paulmck
From: "Paul E. McKenney" The rcu_data structure's ->nocb_timer field is used to defer wakeups of the corresponding no-CBs CPU's grace-period kthread ("rcuog*"), and that structure's ->nocb_defer_wakeup field is used to track such deferral. This means that the show_rcu_nocb_state() printing an err

[PATCH tip/core/rcu 16/24] rculist: Introduce list/hlist_for_each_entry_srcu() macros

2020-08-31 Thread paulmck
srcu_read_lock_head() can be passed as the cond argument to list/hlist_for_each_entry_srcu(). Suggested-by: Paolo Bonzini Tested-by: Suraj Upadhyay Tested-by: Naresh Kamboju [ paulmck: Add "true" per kbuild test robot feedback. ] Signed-off-by: Madhuparna Bhowmik Signed-off-by: Paul E

[PATCH tip/core/rcu 20/24] rcu: Clarify comments about FQS loop reporting quiescent states

2020-08-31 Thread paulmck
From: "Joel Fernandes (Google)" Since at least v4.19, the FQS loop no longer reports quiescent states for offline CPUs except in emergency situations. This commit therefore fixes the comment in rcu_gp_init() to match the current code. Signed-off-by: Joel Fernandes (Google) Signed-off-by: Paul

[PATCH tip/core/rcu 12/24] rcu: Add READ_ONCE() to rcu_do_batch() access to rcu_resched_ns

2020-08-31 Thread paulmck
From: "Paul E. McKenney" Given that sysfs can change the value of rcu_resched_ns at any time, this commit adds a READ_ONCE() to the sole access to that variable. While in the area, this commit also adds bounds checking, clamping the value to at least a millisecond, but no longer than a second. S

[PATCH tip/core/rcu 02/14] rcutorture: Output number of elapsed grace periods

2020-08-31 Thread paulmck
umber (for example, Tiny RCU) just print zeroes. [ paulmck: Adjust commit log. ] Signed-off-by: Joel Fernandes (Google) Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/

[PATCH tip/core/rcu 05/24] rcu/trace: Print negative GP numbers correctly

2020-08-31 Thread paulmck
From: "Joel Fernandes (Google)" GP numbers start from -300 and gp_seq numbers start of -1200 (for a shift of 2). These negative numbers are printed as unsigned long which not only takes up more text space, but is rather confusing to the reader as they have to constantly expend energy to truncate

[PATCH tip/core/rcu 07/24] nocb: Clarify RCU nocb CPU error message

2020-08-31 Thread paulmck
From: "Paul E. McKenney" A message of the form "rcu:!!! lDTs ." can be tracked down, but doing so is not trivial. This commit therefore eases this process by adding text so that this error message now reads as follows: "rcu:nocb GP activity on CB-only CPU!!! lDTs ." Signed-off-by: Paul

[PATCH tip/core/rcu 06/24] rcu/trace: Use gp_seq_req in acceleration's rcu_grace_period tracepoint

2020-08-31 Thread paulmck
From: "Joel Fernandes (Google)" During acceleration of CB, the rsp's gp_seq is rcu_seq_snap'd. This is the value used for acceleration - it is the value of gp_seq at which it is safe the execute all callbacks in the callback list. The rdp's gp_seq is not very useful for this scenario. Make rcu_g

[PATCH tip/core/rcu 10/14] rcutorture: Properly synchronize with OOM notifier

2020-08-31 Thread paulmck
From: "Paul E. McKenney" The current rcutorture forward-progress code assumes that it is the only cause of out-of-memory (OOM) events. For script-based rcutorture testing, this assumption is in fact correct. However, testing based on modprobe/rmmod might well encounter external OOM events, whic

[PATCH tip/core/rcu 11/14] refperf: Avoid null pointer dereference when buf fails to allocate

2020-08-31 Thread paulmck
From: Colin Ian King Currently in the unlikely event that buf fails to be allocated it is dereferenced a few times. Use the errexit flag to determine if buf should be written to to avoid the null pointer dereferences. Addresses-Coverity: ("Dereference after null check") Fixes: f518f154ecef ("re

[PATCH tip/core/rcu 09/14] rcutorture: Properly set rcu_fwds for OOM handling

2020-08-31 Thread paulmck
From: "Paul E. McKenney" The conversion of rcu_fwds to dynamic allocation failed to actually allocate the required structure. This commit therefore allocates it, frees it, and updates rcu_fwds accordingly. While in the area, it abstracts the cleanup actions into rcu_torture_fwd_prog_cleanup().

[PATCH tip/core/rcu 13/14] rcutorture: Allow pointer leaks to test diagnostic code

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit adds an rcutorture.leakpointer module parameter that intentionally leaks an RCU-protected pointer out of the RCU read-side critical section and checks to see if the corresponding grace period has elapsed, emitting a WARN_ON_ONCE() if so. This module parameter

[PATCH tip/core/rcu 14/14] torture: Add gdb support

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit adds a "--gdb" parameter to kvm.sh, which causes "CONFIG_DEBUG_INFO=y" to be added to the Kconfig options, "nokaslr" to be added to the boot parameters, and "-s -S" to be added to the qemu arguments. Furthermore, the scripting prints messages telling the user

[PATCH tip/core/rcu 08/14] torture: Add kvm.sh --help and update help message

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit adds a --help argument (along with its synonym -h) to display the help text. While in the area, this commit also updates the help text. Signed-off-by: Paul E. McKenney --- tools/testing/selftests/rcutorture/bin/kvm.sh | 8 ++-- 1 file changed, 6 insert

[PATCH tip/core/rcu 01/14] rcutorture: Remove KCSAN stubs

2020-08-31 Thread paulmck
From: "Paul E. McKenney" KCSAN is now in mainline, so this commit removes the stubs for the data_race(), ASSERT_EXCLUSIVE_WRITER(), and ASSERT_EXCLUSIVE_ACCESS() macros. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 13 - 1 file changed, 13 deletions(-) diff --git

[PATCH tip/core/rcu 05/14] rcutorture: Replace HTTP links with HTTPS ones

2020-08-31 Thread paulmck
From: "Alexander A. Klimov" Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://

[PATCH tip/core/rcu 12/14] rcutorture: Hoist OOM registry up one level

2020-08-31 Thread paulmck
From: "Paul E. McKenney" Currently, registering and unregistering the OOM notifier is done right before and after the test, respectively. This will not work well for multi-threaded tests, so this commit hoists this registering and unregistering up into the rcu_torture_fwd_prog_init() and rcu_tor

[PATCH tip/core/rcu 06/14] torture: Update initrd documentation

2020-08-31 Thread paulmck
From: "Paul E. McKenney" The rcu-test-image.txt documentation covers a very uncommon case where a real userspace environment is required. However, someone reading this document might reasonably conclude that this is in fact a prerequisite. In addition, the initrd.txt file mentions dracut, which

[PATCH tip/core/rcu 07/14] rcutorture: Add CONFIG_PROVE_RCU_LIST to TREE05

2020-08-31 Thread paulmck
From: "Paul E. McKenney" Currently, the CONFIG_PROVE_RCU_LIST=y case is untested. This commit therefore adds CONFIG_PROVE_RCU_LIST=y to rcutorture's TREE05 scenario. Cc: Madhuparna Bhowmik Cc: Joel Fernandes (Google) Signed-off-by: Paul E. McKenney --- tools/testing/selftests/rcutorture/con

[PATCH tip/core/rcu 04/14] locktorture: Make function torture_percpu_rwsem_init() static

2020-08-31 Thread paulmck
From: Wei Yongjun The sparse tool complains as follows: kernel/locking/locktorture.c:569:6: warning: symbol 'torture_percpu_rwsem_init' was not declared. Should it be static? And this function is not used outside of locktorture.c, so this commit marks it static. Signed-off-by: Wei Yongjun Si

[PATCH tip/core/rcu 03/14] torture: document --allcpus argument added to the kvm.sh script

2020-08-31 Thread paulmck
From: Paul Gortmaker Signed-off-by: Paul Gortmaker Signed-off-by: Paul E. McKenney --- tools/testing/selftests/rcutorture/bin/kvm.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/selftests/rcutorture/bin/kvm.sh index e655983.

[PATCH tip/core/rcu 02/19] torture: Declare parse-console.sh independence from rcutorture

2020-08-31 Thread paulmck
From: "Paul E. McKenney" Currently, parse-torture.sh looks at the fifth field of torture-test console output for the version number. This works fine for rcutorture, but not for scftorture, which lacks the pointer field. This commit therefore adjusts matching lines so that the parse-console.sh a

[PATCH tip/core/rcu 09/19] scftorture: Add smp_call_function() memory-ordering checks

2020-08-31 Thread paulmck
g into the handler in the no-wait case because none of the handlers would be able to free the scf_check structure without introducing heavy synchronization to work out which was last. [ paulmck: s/GFP_KERNEL/GFP_ATOMIC/ per kernel test robot feedback. ] Signed-off-by: Paul E. McKenney -

[PATCH tip/core/rcu 15/19] scftorture: Check unexpected "switch" statement value

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit adds a "default" case to the switch statement in scftorture_invoke_one() which contains a WARN_ON_ONCE() and an assignment to ->scfc_out to suppress knock-on warnings. These knock-on warnings could otherwise cause the user to think that there was a memory-ord

[PATCH tip/core/rcu 16/19] scftorture: Block scftorture_invoker() kthreads for offline CPUs

2020-08-31 Thread paulmck
From: "Paul E. McKenney" Currently, CPU-hotplug operations might result in all but two of (say) 100 CPUs being offline, which in turn might result in false-positive diagnostics due to overload. This commit therefore causes scftorture_invoker() kthreads for offline CPUs to loop blocking for 200 m

[PATCH tip/core/rcu 05/19] tick-sched: Clarify "NOHZ: local_softirq_pending" warning

2020-08-31 Thread paulmck
From: "Paul E. McKenney" Currently, can_stop_idle_tick() prints "NOHZ: local_softirq_pending HH" (where "HH" is the hexadecimal softirq vector number) when one or more non-RCU softirq handlers are still enabled when checking to stop the scheduler-tick interrupt. This message is not as enlighteni

[PATCH tip/core/rcu 17/19] scftorture: Adapt memory-ordering test to UP operation

2020-08-31 Thread paulmck
From: "Paul E. McKenney" On uniprocessor systems, smp_call_function() does nothing. This commit therefore avoids complaining about the lack of handler accesses in the single-CPU case where there is no handler. Signed-off-by: Paul E. McKenney --- kernel/scftorture.c | 3 ++- 1 file changed, 2

[PATCH tip/core/rcu 12/19] scftorture: Flag errors in torture-compatible manner

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit prints error counts on the statistics line and also adds a "!!!" if any of the counters are non-zero. Allocation failures are (somewhat) forgiven, but all other errors result in a "FAILURE" print at the end of the test. Signed-off-by: Paul E. McKenney ---

[PATCH tip/core/rcu 13/19] scftorture: Prevent compiler from reducing race probabilities

2020-08-31 Thread paulmck
From: "Paul E. McKenney" Detecting smp_call_function() memory misordering requires close timing, so it is necessary to have the checks immediately before and after the call to the smp_call_function*() function under test. This commit therefore inserts barrier() calls to prevent the compiler from

[PATCH tip/core/rcu 18/19] scftorture: Add cond_resched() to test loop

2020-08-31 Thread paulmck
From: "Paul E. McKenney" Although the test loop does randomly delay, which would provide quiescent states and so forth, it is possible for there to be a series of long smp_call_function*() handler runtimes with no delays, which results in softlockup and RCU CPU stall warning messages. This commi

[PATCH tip/core/rcu 08/19] scftorture: Add smp_call_function_many() memory-ordering checks

2020-08-31 Thread paulmck
ering into the handler in the no-wait case because none of the handlers would be able to free the scf_check structure without introducing heavy synchronization to work out which was last. [ paulmck: s/GFP_KERNEL/GFP_ATOMIC/ per kernel test robot feedback. ] Signed-off-by: Paul E. McKenney -

[PATCH tip/core/rcu 10/19] scftorture: Consolidate scftorture_invoke_one() check and kfree()

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit moves checking of the ->scfc_out field and the freeing of the scf_check structure down below the end of switch statement, thus saving a few lines of code. Signed-off-by: Paul E. McKenney --- kernel/scftorture.c | 26 -- 1 file change

[PATCH tip/core/rcu 07/19] scftorture: Add smp_call_function_single() memory-ordering checks

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit adds checks for memory misordering across calls to smp_call_function_single() and also across returns in the case where the caller waits. Misordering results in a splat. [ paulmck: s/GFP_KERNEL/GFP_ATOMIC/ per kernel test robot feedback. ] Sig

[PATCH tip/core/rcu 04/19] scftorture: Implement weighted primitive selection

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit uses the scftorture.weight* kernel parameters to randomly chooses between smp_call_function_single(), smp_call_function_many(), and smp_call_function(). For each variant, it also randomly chooses whether to invoke it synchronously (wait=1) or asynchronously (

[PATCH tip/core/rcu 01/19] scftorture: Add smp_call_function() torture test

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit adds an smp_call_function() torture test that repeatedly invokes this function and complains if things go badly awry. Signed-off-by: Paul E. McKenney --- Documentation/admin-guide/kernel-parameters.txt | 92 +++ kernel/Makefile

[PATCH tip/core/rcu 03/19] torture: Add scftorture to the rcutorture scripting

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit updates the rcutorture scripting to include the new scftorture torture-test module. Signed-off-by: Paul E. McKenney --- .../selftests/rcutorture/bin/kvm-recheck-scf.sh| 38 ++ tools/testing/selftests/rcutorture/bin/kvm.sh | 2 +

[PATCH tip/core/rcu 19/19] rcuperf: Change rcuperf to rcuscale

2020-08-31 Thread paulmck
he names of the kernel boot parameters, so kernel-parameters.txt and ver_functions.sh are also updated. The rcutorture --torture type was also updated from rcuperf to rcuscale. [ paulmck: Fix bugs located by Stephen Rothwell. ] Reported-by: Ingo Molnar Signed-off-by: Paul E. McKenney --- Docu

[PATCH tip/core/rcu 14/19] scftorture: Make symbol 'scf_torture_rand' static

2020-08-31 Thread paulmck
From: Wei Yongjun The sparse tool complains as follows kernel/scftorture.c:124:1: warning: symbol '__pcpu_scope_scf_torture_rand' was not declared. Should it be static? And this per-CPU variable is not used outside of scftorture.c, so this commit marks it static. Reported-by: Hulk Robot Sign

[PATCH tip/core/rcu 11/19] scftorture: Consolidate scftorture_invoke_one() scf_check initialization

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit hoists much of the initialization of the scf_check structure out of the switch statement, thus saving a few lines of code. The initialization of the ->scfc_in field remains in each leg of the switch statement in order to more heavily stress memory ordering. S

[PATCH tip/core/rcu 06/19] scftorture: Summarize per-thread statistics

2020-08-31 Thread paulmck
From: "Paul E. McKenney" This commit summarizes the per-thread statistics, providing counts of the number of single, many, and all calls, both no-wait and wait, and, for the single case, the number where the target CPU was offline. Signed-off-by: Paul E. McKenney --- kernel/scftorture.c | 22 +

[PATCH tip/core/rcu 04/13] rcu: Force DEFAULT_RCU_BLIMIT to 1000 for strict RCU GPs

2020-08-31 Thread paulmck
From: "Paul E. McKenney" The value of DEFAULT_RCU_BLIMIT is normally set to 10, the idea being to avoid needless response-time degradation due to RCU callback invocation. However, when CONFIG_RCU_STRICT_GRACE_PERIOD=y it is better to avoid throttling callback execution in order to better detect p

[PATCH tip/core/rcu 08/13] rcu: IPI all CPUs at GP start for strict GPs

2020-08-31 Thread paulmck
From: "Paul E. McKenney" Currently, each CPU discovers the beginning of a given grace period on its own time, which is again good for efficiency but bad for fast grace periods. This commit therefore uses on_each_cpu() to IPI each CPU after grace-period initialization in order to inform each CPU

[PATCH tip/core/rcu 13/13] rcu: Remove unused "cpu" parameter from rcu_report_qs_rdp()

2020-08-31 Thread paulmck
From: "Paul E. McKenney" The "cpu" parameter to rcu_report_qs_rdp() is not used, with rdp->cpu being used instead. Furtheremore, every call to rcu_report_qs_rdp() invokes it on rdp->cpu. This commit therefore removes this unused "cpu" parameter and converts a check of rdp->cpu against smp_proce

[PATCH tip/core/rcu 12/13] rcu: Report QS for outermost PREEMPT=n rcu_read_unlock() for strict GPs

2020-08-31 Thread paulmck
uested via rcutree.rcu_unlock_delay. This commit also adds a call to rcu_read_unlock_strict() from the CONFIG_PREEMPT=n instance of __rcu_read_unlock(). [ paulmck: Fixed bug located by kernel test robot ] Reported-by Jann Horn Signed-off-by: Paul E. McKenney --- include/linux/rcupdate.h | 7 +++ kernel/

[PATCH tip/core/rcu 02/13] rcu: Reduce leaf fanout for strict RCU grace periods

2020-08-31 Thread paulmck
From: "Paul E. McKenney" Because strict RCU grace periods will complete more quickly, they will experience greater lock contention on each leaf rcu_node structure's ->lock. This commit therefore reduces the leaf fanout in order to reduce this lock contention. Note that this also has the effect

[PATCH tip/core/rcu 11/13] rcu: Execute RCU reader shortly after rcu_core for strict GPs

2020-08-31 Thread paulmck
From: "Paul E. McKenney" A kernel built with CONFIG_RCU_STRICT_GRACE_PERIOD=y needs a quiescent state to appear very shortly after a CPU has noticed a new grace period. Placing an RCU reader immediately after this point is ineffective because this normally happens in softirq context, which acts a

[PATCH tip/core/rcu 03/13] rcu: Restrict default jiffies_till_first_fqs for strict RCU GPs

2020-08-31 Thread paulmck
From: "Paul E. McKenney" If there are idle CPUs, RCU's grace-period kthread will wait several jiffies before even thinking about polling them. This promotes efficiency, which is normally a good thing, but when the kernel has been built with CONFIG_RCU_STRICT_GRACE_PERIOD=y, we care more about sh

<    1   2   3   4   5   6   7   8   >