rcu,sched: noinstr fixes
Peter Zijlstra
maintainercover rcu,sched: noinstr fixes
A few noinstr fixes.. I'll stick the sched one in sched/urgent, Paul could you pick up the other two?
Peter Zijlstra
maintainerPATCH 1/3 rcu: Always inline rcu_dynticks_task*_{enter,exit}()
RCU managed to grow a few noinstr violations:
vmlinux.o: warning: objtool: rcu_dynticks_eqs_enter()+0x0: call to rcu_dynticks_task_trace_enter() leaves .noinstr.text section vmlinux.o: warning: objtool: rcu_dynticks_eqs_exit()+0xe: call to rcu_dynticks_task_trace_exit() leaves .noinstr.text section
Fix them by adding __always_inline to the relevant trivial functions.
Also replace the noinstr with __always_inline for the existing rcu_dynticks_task_*() functions since noinstr would force noinline them, even when empty, which seems silly.
--- kernel/rcu/tree_plugin.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/rcu/tree_plugin.h +4 -4
@@ -1479,7 +1479,7 @@ static void rcu_bind_gp_kthread(void) }/* Record the current task on dyntick-idle entry. */ -static void noinstr rcu_dynticks_task_enter(void) +static __always_inline void rcu_dynticks_task_enter(void) {#if defined(CONFIG_TASKS_RCU ) && defined(CONFIG_NO_HZ_FULL )WRITE_ONCE (current->rcu_tasks_idle_cpu,smp_processor_id ());
@@ -1487,7 +1487,7 @@ static void noinstr rcu_dynticks_task_en }/* Record no current task on dyntick-idle exit. */ -static void noinstr rcu_dynticks_task_exit(void) +static __always_inline void rcu_dynticks_task_exit(void) {#if defined(CONFIG_TASKS_RCU ) && defined(CONFIG_NO_HZ_FULL )WRITE_ONCE (current->rcu_tasks_idle_cpu,-1 );
@@ -1495,7 +1495,7 @@ static void noinstr rcu_dynticks_task_ex }/* Turn on heavyweight RCU tasks trace readers on idle/user entry. */ -static void rcu_dynticks_task_trace_enter (void ) +static __always_inline void rcu_dynticks_task_trace_enter(void) {#ifdef CONFIG_TASKS_TRACE_RCU if (IS_ENABLED (CONFIG_TASKS_TRACE_RCU_READ_MB ))
@@ -1504,7 +1504,7 @@ static void rcu_dynticks_task_trace_ente }/* Turn off heavyweight RCU tasks trace readers on idle/user exit. */ -static void rcu_dynticks_task_trace_exit (void ) +static __always_inline void rcu_dynticks_task_trace_exit(void) {#ifdef CONFIG_TASKS_TRACE_RCU if (IS_ENABLED (CONFIG_TASKS_TRACE_RCU_READ_MB ))
Re: [PATCH 1/3] rcu: Always inline rcu_dynticks_task*_{enter,exit}()
Quoted 7 lines · Peter Zijlstra
RCU managed to grow a few noinstr violations:
vmlinux.o: warning: objtool: rcu_dynticks_eqs_enter()+0x0: call to
rcu_dynticks_task_trace_enter()leaves .noinstr.text section vmlinux.o: warning: objtool: rcu_dynticks_eqs_exit()+0xe: call torcu_dynticks_task_trace_exit()leaves .noinstr.text sectionFix them by adding
__always_inlineto the relevant trivial functions.
Quoted 7 lines
Also replace the noinstr with
__always_inlinefor the existing rcu_dynticks_task_*() functions since noinstr would force noinline them, even when empty, which seems silly.Fixes 7d0c9c50c5a1 ("rcu-tasks: Avoid IPIing userspace/idle tasks if kernel is so built")Reported-by Stephen Rothwell <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>
Paul E. McKenney
maintainerRe: [PATCH 1/3] rcu: Always inline rcu_dynticks_task*_{enter,exit}()
Quoted 13 lines · Thomas Gleixner
Quoted 11 lines · Peter Zijlstra
RCU managed to grow a few noinstr violations:
vmlinux.o: warning: objtool: rcu_dynticks_eqs_enter()+0x0: call to
rcu_dynticks_task_trace_enter()leaves .noinstr.text section vmlinux.o: warning: objtool: rcu_dynticks_eqs_exit()+0xe: call torcu_dynticks_task_trace_exit()leaves .noinstr.text sectionFix them by adding
__always_inlineto the relevant trivial functions.Also replace the noinstr with
__always_inlinefor the existing rcu_dynticks_task_*() functions since noinstr would force noinline them, even when empty, which seems silly.
Quoted 5 lines
Quoted 3 lines
Fixes 7d0c9c50c5a1 ("rcu-tasks: Avoid IPIing userspace/idle tasks if kernel is so built")Reported-by Stephen Rothwell <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>Reviewed-by Thomas Gleixner <[email protected]>
Thank you! I will apply to the pair of RCU commits at the next rebase.
Thanx, Paul
Peter Zijlstra
maintainerPATCH 2/3 rcu: Fix rcu_dynticks_curr_cpu_in_eqs() vs noinstr
In reply to Peter Zijlstra vmlinux.o: warning: objtool: rcu_nmi_enter()+0x36: call to __kasan_check_read() leaves .noinstr.text section
noinstr cannot have atomic_*() functions in because they're explicitly annotated, use arch_atomic_*().
--- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree.c +1 -1
@@ -327,7 +327,7 @@ static void rcu_dynticks_eqs_online(void*/ static __always_inline bool rcu_dynticks_curr_cpu_in_eqs(void) { -return !(atomic_read (this_cpu_ptr (&rcu_data.dynticks)) &0x1 ); +return !(arch_atomic_read (this_cpu_ptr (&rcu_data.dynticks)) &0x1 ); }/*
Re: [PATCH 2/3] rcu: Fix rcu_dynticks_curr_cpu_in_eqs() vs noinstr
Quoted 8 lines · Peter Zijlstra
vmlinux.o: warning: objtool: rcu_nmi_enter()+0x36: call to
__kasan_check_read()leaves .noinstr.text sectionnoinstr cannot have atomic_*() functions in because they're explicitly annotated, use arch_atomic_*().
Fixes 2be57f732889 ("rcu: Weaken ->dynticks accesses and updates")Reported-by Stephen Rothwell <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>
Peter Zijlstra
maintainerPATCH 3/3 sched: Always inline is_percpu_thread()
In reply to Peter Zijlstra vmlinux.o: warning: objtool: check_preemption_disabled()+0x81: call to is_percpu_thread() leaves .noinstr.text section
--- include/linux/sched.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/sched.h +1 -1
@@ -1730,7 +1730,7 @@ extern struct pid *cad_pid;#define tsk_used_math (p) ((p)->flags & PF_USED_MATH)#define used_math () tsk_used_math(current) -static inline bool is_percpu_thread (void ) +static __always_inline bool is_percpu_thread(void) {#ifdef CONFIG_SMP return (current->flags & PF_NO_SETAFFINITY) &&
Re: [PATCH 3/3] sched: Always inline is_percpu_thread()
Quoted 4 lines · Peter Zijlstra
vmlinux.o: warning: objtool: check_preemption_disabled()+0x81: call to
is_percpu_thread()leaves .noinstr.text sectionReported-by Stephen Rothwell <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>
[tip: sched/urgent] sched: Always inline is_percpu_thread()
In reply to Peter ZijlstraThe following commit has been merged into the sched/urgent branch of tip:
The following commit has been merged into the sched/urgent branch of tip:
Commit-ID: 83d40a61046f73103b4e5d8f1310261487ff63b0 Gitweb: https://git.kernel.org/tip/83d40a61046f73103b4e5d8f1310261487ff63b0 Author: Peter Zijlstra <[email protected]> AuthorDate: Mon, 20 Sep 2021 15:31:11 +02:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Fri, 01 Oct 2021 13:57:57 +02:00
sched: Always inline is_percpu_thread()
vmlinux.o: warning: objtool: check_preemption_disabled()+0x81: call to is_percpu_thread() leaves .noinstr.text section
--- include/linux/sched.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/sched.h +1 -1
@@ -1720,7 +1720,7 @@ extern struct pid *cad_pid;#define tsk_used_math (p) ((p)->flags & PF_USED_MATH)#define used_math () tsk_used_math(current) -static inline bool is_percpu_thread (void ) +static __always_inline bool is_percpu_thread(void) {#ifdef CONFIG_SMP return (current->flags & PF_NO_SETAFFINITY) &&
Quoted 1 line · Peter Zijlstra
A few noinstr fixes.. I'll stick the sched one in sched/urgent, Paul could you pick up the other two?
I queued those two, thank you! I am guessing that you are looking for me to send them ASAP. If so, not a problem, but please confirm.
After all, yes, these are simple and low-risk, but in the absence of any need to hurry them, extended testing is even lower risk. ;-)
Thanx, Paul
Peter Zijlstra
maintainerQuoted 5 lines · Paul E. McKenney
Quoted 1 line · Peter Zijlstra
A few noinstr fixes.. I'll stick the sched one in sched/urgent, Paul could you pick up the other two?
I queued those two, thank you! I am guessing that you are looking for me to send them ASAP. If so, not a problem, but please confirm.
Either way works, but given syzcaller could potentially trigger these holes (it did find a whole bunch of 'interesting' problems in the early noinstr days) I'd prefer them earlier rather than later.
OTOH, the objtool patches that keep triggering them all over the place are still in objtool/core for the next cycle.
Paul E. McKenney
maintainerQuoted 7 lines · Peter Zijlstra
Quoted 5 lines · Paul E. McKenney
Quoted 1 line · Peter Zijlstra
A few noinstr fixes.. I'll stick the sched one in sched/urgent, Paul could you pick up the other two?
I queued those two, thank you! I am guessing that you are looking for me to send them ASAP. If so, not a problem, but please confirm.
Quoted 6 lines
Either way works, but given syzcaller could potentially trigger these holes (it did find a whole bunch of 'interesting' problems in the early noinstr days) I'd prefer them earlier rather than later.
OTOH, the objtool patches that keep triggering them all over the place are still in objtool/core for the next cycle.
OK, let's split the difference, then. Instead of the default v5.17 merge window, I will submit them to the upcoming v5.16 merge window.
Thanx, Paul