Skip to content

Commit 64619b2

Browse files
committed
Merge branches 'fixes.2024.04.15a', 'misc.2024.04.12a', 'rcu-sync-normal-improve.2024.04.15a', 'rcu-tasks.2024.04.15a' and 'rcutorture.2024.04.15a' into rcu-merge.2024.04.15a
fixes.2024.04.15a: RCU fixes misc.2024.04.12a: Miscellaneous fixes rcu-sync-normal-improve.2024.04.15a: Improving synchronize_rcu() call rcu-tasks.2024.04.15a: Tasks RCU updates rcutorture.2024.04.15a: Torture-test updates
5 parents 3758f7d + 64ec8b6 + 0fd210b + cc5645f + 1c67318 commit 64619b2

File tree

21 files changed

+543
-98
lines changed

21 files changed

+543
-98
lines changed

.mailmap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,8 @@ Nadav Amit <[email protected]> <[email protected]>
445445
Nadia Yvette Chambers <[email protected]> William Lee Irwin III <[email protected]>
446446
447447
448-
448+
449+
449450
450451
Nguyen Anh Quynh <[email protected]>
451452

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
@@ -5091,6 +5091,20 @@
50915091
delay, memory pressure or callback list growing too
50925092
big.
50935093

5094+
rcutree.rcu_normal_wake_from_gp= [KNL]
5095+
Reduces a latency of synchronize_rcu() call. This approach
5096+
maintains its own track of synchronize_rcu() callers, so it
5097+
does not interact with regular callbacks because it does not
5098+
use a call_rcu[_hurry]() path. Please note, this is for a
5099+
normal grace period.
5100+
5101+
How to enable it:
5102+
5103+
echo 1 > /sys/module/rcutree/parameters/rcu_normal_wake_from_gp
5104+
or pass a boot parameter "rcutree.rcu_normal_wake_from_gp=1"
5105+
5106+
Default is 0.
5107+
50945108
rcuscale.gp_async= [KNL]
50955109
Measure performance of asynchronous
50965110
grace-period primitives such as call_rcu().

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18591,7 +18591,7 @@ F: tools/testing/selftests/resctrl/
1859118591
READ-COPY UPDATE (RCU)
1859218592
M: "Paul E. McKenney" <[email protected]>
1859318593
M: Frederic Weisbecker <[email protected]> (kernel/rcu/tree_nocb.h)
18594-
M: Neeraj Upadhyay <[email protected]> (kernel/rcu/tasks.h)
18594+
M: Neeraj Upadhyay <[email protected]> (kernel/rcu/tasks.h)
1859518595
M: Joel Fernandes <[email protected]>
1859618596
M: Josh Triplett <[email protected]>
1859718597
M: Boqun Feng <[email protected]>

arch/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ config KPROBES
5555
depends on MODULES
5656
depends on HAVE_KPROBES
5757
select KALLSYMS
58-
select TASKS_RCU if PREEMPTION
58+
select NEED_TASKS_RCU
5959
help
6060
Kprobes allows you to trap at almost any kernel address and
6161
execute a callback function. register_kprobe() establishes
@@ -104,7 +104,7 @@ config STATIC_CALL_SELFTEST
104104
config OPTPROBES
105105
def_bool y
106106
depends on KPROBES && HAVE_OPTPROBES
107-
select TASKS_RCU if PREEMPTION
107+
select NEED_TASKS_RCU
108108

109109
config KPROBES_ON_FTRACE
110110
def_bool y

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/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

kernel/bpf/trampoline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static void bpf_tramp_image_put(struct bpf_tramp_image *im)
333333
int err = bpf_arch_text_poke(im->ip_after_call, BPF_MOD_JUMP,
334334
NULL, im->ip_epilogue);
335335
WARN_ON(err);
336-
if (IS_ENABLED(CONFIG_PREEMPTION))
336+
if (IS_ENABLED(CONFIG_TASKS_RCU))
337337
call_rcu_tasks(&im->rcu, __bpf_tramp_image_put_rcu_tasks);
338338
else
339339
percpu_ref_kill(&im->pcref);

kernel/rcu/rcu.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,18 @@ static inline void show_rcu_tasks_gp_kthreads(void) {}
522522

523523
#ifdef CONFIG_TASKS_RCU
524524
struct task_struct *get_rcu_tasks_gp_kthread(void);
525+
void rcu_tasks_get_gp_data(int *flags, unsigned long *gp_seq);
525526
#endif // # ifdef CONFIG_TASKS_RCU
526527

527528
#ifdef CONFIG_TASKS_RUDE_RCU
528529
struct task_struct *get_rcu_tasks_rude_gp_kthread(void);
530+
void rcu_tasks_rude_get_gp_data(int *flags, unsigned long *gp_seq);
529531
#endif // # ifdef CONFIG_TASKS_RUDE_RCU
530532

533+
#ifdef CONFIG_TASKS_TRACE_RCU
534+
void rcu_tasks_trace_get_gp_data(int *flags, unsigned long *gp_seq);
535+
#endif
536+
531537
#ifdef CONFIG_TASKS_RCU_GENERIC
532538
void tasks_cblist_init_generic(void);
533539
#else /* #ifdef CONFIG_TASKS_RCU_GENERIC */
@@ -557,17 +563,15 @@ static inline void rcu_set_jiffies_lazy_flush(unsigned long j) { }
557563
#endif
558564

559565
#if defined(CONFIG_TREE_RCU)
560-
void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags,
561-
unsigned long *gp_seq);
566+
void rcutorture_get_gp_data(int *flags, unsigned long *gp_seq);
562567
void do_trace_rcu_torture_read(const char *rcutorturename,
563568
struct rcu_head *rhp,
564569
unsigned long secs,
565570
unsigned long c_old,
566571
unsigned long c);
567572
void rcu_gp_set_torture_wait(int duration);
568573
#else
569-
static inline void rcutorture_get_gp_data(enum rcutorture_type test_type,
570-
int *flags, unsigned long *gp_seq)
574+
static inline void rcutorture_get_gp_data(int *flags, unsigned long *gp_seq)
571575
{
572576
*flags = 0;
573577
*gp_seq = 0;
@@ -587,20 +591,16 @@ static inline void rcu_gp_set_torture_wait(int duration) { }
587591

588592
#ifdef CONFIG_TINY_SRCU
589593

590-
static inline void srcutorture_get_gp_data(enum rcutorture_type test_type,
591-
struct srcu_struct *sp, int *flags,
594+
static inline void srcutorture_get_gp_data(struct srcu_struct *sp, int *flags,
592595
unsigned long *gp_seq)
593596
{
594-
if (test_type != SRCU_FLAVOR)
595-
return;
596597
*flags = 0;
597598
*gp_seq = sp->srcu_idx;
598599
}
599600

600601
#elif defined(CONFIG_TREE_SRCU)
601602

602-
void srcutorture_get_gp_data(enum rcutorture_type test_type,
603-
struct srcu_struct *sp, int *flags,
603+
void srcutorture_get_gp_data(struct srcu_struct *sp, int *flags,
604604
unsigned long *gp_seq);
605605

606606
#endif

0 commit comments

Comments
 (0)