Skip to content

Commit

Permalink
stop_machine, rcu: Mark functions as notrace
Browse files Browse the repository at this point in the history
Some architectures assume that the stopped CPUs don't make function calls
to traceable functions when they are in the stopped state. See also commit
cb9d7fd ("watchdog: Mark watchdog touch functions as notrace").

Violating this assumption causes kernel crashes when switching tracer on
RISC-V.

Mark rcu_momentary_dyntick_idle() and stop_machine_yield() notrace to
prevent this.

Fixes: 4ecf0a4 ("processor: get rid of cpu_relax_yield")
Fixes: 366237e ("stop_machine: Provide RCU quiescent state in multi_cpu_stop()")
Signed-off-by: Zong Li <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Tested-by: Atish Patra <[email protected]>
Tested-by: Colin Ian King <[email protected]>
Acked-by: Steven Rostedt (VMware) <[email protected]>
Acked-by: Paul E. McKenney <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
zongbox authored and KAGA-KOKO committed Oct 26, 2020
1 parent 3650b22 commit 4230e2d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kernel/rcu/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ bool rcu_eqs_special_set(int cpu)
*
* The caller must have disabled interrupts and must not be idle.
*/
void rcu_momentary_dyntick_idle(void)
notrace void rcu_momentary_dyntick_idle(void)
{
int special;

Expand Down
2 changes: 1 addition & 1 deletion kernel/stop_machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static void ack_state(struct multi_stop_data *msdata)
set_state(msdata, msdata->state + 1);
}

void __weak stop_machine_yield(const struct cpumask *cpumask)
notrace void __weak stop_machine_yield(const struct cpumask *cpumask)
{
cpu_relax();
}
Expand Down

0 comments on commit 4230e2d

Please sign in to comment.