@@ -111,6 +111,7 @@ torture_param(int, nocbs_nthreads, 0, "Number of NOCB toggle threads, 0 to disab
111
111
torture_param (int , nocbs_toggle , 1000 , "Time between toggling nocb state (ms)" );
112
112
torture_param (int , read_exit_delay , 13 , "Delay between read-then-exit episodes (s)" );
113
113
torture_param (int , read_exit_burst , 16 , "# of read-then-exit bursts per episode, zero to disable" );
114
+ torture_param (int , reader_flavor , 0x1 , "Reader flavors to use, one per bit." );
114
115
torture_param (int , shuffle_interval , 3 , "Number of seconds between shuffles" );
115
116
torture_param (int , shutdown_secs , 0 , "Shutdown time (s), <= zero to disable." );
116
117
torture_param (int , stall_cpu , 0 , "Stall duration (s), zero to disable." );
@@ -644,10 +645,20 @@ static void srcu_get_gp_data(int *flags, unsigned long *gp_seq)
644
645
645
646
static int srcu_torture_read_lock (void )
646
647
{
647
- if (cur_ops == & srcud_ops )
648
- return srcu_read_lock_nmisafe (srcu_ctlp );
649
- else
650
- return srcu_read_lock (srcu_ctlp );
648
+ int idx ;
649
+ int ret = 0 ;
650
+
651
+ if ((reader_flavor & 0x1 ) || !(reader_flavor & 0x7 )) {
652
+ idx = srcu_read_lock (srcu_ctlp );
653
+ WARN_ON_ONCE (idx & ~0x1 );
654
+ ret += idx ;
655
+ }
656
+ if (reader_flavor & 0x2 ) {
657
+ idx = srcu_read_lock_nmisafe (srcu_ctlp );
658
+ WARN_ON_ONCE (idx & ~0x1 );
659
+ ret += idx << 1 ;
660
+ }
661
+ return ret ;
651
662
}
652
663
653
664
static void
@@ -671,10 +682,11 @@ srcu_read_delay(struct torture_random_state *rrsp, struct rt_read_seg *rtrsp)
671
682
672
683
static void srcu_torture_read_unlock (int idx )
673
684
{
674
- if (cur_ops == & srcud_ops )
675
- srcu_read_unlock_nmisafe (srcu_ctlp , idx );
676
- else
677
- srcu_read_unlock (srcu_ctlp , idx );
685
+ WARN_ON_ONCE ((reader_flavor && (idx & ~reader_flavor )) || (!reader_flavor && (idx & ~0x1 )));
686
+ if (reader_flavor & 0x2 )
687
+ srcu_read_unlock_nmisafe (srcu_ctlp , (idx & 0x2 ) >> 1 );
688
+ if ((reader_flavor & 0x1 ) || !(reader_flavor & 0x7 ))
689
+ srcu_read_unlock (srcu_ctlp , idx & 0x1 );
678
690
}
679
691
680
692
static int torture_srcu_read_lock_held (void )
@@ -2389,6 +2401,7 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag)
2389
2401
"n_barrier_cbs=%d "
2390
2402
"onoff_interval=%d onoff_holdoff=%d "
2391
2403
"read_exit_delay=%d read_exit_burst=%d "
2404
+ "reader_flavor=%x "
2392
2405
"nocbs_nthreads=%d nocbs_toggle=%d "
2393
2406
"test_nmis=%d\n" ,
2394
2407
torture_type , tag , nrealreaders , nfakewriters ,
@@ -2401,6 +2414,7 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag)
2401
2414
n_barrier_cbs ,
2402
2415
onoff_interval , onoff_holdoff ,
2403
2416
read_exit_delay , read_exit_burst ,
2417
+ reader_flavor ,
2404
2418
nocbs_nthreads , nocbs_toggle ,
2405
2419
test_nmis );
2406
2420
}
0 commit comments