@@ -1528,7 +1528,7 @@ static void do_rtws_sync(struct torture_random_state *trsp, void (*sync)(void))
15281528static int
15291529rcu_torture_writer (void * arg )
15301530{
1531- bool boot_ended ;
1531+ bool booting_still = false ;
15321532 bool can_expedite = !rcu_gp_is_expedited () && !rcu_gp_is_normal ();
15331533 unsigned long cookie ;
15341534 struct rcu_gp_oldstate cookie_full ;
@@ -1539,6 +1539,7 @@ rcu_torture_writer(void *arg)
15391539 struct rcu_gp_oldstate gp_snap1_full ;
15401540 int i ;
15411541 int idx ;
1542+ unsigned long j ;
15421543 int oldnice = task_nice (current );
15431544 struct rcu_gp_oldstate * rgo = NULL ;
15441545 int rgo_size = 0 ;
@@ -1571,16 +1572,26 @@ rcu_torture_writer(void *arg)
15711572 return 0 ;
15721573 }
15731574 if (cur_ops -> poll_active > 0 ) {
1574- ulo = kzalloc (cur_ops -> poll_active * sizeof (ulo [ 0 ] ), GFP_KERNEL );
1575+ ulo = kcalloc (cur_ops -> poll_active , sizeof (* ulo ), GFP_KERNEL );
15751576 if (!WARN_ON (!ulo ))
15761577 ulo_size = cur_ops -> poll_active ;
15771578 }
15781579 if (cur_ops -> poll_active_full > 0 ) {
1579- rgo = kzalloc (cur_ops -> poll_active_full * sizeof (rgo [ 0 ] ), GFP_KERNEL );
1580+ rgo = kcalloc (cur_ops -> poll_active_full , sizeof (* rgo ), GFP_KERNEL );
15801581 if (!WARN_ON (!rgo ))
15811582 rgo_size = cur_ops -> poll_active_full ;
15821583 }
15831584
1585+ // If the system is still booting, let it finish.
1586+ j = jiffies ;
1587+ while (!torture_must_stop () && !rcu_inkernel_boot_has_ended ()) {
1588+ booting_still = true;
1589+ schedule_timeout_interruptible (HZ );
1590+ }
1591+ if (booting_still )
1592+ pr_alert ("%s" TORTURE_FLAG " Waited %lu jiffies for boot to complete.\n" ,
1593+ torture_type , jiffies - j );
1594+
15841595 do {
15851596 rcu_torture_writer_state = RTWS_FIXED_DELAY ;
15861597 torture_hrtimeout_us (500 , 1000 , & rand );
@@ -1769,13 +1780,11 @@ rcu_torture_writer(void *arg)
17691780 !rcu_gp_is_normal ();
17701781 }
17711782 rcu_torture_writer_state = RTWS_STUTTER ;
1772- boot_ended = rcu_inkernel_boot_has_ended ();
17731783 stutter_waited = stutter_wait ("rcu_torture_writer" );
17741784 if (stutter_waited &&
17751785 !atomic_read (& rcu_fwd_cb_nodelay ) &&
17761786 !cur_ops -> slow_gps &&
17771787 !torture_must_stop () &&
1778- boot_ended &&
17791788 time_after (jiffies , stallsdone ))
17801789 for (i = 0 ; i < ARRAY_SIZE (rcu_tortures ); i ++ )
17811790 if (list_empty (& rcu_tortures [i ].rtort_free ) &&
@@ -2437,7 +2446,8 @@ rcu_torture_reader(void *arg)
24372446 torture_hrtimeout_us (500 , 1000 , & rand );
24382447 lastsleep = jiffies + 10 ;
24392448 }
2440- while (torture_num_online_cpus () < mynumonline && !torture_must_stop ())
2449+ while (!torture_must_stop () &&
2450+ (torture_num_online_cpus () < mynumonline || !rcu_inkernel_boot_has_ended ()))
24412451 schedule_timeout_interruptible (HZ / 5 );
24422452 stutter_wait ("rcu_torture_reader" );
24432453 } while (!torture_must_stop ());
@@ -2756,7 +2766,8 @@ rcu_torture_stats_print(void)
27562766 cur_ops -> stats ();
27572767 if (rtcv_snap == rcu_torture_current_version &&
27582768 rcu_access_pointer (rcu_torture_current ) &&
2759- !rcu_stall_is_suppressed ()) {
2769+ !rcu_stall_is_suppressed () &&
2770+ rcu_inkernel_boot_has_ended ()) {
27602771 int __maybe_unused flags = 0 ;
27612772 unsigned long __maybe_unused gp_seq = 0 ;
27622773
@@ -3446,6 +3457,8 @@ static int rcu_torture_fwd_prog(void *args)
34463457 int tested_tries = 0 ;
34473458
34483459 VERBOSE_TOROUT_STRING ("rcu_torture_fwd_progress task started" );
3460+ while (!rcu_inkernel_boot_has_ended ())
3461+ schedule_timeout_interruptible (HZ / 10 );
34493462 rcu_bind_current_to_nocb ();
34503463 if (!IS_ENABLED (CONFIG_SMP ) || !IS_ENABLED (CONFIG_RCU_BOOST ))
34513464 set_user_nice (current , MAX_NICE );
0 commit comments