1. 01 May, 2024 1 commit
    • Uladzislau Rezki (Sony)'s avatar
      Merge branches 'fixes.2024.04.15a', 'misc.2024.04.12a',... · 64619b28
      Uladzislau Rezki (Sony) authored
      Merge branches 'fixes.2024.04.15a', 'misc.2024.04.12a', 'rcu-sync-normal-improve.2024.04.15a', 'rcu-tasks.2024.04.15a' and 'rcutorture.2024.04.15a' into rcu-merge.2024.04.15a
      
      fixes.2024.04.15a: RCU fixes
      misc.2024.04.12a: Miscellaneous fixes
      rcu-sync-normal-improve.2024.04.15a: Improving synchronize_rcu() call
      rcu-tasks.2024.04.15a: Tasks RCU updates
      rcutorture.2024.04.15a: Torture-test updates
      64619b28
  2. 16 Apr, 2024 10 commits
    • Zqiang's avatar
      rcutorture: Use rcu_gp_slow_register/unregister() only for rcutype test · 1c67318b
      Zqiang authored
      The rcu_gp_slow_register/unregister() is only useful in tests where
      torture_type=rcu, so this commit therefore generates ->gp_slow_register()
      and ->gp_slow_unregister() function pointers in the rcu_torture_ops
      structure, and slows grace periods only when these function pointers
      exist.
      Signed-off-by: default avatarZqiang <qiang.zhang1211@gmail.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
      1c67318b
    • Paul E. McKenney's avatar
      torture: Scale --do-kvfree test time · 39988fdc
      Paul E. McKenney authored
      Currently, the torture.sh --do-kvfree testing is hard-coded to ten
      minutes, ignoring the --duration argument.  This commit therefore scales
      this test duration the same as for the rcutorture tests.
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
      39988fdc
    • Zqiang's avatar
      rcutorture: Fix invalid context warning when enable srcu barrier testing · 668c0406
      Zqiang authored
      When the torture_type is set srcu or srcud and cb_barrier is
      non-zero, running the rcutorture test will trigger the
      following warning:
      
      [  163.910989][    C1] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
      [  163.910994][    C1] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1
      [  163.910999][    C1] preempt_count: 10001, expected: 0
      [  163.911002][    C1] RCU nest depth: 0, expected: 0
      [  163.911005][    C1] INFO: lockdep is turned off.
      [  163.911007][    C1] irq event stamp: 30964
      [  163.911010][    C1] hardirqs last  enabled at (30963): [<ffffffffabc7df52>] do_idle+0x362/0x500
      [  163.911018][    C1] hardirqs last disabled at (30964): [<ffffffffae616eff>] sysvec_call_function_single+0xf/0xd0
      [  163.911025][    C1] softirqs last  enabled at (0): [<ffffffffabb6475f>] copy_process+0x16ff/0x6580
      [  163.911033][    C1] softirqs last disabled at (0): [<0000000000000000>] 0x0
      [  163.911038][    C1] Preemption disabled at:
      [  163.911039][    C1] [<ffffffffacf1964b>] stack_depot_save_flags+0x24b/0x6c0
      [  163.911063][    C1] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G        W          6.8.0-rc4-rt4-yocto-preempt-rt+ #3 1e39aa9a737dd024a3275c4f835a872f673a7d3a
      [  163.911071][    C1] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014
      [  163.911075][    C1] Call Trace:
      [  163.911078][    C1]  <IRQ>
      [  163.911080][    C1]  dump_stack_lvl+0x88/0xd0
      [  163.911089][    C1]  dump_stack+0x10/0x20
      [  163.911095][    C1]  __might_resched+0x36f/0x530
      [  163.911105][    C1]  rt_spin_lock+0x82/0x1c0
      [  163.911112][    C1]  spin_lock_irqsave_ssp_contention+0xb8/0x100
      [  163.911121][    C1]  srcu_gp_start_if_needed+0x782/0xf00
      [  163.911128][    C1]  ? _raw_spin_unlock_irqrestore+0x46/0x70
      [  163.911136][    C1]  ? debug_object_active_state+0x336/0x470
      [  163.911148][    C1]  ? __pfx_srcu_gp_start_if_needed+0x10/0x10
      [  163.911156][    C1]  ? __pfx_lock_release+0x10/0x10
      [  163.911165][    C1]  ? __pfx_rcu_torture_barrier_cbf+0x10/0x10
      [  163.911188][    C1]  __call_srcu+0x9f/0xe0
      [  163.911196][    C1]  call_srcu+0x13/0x20
      [  163.911201][    C1]  srcu_torture_call+0x1b/0x30
      [  163.911224][    C1]  rcu_torture_barrier1cb+0x4a/0x60
      [  163.911247][    C1]  __flush_smp_call_function_queue+0x267/0xca0
      [  163.911256][    C1]  ? __pfx_rcu_torture_barrier1cb+0x10/0x10
      [  163.911281][    C1]  generic_smp_call_function_single_interrupt+0x13/0x20
      [  163.911288][    C1]  __sysvec_call_function_single+0x7d/0x280
      [  163.911295][    C1]  sysvec_call_function_single+0x93/0xd0
      [  163.911302][    C1]  </IRQ>
      [  163.911304][    C1]  <TASK>
      [  163.911308][    C1]  asm_sysvec_call_function_single+0x1b/0x20
      [  163.911313][    C1] RIP: 0010:default_idle+0x17/0x20
      [  163.911326][    C1] RSP: 0018:ffff888001997dc8 EFLAGS: 00000246
      [  163.911333][    C1] RAX: 0000000000000000 RBX: dffffc0000000000 RCX: ffffffffae618b51
      [  163.911337][    C1] RDX: 0000000000000000 RSI: ffffffffaea80920 RDI: ffffffffaec2de80
      [  163.911342][    C1] RBP: ffff888001997dc8 R08: 0000000000000001 R09: ffffed100d740cad
      [  163.911346][    C1] R10: ffffed100d740cac R11: ffff88806ba06563 R12: 0000000000000001
      [  163.911350][    C1] R13: ffffffffafe460c0 R14: ffffffffafe460c0 R15: 0000000000000000
      [  163.911358][    C1]  ? ct_kernel_exit.constprop.3+0x121/0x160
      [  163.911369][    C1]  ? lockdep_hardirqs_on+0xc4/0x150
      [  163.911376][    C1]  arch_cpu_idle+0x9/0x10
      [  163.911383][    C1]  default_idle_call+0x7a/0xb0
      [  163.911390][    C1]  do_idle+0x362/0x500
      [  163.911398][    C1]  ? __pfx_do_idle+0x10/0x10
      [  163.911404][    C1]  ? complete_with_flags+0x8b/0xb0
      [  163.911416][    C1]  cpu_startup_entry+0x58/0x70
      [  163.911423][    C1]  start_secondary+0x221/0x280
      [  163.911430][    C1]  ? __pfx_start_secondary+0x10/0x10
      [  163.911440][    C1]  secondary_startup_64_no_verify+0x17f/0x18b
      [  163.911455][    C1]  </TASK>
      
      This commit therefore use smp_call_on_cpu() instead of
      smp_call_function_single(), make rcu_torture_barrier1cb() invoked
      happens on task-context.
      Signed-off-by: default avatarZqiang <qiang.zhang1211@gmail.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
      668c0406
    • Zqiang's avatar
      rcutorture: Make stall-tasks directly exit when rcutorture tests end · 431315a5
      Zqiang authored
      When the rcutorture tests start to exit, the rcu_torture_cleanup() is
      invoked to stop kthreads and release resources, if the stall-task
      kthreads exist, cpu-stall has started and the rcutorture.stall_cpu
      is set to a larger value, the rcu_torture_cleanup() will be blocked
      for a long time and the hung-task may occur, this commit therefore
      add kthread_should_stop() to the loop of cpu-stall operation, when
      rcutorture tests ends, no need to wait for cpu-stall to end, exit
      directly.
      
      Use the following command to test:
      
      insmod rcutorture.ko torture_type=srcu fwd_progress=0 stat_interval=4
      stall_cpu_block=1 stall_cpu=200 stall_cpu_holdoff=10 read_exit_burst=0
      object_debug=1
      rmmod rcutorture
      
      [15361.918610] INFO: task rmmod:878 blocked for more than 122 seconds.
      [15361.918613]       Tainted: G        W
      6.8.0-rc2-yoctodev-standard+ #25
      [15361.918615] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
      disables this message.
      [15361.918616] task:rmmod           state:D stack:0     pid:878
      tgid:878   ppid:773    flags:0x00004002
      [15361.918621] Call Trace:
      [15361.918623]  <TASK>
      [15361.918626]  __schedule+0xc0d/0x28f0
      [15361.918631]  ? __pfx___schedule+0x10/0x10
      [15361.918635]  ? rcu_is_watching+0x19/0xb0
      [15361.918638]  ? schedule+0x1f6/0x290
      [15361.918642]  ? __pfx_lock_release+0x10/0x10
      [15361.918645]  ? schedule+0xc9/0x290
      [15361.918648]  ? schedule+0xc9/0x290
      [15361.918653]  ? trace_preempt_off+0x54/0x100
      [15361.918657]  ? schedule+0xc9/0x290
      [15361.918661]  schedule+0xd0/0x290
      [15361.918665]  schedule_timeout+0x56d/0x7d0
      [15361.918669]  ? debug_smp_processor_id+0x1b/0x30
      [15361.918672]  ? rcu_is_watching+0x19/0xb0
      [15361.918676]  ? __pfx_schedule_timeout+0x10/0x10
      [15361.918679]  ? debug_smp_processor_id+0x1b/0x30
      [15361.918683]  ? rcu_is_watching+0x19/0xb0
      [15361.918686]  ? wait_for_completion+0x179/0x4c0
      [15361.918690]  ? __pfx_lock_release+0x10/0x10
      [15361.918693]  ? __kasan_check_write+0x18/0x20
      [15361.918696]  ? wait_for_completion+0x9d/0x4c0
      [15361.918700]  ? _raw_spin_unlock_irq+0x36/0x50
      [15361.918703]  ? wait_for_completion+0x179/0x4c0
      [15361.918707]  ? _raw_spin_unlock_irq+0x36/0x50
      [15361.918710]  ? wait_for_completion+0x179/0x4c0
      [15361.918714]  ? trace_preempt_on+0x54/0x100
      [15361.918718]  ? wait_for_completion+0x179/0x4c0
      [15361.918723]  wait_for_completion+0x181/0x4c0
      [15361.918728]  ? __pfx_wait_for_completion+0x10/0x10
      [15361.918738]  kthread_stop+0x152/0x470
      [15361.918742]  _torture_stop_kthread+0x44/0xc0 [torture
      7af7f9cbba28271a10503b653f9e05d518fbc8c3]
      [15361.918752]  rcu_torture_cleanup+0x2ac/0xe90 [rcutorture
      f2cb1f556ee7956270927183c4c2c7749a336529]
      [15361.918766]  ? __pfx_rcu_torture_cleanup+0x10/0x10 [rcutorture
      f2cb1f556ee7956270927183c4c2c7749a336529]
      [15361.918777]  ? __kasan_check_write+0x18/0x20
      [15361.918781]  ? __mutex_unlock_slowpath+0x17c/0x670
      [15361.918789]  ? __might_fault+0xcd/0x180
      [15361.918793]  ? find_module_all+0x104/0x1d0
      [15361.918799]  __x64_sys_delete_module+0x2a4/0x3f0
      [15361.918803]  ? __pfx___x64_sys_delete_module+0x10/0x10
      [15361.918807]  ? syscall_exit_to_user_mode+0x149/0x280
      Signed-off-by: default avatarZqiang <qiang.zhang1211@gmail.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
      431315a5
    • Zqiang's avatar
      rcutorture: Removing redundant function pointer initialization · 710cf51d
      Zqiang authored
      For these rcu_torture_ops structure's objects defined by using static,
      if the value of the function pointer in its member is not set, the default
      value will be NULL, this commit therefore remove the pre-existing
      initialization of function pointers to NULL.
      Signed-off-by: default avatarZqiang <qiang.zhang1211@gmail.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
      710cf51d
    • Zqiang's avatar
      rcutorture: Make rcutorture support print rcu-tasks gp state · dddcddef
      Zqiang authored
      This commit make rcu-tasks related rcutorture test support rcu-tasks
      gp state printing when the writer stall occurs or the at the end of
      rcutorture test, and generate rcu_ops->get_gp_data() operation to
      simplify the acquisition of gp state for different types of rcutorture
      tests.
      Signed-off-by: default avatarZqiang <qiang.zhang1211@gmail.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
      dddcddef
    • Zqiang's avatar
      rcutorture: Use the gp_kthread_dbg operation specified by cur_ops · e38bf06d
      Zqiang authored
      Despite there being a cur_ops->gp_kthread_dbg(), rcu_torture_writer()
      unconditionally invokes vanilla RCU's show_rcu_gp_kthreads().  This is not
      at all helpful when some other flavor of RCU is being tested.  This commit
      therefore makes rcu_torture_writer() invoke cur_ops->gp_kthread_dbg()
      for RCU implementations providing this function.
      Signed-off-by: default avatarZqiang <qiang.zhang1211@gmail.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
      e38bf06d
    • linke li's avatar
      rcutorture: Re-use value stored to ->rtort_pipe_count instead of re-reading · a10e3cbf
      linke li authored
      Currently, the rcu_torture_pipe_update_one() writes the value (i + 1)
      to rp->rtort_pipe_count, then immediately re-reads it in order to compare
      it to RCU_TORTURE_PIPE_LEN.  This re-read is pointless because no other
      update to rp->rtort_pipe_count can occur at this point.  This commit
      therefore instead re-uses the (i + 1) value stored in the comparison
      instead of re-reading rp->rtort_pipe_count.
      Signed-off-by: default avatarlinke li <lilinke99@qq.com>
      Reviewed-by: default avatarJoel Fernandes (Google) <joel@joelfernandes.org>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
      a10e3cbf
    • Paul E. McKenney's avatar
      rcutorture: Fix rcu_torture_one_read() pipe_count overflow comment · 8b9b443f
      Paul E. McKenney authored
      The "pipe_count > RCU_TORTURE_PIPE_LEN" check has a comment saying "Should
      not happen, but...".  This is only true when testing an RCU whose grace
      periods are always long enough.  This commit therefore fixes this comment.
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Closes: https://lore.kernel.org/lkml/CAHk-=wi7rJ-eGq+xaxVfzFEgbL9tdf6Kc8Z89rCpfcQOKm74Tw@mail.gmail.com/Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
      8b9b443f
    • Paul E. McKenney's avatar
      rcutorture: Remove extraneous rcu_torture_pipe_update_one() READ_ONCE() · 8d0f9a66
      Paul E. McKenney authored
      The rcu_torture_pipe_update_one() cannot run concurrently with any updates
      of ->rtort_pipe_count, so this commit removes the extraneous READ_ONCE()
      from the read from this field.
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Closes: https://lore.kernel.org/lkml/CAHk-=wiX_zF5Mpt8kUm_LFQpYY-mshrXJPOe+wKNwiVhEUcU9g@mail.gmail.com/Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Reviewed-by: default avatarJoel Fernandes (Google) <joel@joelfernandes.org>
      Signed-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
      8d0f9a66
  3. 15 Apr, 2024 22 commits
  4. 12 Apr, 2024 2 commits
    • Paul E. McKenney's avatar
      ftrace: Choose RCU Tasks based on TASKS_RCU rather than PREEMPTION · 64ec8b6a
      Paul E. McKenney authored
      The advent of CONFIG_PREEMPT_AUTO, AKA lazy preemption, will mean that
      even kernels built with CONFIG_PREEMPT_NONE or CONFIG_PREEMPT_VOLUNTARY
      might see the occasional preemption, and that this preemption just might
      happen within a trampoline.
      
      Therefore, update ftrace_shutdown() to invoke synchronize_rcu_tasks()
      based on CONFIG_TASKS_RCU instead of CONFIG_PREEMPTION.
      
      [ paulmck: Apply Steven Rostedt feedback. ]
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Ankur Arora <ankur.a.arora@oracle.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: <linux-trace-kernel@vger.kernel.org>
      Signed-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
      64ec8b6a
    • Paul E. McKenney's avatar
      bpf: Choose RCU Tasks based on TASKS_RCU rather than PREEMPTION · 1e52af7f
      Paul E. McKenney authored
      The advent of CONFIG_PREEMPT_AUTO, AKA lazy preemption, will mean that
      even kernels built with CONFIG_PREEMPT_NONE or CONFIG_PREEMPT_VOLUNTARY
      might see the occasional preemption, and that this preemption just might
      happen within a trampoline.
      
      Therefore, update bpf_tramp_image_put() to choose call_rcu_tasks()
      based on CONFIG_TASKS_RCU instead of CONFIG_PREEMPTION.
      
      This change might enable further simplifications, but the goal of this
      effort is to make the code safe, not necessarily optimal.
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Martin KaFai Lau <martin.lau@linux.dev>
      Cc: Song Liu <song@kernel.org>
      Cc: Yonghong Song <yonghong.song@linux.dev>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Stanislav Fomichev <sdf@google.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Ankur Arora <ankur.a.arora@oracle.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: <bpf@vger.kernel.org>
      Signed-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
      1e52af7f
  5. 11 Apr, 2024 2 commits
  6. 09 Apr, 2024 3 commits