Loading include/linux/srcutiny.h +13 −0 Original line number Diff line number Diff line Loading @@ -87,4 +87,17 @@ static inline void srcu_barrier(struct srcu_struct *sp) synchronize_srcu(sp); } /* Defined here to avoid size increase for non-torture kernels. */ static inline void srcu_torture_stats_print(struct srcu_struct *sp, char *tt, char *tf) { int idx; idx = READ_ONCE(sp->srcu_idx) & 0x1; pr_alert("%s%s Tiny SRCU per-CPU(idx=%d): (%hd,%hd)\n", tt, tf, idx, READ_ONCE(sp->srcu_lock_nesting[!idx]), READ_ONCE(sp->srcu_lock_nesting[idx])); } #endif include/linux/srcutree.h +1 −0 Original line number Diff line number Diff line Loading @@ -141,5 +141,6 @@ void process_srcu(struct work_struct *work); void synchronize_srcu_expedited(struct srcu_struct *sp); void srcu_barrier(struct srcu_struct *sp); void srcu_torture_stats_print(struct srcu_struct *sp, char *tt, char *tf); #endif kernel/rcu/rcutorture.c +1 −38 Original line number Diff line number Diff line Loading @@ -561,44 +561,7 @@ static void srcu_torture_barrier(void) static void srcu_torture_stats(void) { int __maybe_unused cpu; int idx; #ifdef CONFIG_TREE_SRCU idx = srcu_ctlp->srcu_idx & 0x1; pr_alert("%s%s Tree SRCU per-CPU(idx=%d):", torture_type, TORTURE_FLAG, idx); for_each_possible_cpu(cpu) { unsigned long l0, l1; unsigned long u0, u1; long c0, c1; struct srcu_data *counts; counts = per_cpu_ptr(srcu_ctlp->sda, cpu); u0 = counts->srcu_unlock_count[!idx]; u1 = counts->srcu_unlock_count[idx]; /* * Make sure that a lock is always counted if the corresponding * unlock is counted. */ smp_rmb(); l0 = counts->srcu_lock_count[!idx]; l1 = counts->srcu_lock_count[idx]; c0 = l0 - u0; c1 = l1 - u1; pr_cont(" %d(%ld,%ld)", cpu, c0, c1); } pr_cont("\n"); #elif defined(CONFIG_TINY_SRCU) idx = READ_ONCE(srcu_ctlp->srcu_idx) & 0x1; pr_alert("%s%s Tiny SRCU per-CPU(idx=%d): (%hd,%hd)\n", torture_type, TORTURE_FLAG, idx, READ_ONCE(srcu_ctlp->srcu_lock_nesting[!idx]), READ_ONCE(srcu_ctlp->srcu_lock_nesting[idx])); #endif srcu_torture_stats_print(srcu_ctlp, torture_type, TORTURE_FLAG); } static void srcu_torture_synchronize_expedited(void) Loading kernel/rcu/srcutree.c +34 −0 Original line number Diff line number Diff line Loading @@ -1217,6 +1217,40 @@ void srcutorture_get_gp_data(enum rcutorture_type test_type, } EXPORT_SYMBOL_GPL(srcutorture_get_gp_data); void srcu_torture_stats_print(struct srcu_struct *sp, char *tt, char *tf) { int cpu; int idx; idx = sp->srcu_idx & 0x1; pr_alert("%s%s Tree SRCU per-CPU(idx=%d):", tt, tf, idx); for_each_possible_cpu(cpu) { unsigned long l0, l1; unsigned long u0, u1; long c0, c1; struct srcu_data *counts; counts = per_cpu_ptr(sp->sda, cpu); u0 = counts->srcu_unlock_count[!idx]; u1 = counts->srcu_unlock_count[idx]; /* * Make sure that a lock is always counted if the corresponding * unlock is counted. */ smp_rmb(); l0 = counts->srcu_lock_count[!idx]; l1 = counts->srcu_lock_count[idx]; c0 = l0 - u0; c1 = l1 - u1; pr_cont(" %d(%ld,%ld)", cpu, c0, c1); } pr_cont("\n"); } EXPORT_SYMBOL_GPL(srcu_torture_stats_print); static int __init srcu_bootup_announce(void) { pr_info("Hierarchical SRCU implementation.\n"); Loading Loading
include/linux/srcutiny.h +13 −0 Original line number Diff line number Diff line Loading @@ -87,4 +87,17 @@ static inline void srcu_barrier(struct srcu_struct *sp) synchronize_srcu(sp); } /* Defined here to avoid size increase for non-torture kernels. */ static inline void srcu_torture_stats_print(struct srcu_struct *sp, char *tt, char *tf) { int idx; idx = READ_ONCE(sp->srcu_idx) & 0x1; pr_alert("%s%s Tiny SRCU per-CPU(idx=%d): (%hd,%hd)\n", tt, tf, idx, READ_ONCE(sp->srcu_lock_nesting[!idx]), READ_ONCE(sp->srcu_lock_nesting[idx])); } #endif
include/linux/srcutree.h +1 −0 Original line number Diff line number Diff line Loading @@ -141,5 +141,6 @@ void process_srcu(struct work_struct *work); void synchronize_srcu_expedited(struct srcu_struct *sp); void srcu_barrier(struct srcu_struct *sp); void srcu_torture_stats_print(struct srcu_struct *sp, char *tt, char *tf); #endif
kernel/rcu/rcutorture.c +1 −38 Original line number Diff line number Diff line Loading @@ -561,44 +561,7 @@ static void srcu_torture_barrier(void) static void srcu_torture_stats(void) { int __maybe_unused cpu; int idx; #ifdef CONFIG_TREE_SRCU idx = srcu_ctlp->srcu_idx & 0x1; pr_alert("%s%s Tree SRCU per-CPU(idx=%d):", torture_type, TORTURE_FLAG, idx); for_each_possible_cpu(cpu) { unsigned long l0, l1; unsigned long u0, u1; long c0, c1; struct srcu_data *counts; counts = per_cpu_ptr(srcu_ctlp->sda, cpu); u0 = counts->srcu_unlock_count[!idx]; u1 = counts->srcu_unlock_count[idx]; /* * Make sure that a lock is always counted if the corresponding * unlock is counted. */ smp_rmb(); l0 = counts->srcu_lock_count[!idx]; l1 = counts->srcu_lock_count[idx]; c0 = l0 - u0; c1 = l1 - u1; pr_cont(" %d(%ld,%ld)", cpu, c0, c1); } pr_cont("\n"); #elif defined(CONFIG_TINY_SRCU) idx = READ_ONCE(srcu_ctlp->srcu_idx) & 0x1; pr_alert("%s%s Tiny SRCU per-CPU(idx=%d): (%hd,%hd)\n", torture_type, TORTURE_FLAG, idx, READ_ONCE(srcu_ctlp->srcu_lock_nesting[!idx]), READ_ONCE(srcu_ctlp->srcu_lock_nesting[idx])); #endif srcu_torture_stats_print(srcu_ctlp, torture_type, TORTURE_FLAG); } static void srcu_torture_synchronize_expedited(void) Loading
kernel/rcu/srcutree.c +34 −0 Original line number Diff line number Diff line Loading @@ -1217,6 +1217,40 @@ void srcutorture_get_gp_data(enum rcutorture_type test_type, } EXPORT_SYMBOL_GPL(srcutorture_get_gp_data); void srcu_torture_stats_print(struct srcu_struct *sp, char *tt, char *tf) { int cpu; int idx; idx = sp->srcu_idx & 0x1; pr_alert("%s%s Tree SRCU per-CPU(idx=%d):", tt, tf, idx); for_each_possible_cpu(cpu) { unsigned long l0, l1; unsigned long u0, u1; long c0, c1; struct srcu_data *counts; counts = per_cpu_ptr(sp->sda, cpu); u0 = counts->srcu_unlock_count[!idx]; u1 = counts->srcu_unlock_count[idx]; /* * Make sure that a lock is always counted if the corresponding * unlock is counted. */ smp_rmb(); l0 = counts->srcu_lock_count[!idx]; l1 = counts->srcu_lock_count[idx]; c0 = l0 - u0; c1 = l1 - u1; pr_cont(" %d(%ld,%ld)", cpu, c0, c1); } pr_cont("\n"); } EXPORT_SYMBOL_GPL(srcu_torture_stats_print); static int __init srcu_bootup_announce(void) { pr_info("Hierarchical SRCU implementation.\n"); Loading