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. ]
Unified · Split
| @@ -1407,15 +1407,33 @@ void srcutorture_get_gp_data(enum rcutorture_type test_type, · 1406 unmodified lines | ||
| 1407 | 1407 | } |
| 1408 | 1408 | EXPORT_SYMBOL_GPL(srcutorture_get_gp_data); |
| 1409 | 1409 | |
| 1410 | +static 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 | + | |
| 1410 | 1423 | void srcu_torture_stats_print(struct srcu_struct *ssp, char *tt, char *tf) |
| 1411 | 1424 | { |
| 1412 | 1425 | int cpu; |
| 1413 | 1426 | int idx; |
| 1414 | 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 | 1431 | idx = ssp->srcu_idx & 0x1; |
| 1417 | − pr_alert("%s%s Tree SRCU g%ld per-CPU(idx=%d):", | |
| 1418 | − tt, tf, rcu_seq_current(&ssp->srcu_gp_seq), idx); | |
| 1432 | + if (ss_state < 0 || ss_state >= ARRAY_SIZE(srcu_size_state_name)) | |
| 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 | 1437 | for_each_possible_cpu(cpu) { |
| 1420 | 1438 | unsigned long l0, l1; |
| 1421 | 1439 | unsigned long u0, u1; |