1. 12 Apr, 2022 6 commits
    • Frederic Weisbecker's avatar
      rcutorture: Call preempt_schedule() through static call/key · bd6c375b
      Frederic Weisbecker authored
      The rcutorture test suite sometimess triggers a random scheduler
      preemption call while simulating a read delay.  Unfortunately, its
      direct call to preempt_schedule() bypasses the static call/key filter
      used by CONFIG_PREEMPT_DYNAMIC.  This breaks the no-preempt assumption
      when the dynamic preemption mode is "none".
      
      For example, rcu_blocking_is_gp() is fooled and abbreviates grace periods
      when the CPU runs in no-preempt UP mode.
      
      Fix this by making torture_preempt_schedule() call __preempt_schedule(),
      which uses the static call/key.
      Reported-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarFrederic Weisbecker <frederic@kernel.org>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      bd6c375b
    • David Vernet's avatar
      rcutorture: Add missing return and use __func__ in warning · 80dcee69
      David Vernet authored
      The rcutorture module has an rcu_torture_writer task that repeatedly
      performs writes, synchronizations, and deletes. There is a corner-case
      check in rcu_torture_writer() wherein if nsynctypes is 0, a warning is
      issued and the task waits to be stopped via a call to
      torture_kthread_stopping() rather than performing any work.
      
      There should be a return statement following this call to
      torture_kthread_stopping(), as the intention with issuing the call to
      torture_kthread_stopping() in the first place is to avoid the
      rcu_torture_writer task from performing any work. Some of the work may even
      be dangerous to perform, such as potentially causing a #DE due to
      nsynctypes being used in a modulo operator when querying for sync updates
      to issue.
      
      This patch adds the missing return call.  As a bonus, it also fixes a
      checkpatch warning that was emitted due to the WARN_ONCE() call using the
      name of the function rather than __func__.
      Signed-off-by: default avatarDavid Vernet <void@manifault.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      80dcee69
    • David Vernet's avatar
      rcutorture: Avoid corner-case #DE with nsynctypes check · 39b3cab9
      David Vernet authored
      The rcutorture module is used to run torture tests that validate RCU.
      rcutorture takes a variety of module parameters that configure the
      functionality of the test. Amongst these parameters are the types of
      synchronization mechanisms that the rcu_torture_writer and
      rcu_torture_fakewriter tasks may use, and the torture_type of the run which
      determines what read and sync operations are used by the various writer and
      reader tasks that run throughout the test.
      
      When the module is configured to only use sync types for which the
      specified torture_type does not implement the necessary operations, we can
      end up in a state where nsynctypes is 0. This is not an erroneous state,
      but it currently crashes the kernel with a #DE due to nsynctypes being used
      with a modulo operator in rcu_torture_fakewriter().
      
      Here is an example of such a #DE:
      
      $ insmod ./rcutorture.ko gp_cond=1 gp_cond_exp=0 gp_exp=0 gp_poll_exp=0
      gp_normal=0 gp_poll=0 gp_poll_exp=0 verbose=9999 torture_type=trivial
      
      ...
      
      [ 8536.525096] divide error: 0000 [#1] PREEMPT SMP PTI
      [ 8536.525101] CPU: 30 PID: 392138 Comm: rcu_torture_fak Kdump: loaded Tainted: G S                5.17.0-rc1-00179-gc8c42c80febd #24
      [ 8536.525105] Hardware name: Quanta Twin Lakes MP/Twin Lakes Passive MP, BIOS F09_3A23 12/08/2020
      [ 8536.525106] RIP: 0010:rcu_torture_fakewriter+0xf1/0x2d0 [rcutorture]
      [ 8536.525121] Code: 00 31 d2 8d 0c f5 00 00 00 00 48 63 c9 48 f7 f1 48 85 d2 0f 84 79 ff ff ff 48 89 e7 e8 78 78 01 00 48 63 0d 29 ca 00 00 31 d2 <48> f7 f1 8b 04 95 00 05 4e a0 83 f8 06 0f 84 ad 00 00 00 7f 1f 83
      [ 8536.525124] RSP: 0018:ffffc9000777fef0 EFLAGS: 00010246
      [ 8536.525127] RAX: 00000000223d006e RBX: cccccccccccccccd RCX: 0000000000000000
      [ 8536.525130] RDX: 0000000000000000 RSI: ffffffff824315b9 RDI: ffffc9000777fef0
      [ 8536.525132] RBP: ffffc9000487bb30 R08: 0000000000000002 R09: 000000000002a580
      [ 8536.525134] R10: ffffffff82c5f920 R11: 0000000000000000 R12: ffff8881a2c35d00
      [ 8536.525136] R13: ffff8881540c8d00 R14: ffffffffa04d39d0 R15: 0000000000000000
      [ 8536.525137] FS:  0000000000000000(0000) GS:ffff88903ff80000(0000) knlGS:0000000000000000
      [ 8536.525140] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 8536.525142] CR2: 00007f839f022000 CR3: 0000000002c0a006 CR4: 00000000007706e0
      [ 8536.525144] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [ 8536.525145] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [ 8536.525147] PKRU: 55555554
      [ 8536.525148] Call Trace:
      [ 8536.525150]  <TASK>
      [ 8536.525153]  kthread+0xe8/0x110
      [ 8536.525161]  ? kthread_complete_and_exit+0x20/0x20
      [ 8536.525167]  ret_from_fork+0x22/0x30
      [ 8536.525174]  </TASK>
      
      The solution is to gracefully handle the case of nsynctypes being 0 in
      rcu_torture_fakewriter() by not performing any work. This is already being
      done in rcu_torture_writer(), though there is a missing return on that path
      which will be fixed in a subsequent patch.
      Signed-off-by: default avatarDavid Vernet <void@manifault.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      39b3cab9
    • Paul E. McKenney's avatar
      scftorture: Fix distribution of short handler delays · 8106bddb
      Paul E. McKenney authored
      The scftorture test module's scf_handler() function is supposed to provide
      three different distributions of short delays (including "no delay") and
      one distribution of long delays, if specified by the scftorture.longwait
      module parameter.  However, the second of the two non-zero-wait short delays
      is disabled due to the first such delay's "goto out" not being enclosed in
      the "then" clause with the "udelay()".
      
      This commit therefore adjusts the code to provide the intended set of
      delays.
      
      Fixes: e9d338a0 ("scftorture: Add smp_call_function() torture test")
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      8106bddb
    • Paul E. McKenney's avatar
      rcutorture: Suppress debugging grace period delays during flooding · 99d6a2ac
      Paul E. McKenney authored
      Tree RCU supports grace-period delays using the rcutree.gp_cleanup_delay,
      rcutree.gp_init_delay, and rcutree.gp_preinit_delay kernel boot
      parameters.  These delays are strictly for debugging purposes, and have
      proven quite effective at exposing bugs involving race with CPU-hotplug
      operations.  However, these delays can result in false positives when
      used in conjunction with callback flooding, for example, those generated
      by the rcutorture.fwd_progress kernel boot parameter.
      
      This commit therefore suppresses grace-period delays while callback
      flooding is in progress.
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      99d6a2ac
    • Paul E. McKenney's avatar
      torture: Add rcu_normal and rcu_expedited runs to torture.sh · b6f3c6a2
      Paul E. McKenney authored
      Currently, the rcupdate.rcu_normal and rcupdate.rcu_expedited kernel
      boot parameters are not regularly tested.  The potential addition of
      polled expedited grace-period APIs increases the amount of code that is
      affected by these kernel boot parameters.  This commit therefore adds a
      "--do-rt" argument to torture.sh to exercise these kernel-boot options.
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      b6f3c6a2
  2. 03 Apr, 2022 8 commits
  3. 02 Apr, 2022 26 commits