Skip to content

Commit c0b9620

Browse files
committed
Merge tag 'rcu.next.v6.10' of https://github.com/urezki/linux
Pull RCU updates from Uladzislau Rezki: - Fix a lockdep complain for lazy-preemptible kernel, remove redundant BH disable for TINY_RCU, remove redundant READ_ONCE() in tree.c, fix false positives KCSAN splat and fix buffer overflow in the print_cpu_stall_info(). - Misc updates related to bpf, tracing and update the MAINTAINERS file. - An improvement of a normal synchronize_rcu() call in terms of latency. It maintains a separate track for sync. users only. This approach bypasses per-cpu nocb-lists thus sync-users do not depend on nocb-list length and how fast regular callbacks are processed. - RCU tasks: switch tasks RCU grace periods to sleep at TASK_IDLE priority, fix some comments, add some diagnostic warning to the exit_tasks_rcu_start() and fix a buffer overflow in the show_rcu_tasks_trace_gp_kthread(). - RCU torture: Increase memory to guest OS, fix a Tasks Rude RCU testing, some updates for TREE09, dump mode information to debug GP kthread state, remove redundant READ_ONCE(), fix some comments about RCU_TORTURE_PIPE_LEN and pipe_count, remove some redundant pointer initialization, fix a hung splat task by when the rcutorture tests start to exit, fix invalid context warning, add '--do-kvfree' parameter to torture test and use slow register unregister callbacks only for rcutype test. * tag 'rcu.next.v6.10' of https://github.com/urezki/linux: (48 commits) rcutorture: Use rcu_gp_slow_register/unregister() only for rcutype test torture: Scale --do-kvfree test time rcutorture: Fix invalid context warning when enable srcu barrier testing rcutorture: Make stall-tasks directly exit when rcutorture tests end rcutorture: Removing redundant function pointer initialization rcutorture: Make rcutorture support print rcu-tasks gp state rcutorture: Use the gp_kthread_dbg operation specified by cur_ops rcutorture: Re-use value stored to ->rtort_pipe_count instead of re-reading rcutorture: Fix rcu_torture_one_read() pipe_count overflow comment rcutorture: Remove extraneous rcu_torture_pipe_update_one() READ_ONCE() rcu: Allocate WQ with WQ_MEM_RECLAIM bit set rcu: Support direct wake-up of synchronize_rcu() users rcu: Add a trace event for synchronize_rcu_normal() rcu: Reduce synchronize_rcu() latency rcu: Fix buffer overflow in print_cpu_stall_info() rcu: Mollify sparse with RCU guard rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow rcu-tasks: Fix the comments for tasks_rcu_exit_srcu_stall_timer rcu-tasks: Replace exit_tasks_rcu_start() initialization with WARN_ON_ONCE() rcu: Remove redundant CONFIG_PROVE_RCU #if condition ...
2 parents 736676f + 64619b2 commit c0b9620

File tree

29 files changed

+663
-137
lines changed

29 files changed

+663
-137
lines changed

.mailmap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,8 @@ Nadia Yvette Chambers <[email protected]> William Lee Irwin III <wli@holomorphy
467467
468468
469469
470-
470+
471+
471472
472473
Nguyen Anh Quynh <[email protected]>
473474

Documentation/RCU/whatisRCU.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ their assorted primitives.
427427

428428
This section shows a simple use of the core RCU API to protect a
429429
global pointer to a dynamically allocated structure. More-typical
430-
uses of RCU may be found in listRCU.rst, arrayRCU.rst, and NMI-RCU.rst.
430+
uses of RCU may be found in listRCU.rst and NMI-RCU.rst.
431431
::
432432

433433
struct foo {
@@ -510,8 +510,8 @@ So, to sum up:
510510
data item.
511511

512512
See checklist.rst for additional rules to follow when using RCU.
513-
And again, more-typical uses of RCU may be found in listRCU.rst,
514-
arrayRCU.rst, and NMI-RCU.rst.
513+
And again, more-typical uses of RCU may be found in listRCU.rst
514+
and NMI-RCU.rst.
515515

516516
.. _4_whatisRCU:
517517

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5098,6 +5098,20 @@
50985098
delay, memory pressure or callback list growing too
50995099
big.
51005100

5101+
rcutree.rcu_normal_wake_from_gp= [KNL]
5102+
Reduces a latency of synchronize_rcu() call. This approach
5103+
maintains its own track of synchronize_rcu() callers, so it
5104+
does not interact with regular callbacks because it does not
5105+
use a call_rcu[_hurry]() path. Please note, this is for a
5106+
normal grace period.
5107+
5108+
How to enable it:
5109+
5110+
echo 1 > /sys/module/rcutree/parameters/rcu_normal_wake_from_gp
5111+
or pass a boot parameter "rcutree.rcu_normal_wake_from_gp=1"
5112+
5113+
Default is 0.
5114+
51015115
rcuscale.gp_async= [KNL]
51025116
Measure performance of asynchronous
51035117
grace-period primitives such as call_rcu().

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18600,7 +18600,7 @@ F: tools/testing/selftests/resctrl/
1860018600
READ-COPY UPDATE (RCU)
1860118601
M: "Paul E. McKenney" <[email protected]>
1860218602
M: Frederic Weisbecker <[email protected]> (kernel/rcu/tree_nocb.h)
18603-
M: Neeraj Upadhyay <[email protected]> (kernel/rcu/tasks.h)
18603+
M: Neeraj Upadhyay <[email protected]> (kernel/rcu/tasks.h)
1860418604
M: Joel Fernandes <[email protected]>
1860518605
M: Josh Triplett <[email protected]>
1860618606
M: Boqun Feng <[email protected]>

arch/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ config KPROBES
6363
depends on MODULES
6464
depends on HAVE_KPROBES
6565
select KALLSYMS
66-
select TASKS_RCU if PREEMPTION
66+
select NEED_TASKS_RCU
6767
help
6868
Kprobes allows you to trap at almost any kernel address and
6969
execute a callback function. register_kprobe() establishes
@@ -112,7 +112,7 @@ config STATIC_CALL_SELFTEST
112112
config OPTPROBES
113113
def_bool y
114114
depends on KPROBES && HAVE_OPTPROBES
115-
select TASKS_RCU if PREEMPTION
115+
select NEED_TASKS_RCU
116116

117117
config KPROBES_ON_FTRACE
118118
def_bool y

include/linux/rcupdate.h

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,15 +401,15 @@ static inline int debug_lockdep_rcu_enabled(void)
401401
} \
402402
} while (0)
403403

404-
#if defined(CONFIG_PROVE_RCU) && !defined(CONFIG_PREEMPT_RCU)
404+
#ifndef CONFIG_PREEMPT_RCU
405405
static inline void rcu_preempt_sleep_check(void)
406406
{
407407
RCU_LOCKDEP_WARN(lock_is_held(&rcu_lock_map),
408408
"Illegal context switch in RCU read-side critical section");
409409
}
410-
#else /* #ifdef CONFIG_PROVE_RCU */
410+
#else // #ifndef CONFIG_PREEMPT_RCU
411411
static inline void rcu_preempt_sleep_check(void) { }
412-
#endif /* #else #ifdef CONFIG_PROVE_RCU */
412+
#endif // #else // #ifndef CONFIG_PREEMPT_RCU
413413

414414
#define rcu_sleep_check() \
415415
do { \
@@ -809,9 +809,9 @@ static inline void rcu_read_unlock(void)
809809
{
810810
RCU_LOCKDEP_WARN(!rcu_is_watching(),
811811
"rcu_read_unlock() used illegally while idle");
812+
rcu_lock_release(&rcu_lock_map); /* Keep acq info for rls diags. */
812813
__release(RCU);
813814
__rcu_read_unlock();
814-
rcu_lock_release(&rcu_lock_map); /* Keep acq info for rls diags. */
815815
}
816816

817817
/**
@@ -1090,6 +1090,18 @@ rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t f)
10901090
extern int rcu_expedited;
10911091
extern int rcu_normal;
10921092

1093-
DEFINE_LOCK_GUARD_0(rcu, rcu_read_lock(), rcu_read_unlock())
1093+
DEFINE_LOCK_GUARD_0(rcu,
1094+
do {
1095+
rcu_read_lock();
1096+
/*
1097+
* sparse doesn't call the cleanup function,
1098+
* so just release immediately and don't track
1099+
* the context. We don't need to anyway, since
1100+
* the whole point of the guard is to not need
1101+
* the explicit unlock.
1102+
*/
1103+
__release(RCU);
1104+
} while (0),
1105+
rcu_read_unlock())
10941106

10951107
#endif /* __LINUX_RCUPDATE_H */

include/linux/rcupdate_wait.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ struct rcu_synchronize {
1919
};
2020
void wakeme_after_rcu(struct rcu_head *head);
2121

22-
void __wait_rcu_gp(bool checktiny, int n, call_rcu_func_t *crcu_array,
22+
void __wait_rcu_gp(bool checktiny, unsigned int state, int n, call_rcu_func_t *crcu_array,
2323
struct rcu_synchronize *rs_array);
2424

25-
#define _wait_rcu_gp(checktiny, ...) \
26-
do { \
27-
call_rcu_func_t __crcu_array[] = { __VA_ARGS__ }; \
28-
struct rcu_synchronize __rs_array[ARRAY_SIZE(__crcu_array)]; \
29-
__wait_rcu_gp(checktiny, ARRAY_SIZE(__crcu_array), \
30-
__crcu_array, __rs_array); \
25+
#define _wait_rcu_gp(checktiny, state, ...) \
26+
do { \
27+
call_rcu_func_t __crcu_array[] = { __VA_ARGS__ }; \
28+
struct rcu_synchronize __rs_array[ARRAY_SIZE(__crcu_array)]; \
29+
__wait_rcu_gp(checktiny, state, ARRAY_SIZE(__crcu_array), __crcu_array, __rs_array); \
3130
} while (0)
3231

33-
#define wait_rcu_gp(...) _wait_rcu_gp(false, __VA_ARGS__)
32+
#define wait_rcu_gp(...) _wait_rcu_gp(false, TASK_UNINTERRUPTIBLE, __VA_ARGS__)
33+
#define wait_rcu_gp_state(state, ...) _wait_rcu_gp(false, state, __VA_ARGS__)
3434

3535
/**
3636
* synchronize_rcu_mult - Wait concurrently for multiple grace periods
@@ -54,7 +54,7 @@ do { \
5454
* grace period.
5555
*/
5656
#define synchronize_rcu_mult(...) \
57-
_wait_rcu_gp(IS_ENABLED(CONFIG_TINY_RCU), __VA_ARGS__)
57+
_wait_rcu_gp(IS_ENABLED(CONFIG_TINY_RCU), TASK_UNINTERRUPTIBLE, __VA_ARGS__)
5858

5959
static inline void cond_resched_rcu(void)
6060
{

include/linux/srcutiny.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ static inline int __srcu_read_lock(struct srcu_struct *ssp)
6464
{
6565
int idx;
6666

67+
preempt_disable(); // Needed for PREEMPT_AUTO
6768
idx = ((READ_ONCE(ssp->srcu_idx) + 1) & 0x2) >> 1;
6869
WRITE_ONCE(ssp->srcu_lock_nesting[idx], READ_ONCE(ssp->srcu_lock_nesting[idx]) + 1);
70+
preempt_enable();
6971
return idx;
7072
}
7173

include/trace/events/rcu.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,33 @@ TRACE_EVENT_RCU(rcu_invoke_kfree_bulk_callback,
707707
__entry->rcuname, __entry->p, __entry->nr_records)
708708
);
709709

710+
/*
711+
* Tracepoint for a normal synchronize_rcu() states. The first argument
712+
* is the RCU flavor, the second argument is a pointer to rcu_head the
713+
* last one is an event.
714+
*/
715+
TRACE_EVENT_RCU(rcu_sr_normal,
716+
717+
TP_PROTO(const char *rcuname, struct rcu_head *rhp, const char *srevent),
718+
719+
TP_ARGS(rcuname, rhp, srevent),
720+
721+
TP_STRUCT__entry(
722+
__field(const char *, rcuname)
723+
__field(void *, rhp)
724+
__field(const char *, srevent)
725+
),
726+
727+
TP_fast_assign(
728+
__entry->rcuname = rcuname;
729+
__entry->rhp = rhp;
730+
__entry->srevent = srevent;
731+
),
732+
733+
TP_printk("%s rhp=0x%p event=%s",
734+
__entry->rcuname, __entry->rhp, __entry->srevent)
735+
);
736+
710737
/*
711738
* Tracepoint for exiting rcu_do_batch after RCU callbacks have been
712739
* invoked. The first argument is the name of the RCU flavor,

kernel/bpf/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ config BPF_SYSCALL
2828
bool "Enable bpf() system call"
2929
select BPF
3030
select IRQ_WORK
31-
select TASKS_RCU if PREEMPTION
31+
select NEED_TASKS_RCU
3232
select TASKS_TRACE_RCU
3333
select BINARY_PRINTF
3434
select NET_SOCK_MSG if NET

0 commit comments

Comments
 (0)