History

srcu: Make rcutorture dump the SRCU size state

This commit adds the numeric and string version of ->srcu_size_state to the Tree-SRCU-specific portion of the rcutorture output. [ paulmck: Apply feedback from kernel test robot and Dan Carpenter. ] [ quic_neeraju: Apply feedback from Jiapeng Chong. ]

Paul E. McKenney committed 4 years ago

Commit 3bedebc1 parent e2f63831 file · +20 −2Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/rcu/srcutree.c+20−2
@@ -1407,15 +1407,33 @@ void srcutorture_get_gp_data(enum rcutorture_type test_type, · 1406 unmodified lines
1407}1407}
1408EXPORT_SYMBOL_GPL(srcutorture_get_gp_data);1408EXPORT_SYMBOL_GPL(srcutorture_get_gp_data);
1409 1409
1410static const char * const srcu_size_state_name[] = {
1411 "SRCU_SIZE_SMALL",
1412 "SRCU_SIZE_ALLOC",
1413 "SRCU_SIZE_WAIT_BARRIER",
1414 "SRCU_SIZE_WAIT_CALL",
1415 "SRCU_SIZE_WAIT_CBS1",
1416 "SRCU_SIZE_WAIT_CBS2",
1417 "SRCU_SIZE_WAIT_CBS3",
1418 "SRCU_SIZE_WAIT_CBS4",
1419 "SRCU_SIZE_BIG",
1420 "SRCU_SIZE_???",
1421};
1422
1410void srcu_torture_stats_print(struct srcu_struct *ssp, char *tt, char *tf)1423void srcu_torture_stats_print(struct srcu_struct *ssp, char *tt, char *tf)
1411{1424{
1412 int cpu;1425 int cpu;
1413 int idx;1426 int idx;
1414 unsigned long s0 = 0, s1 = 0;1427 unsigned long s0 = 0, s1 = 0;
1428 int ss_state = READ_ONCE(ssp->srcu_size_state);
1429 int ss_state_idx = ss_state;
1415 1430
1416 idx = ssp->srcu_idx & 0x1;1431 idx = ssp->srcu_idx & 0x1;
1417 pr_alert("%s%s Tree SRCU g%ld per-CPU(idx=%d):",1432 if (ss_state < 0 || ss_state >= ARRAY_SIZE(srcu_size_state_name))
1418 tt, tf, rcu_seq_current(&ssp->srcu_gp_seq), idx);1433 ss_state_idx = ARRAY_SIZE(srcu_size_state_name) - 1;
1434 pr_alert("%s%s Tree SRCU g%ld state %d (%s) per-CPU(idx=%d):",
1435 tt, tf, rcu_seq_current(&ssp->srcu_gp_seq), ss_state,
1436 srcu_size_state_name[ss_state_idx], idx);
1419 for_each_possible_cpu(cpu) {1437 for_each_possible_cpu(cpu) {
1420 unsigned long l0, l1;1438 unsigned long l0, l1;
1421 unsigned long u0, u1;1439 unsigned long u0, u1;