1. Jun 21, 2022
    • Paul E. McKenney's avatar
      rcu-tasks: Make RCU Tasks Trace stall warning handle idle offline tasks · f90f19da
      Paul E. McKenney authored
      
      
      When a CPU is offline, its idle task can appear to be running, but it
      cannot be doing anything while CPU-hotplug operations are excluded.
      This commit takes advantage of that fact by making trc_check_slow_task()
      check for task_curr(t) && cpu_online(task_cpu(t)), and recording
      full information in that case.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: KP Singh <kpsingh@kernel.org>
      f90f19da
    • Paul E. McKenney's avatar
      rcu-tasks: Make RCU Tasks Trace stall warnings print full .b.need_qs field · be15a164
      Paul E. McKenney authored
      
      
      Currently, the RCU Tasks Trace CPU stall warning simply indicates
      whether or not the .b.need_qs field is zero.  This commit shows the
      three permitted values and flags other values with either "!" or "?".
      This is a debugging aid.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: KP Singh <kpsingh@kernel.org>
      be15a164
    • Paul E. McKenney's avatar
      rcu-tasks: Flag offline CPUs in RCU Tasks Trace stall warnings · c8c03ad9
      Paul E. McKenney authored
      
      
      This commit tags offline CPUs with "(offline)" in RCU Tasks Trace CPU
      stall warnings.  This is a debugging aid.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: KP Singh <kpsingh@kernel.org>
      c8c03ad9
    • Paul E. McKenney's avatar
      rcu-tasks: Add slow-IPI indicator to RCU Tasks Trace stall warnings · 9f3eb5fb
      Paul E. McKenney authored
      
      
      This commit adds a "I" indicator to the RCU Tasks Trace CPU stall
      warning when an IPI directed to a task has thus far failed to arrive.
      This serves as a debugging aid.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: KP Singh <kpsingh@kernel.org>
      9f3eb5fb
    • Paul E. McKenney's avatar
      rcu-tasks: Simplify trc_inspect_reader() QS logic · 0968e892
      Paul E. McKenney authored
      
      
      Currently, trc_inspect_reader() does one check for nesting less than
      or equal to zero, then sorts out the distinctions within this single
      "if" statement.  This commit simplifies the logic by providing one
      "if" statement for quiescent states (nesting of zero) and another "if"
      statement for transitioning from one nesting level to another or the
      outermost rcu_read_unlock_trace() (negative nesting).
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: KP Singh <kpsingh@kernel.org>
      0968e892
    • Paul E. McKenney's avatar
      rcu-tasks: Make rcu_note_context_switch() unconditionally call rcu_tasks_qs() · 6a694411
      Paul E. McKenney authored
      
      
      This commit makes rcu_note_context_switch() unconditionally invoke the
      rcu_tasks_qs() function, as opposed to doing so only when RCU (as opposed
      to RCU Tasks Trace) urgently needs a grace period to end.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: KP Singh <kpsingh@kernel.org>
      6a694411
    • Paul E. McKenney's avatar
      rcu-tasks: RCU Tasks Trace grace-period kthread has implicit QS · 5d4c90d7
      Paul E. McKenney authored
      
      
      Because the task driving the grace-period kthread is in quiescent state
      throughout, this commit excludes it from the list of tasks from which
      a quiescent state is needed.
      
      This does mean that attaching a sleepable BPF program to function in
      kernel/rcu/tasks.h is a bad idea, by the way.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: KP Singh <kpsingh@kernel.org>
      5d4c90d7
    • Paul E. McKenney's avatar
      rcu-tasks: Handle idle tasks for recently offlined CPUs · 897ba84d
      Paul E. McKenney authored
      
      
      This commit identifies idle tasks for recently offlined CPUs as residing
      in a quiescent state.  This is safe only because CPU-hotplug operations
      are excluded during these checks.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: KP Singh <kpsingh@kernel.org>
      897ba84d
    • Paul E. McKenney's avatar
      rcu-tasks: Idle tasks on offline CPUs are in quiescent states · 5c9a9ca4
      Paul E. McKenney authored
      
      
      Any idle task corresponding to an offline CPU is in an RCU Tasks Trace
      quiescent state.  This commit causes rcu_tasks_trace_postscan() to ignore
      idle tasks for offline CPUs, which it can do safely due to CPU-hotplug
      operations being disabled.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: KP Singh <kpsingh@kernel.org>
      5c9a9ca4
    • Paul E. McKenney's avatar
      rcu-tasks: Make trc_read_check_handler() fetch ->trc_reader_nesting only once · 9ff86b4c
      Paul E. McKenney authored
      
      
      This commit replaces the pair of READ_ONCE(t->trc_reader_nesting) calls
      with a single such call and a local variable.  This makes the code's
      intent more clear.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: KP Singh <kpsingh@kernel.org>
      9ff86b4c
    • Paul E. McKenney's avatar
      rcu-tasks: Remove rcu_tasks_trace_postgp() wait for counter · 55061126
      Paul E. McKenney authored
      
      
      Now that tasks are not removed from the list until they have responded to
      any needed request for a quiescent state, it is no longer necessary to
      wait for the trc_n_readers_need_end counter to go to zero.  This commit
      therefore removes that waiting code.
      
      It is therefore also no longer necessary for rcu_tasks_trace_postgp() to
      do the final decrement of this counter, so that code is also removed.
      This in turn means that trc_n_readers_need_end counter itself can
      be removed, as can the rcu_tasks_trace_iw irq_work structure and the
      rcu_read_unlock_iw() function.
      
      [ paulmck: Apply feedback from Zqiang. ]
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: KP Singh <kpsingh@kernel.org>
      55061126
    • Paul E. McKenney's avatar
      rcu-tasks: Merge state into .b.need_qs and atomically update · 3847b645
      Paul E. McKenney authored
      
      
      This commit gets rid of the task_struct structure's ->trc_reader_checked
      field, making it instead be a bit within the task_struct structure's
      existing ->trc_reader_special.b.need_qs field.  This commit also
      atomically loads, stores, and checks the resulting combination of the
      reader-checked and need-quiescent state flags.  This will in turn allow
      significant simplification of the rcu_tasks_trace_postgp() function
      as well as elimination of the trc_n_readers_need_end counter in later
      commits.  These changes will in turn simplify later elimination of the
      RCU Tasks Trace scan of the task list, which will make RCU Tasks Trace
      grace periods less CPU-intensive.
      
      [ paulmck: Apply kernel test robot feedback. ]
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: KP Singh <kpsingh@kernel.org>
      3847b645
    • Paul E. McKenney's avatar
      rcu-tasks: Drive synchronous grace periods from calling task · 4a8cc433
      Paul E. McKenney authored
      
      
      This commit causes synchronous grace periods to be driven from the task
      invoking synchronize_rcu_*(), allowing these functions to be invoked from
      the mid-boot dead zone extending from when the scheduler was initialized
      to to point that the various RCU tasks grace-period kthreads are spawned.
      This change will allow the self-tests to run in a consistent manner.
      
      Reported-by: default avatarMatthew Wilcox <willy@infradead.org>
      Reported-by: default avatarZhouyi Zhou <zhouzhouyi@gmail.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      4a8cc433
    • Paul E. McKenney's avatar
      rcu-tasks: Move synchronize_rcu_tasks_generic() down · 68cb4720
      Paul E. McKenney authored
      
      
      This is strictly a code-motion commit that moves the
      synchronize_rcu_tasks_generic() down to where it can invoke
      rcu_tasks_one_gp() without the need for a forward declaration.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      68cb4720
    • Paul E. McKenney's avatar
      rcu-tasks: Split rcu_tasks_one_gp() from rcu_tasks_kthread() · d96225fd
      Paul E. McKenney authored
      
      
      This commit abstracts most of the rcu_tasks_kthread() function's loop
      body into a new rcu_tasks_one_gp() function.  It also introduces
      a new ->tasks_gp_mutex to synchronize concurrent calls to this new
      rcu_tasks_one_gp() function.  This commit is preparation for allowing
      RCU tasks grace periods to be driven by the calling task during the
      mid-boot dead zone.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      d96225fd
    • Paul E. McKenney's avatar
      rcu-tasks: Check for abandoned callbacks · 4cf0585c
      Paul E. McKenney authored
      
      
      This commit adds a debugging scan for callbacks that got lost during a
      callback-queueing transition.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      4cf0585c
  2. Jun 20, 2022
  3. Jun 19, 2022
  4. Jun 18, 2022