[patch V3 16/23] x86/entry/64: Mark ___preempt_schedule_notrace() thunk noinstr

From: Thomas Gleixner
Date: Fri Mar 20 2020 - 14:38:34 EST


Code calling this from noinstr sections, e.g. entry code, has interrupts
disabled, so the actual call into the scheduler code does not happen.

The objtool section check complains nevertheless, so mark the call "safe".

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
arch/x86/entry/thunk_64.S | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

--- a/arch/x86/entry/thunk_64.S
+++ b/arch/x86/entry/thunk_64.S
@@ -49,7 +49,22 @@ SYM_FUNC_START_NOALIGN(\name)
movq 8(%rbp), %rdi
.endif

+ .if \check_if
+1:
+ .pushsection .discard.instr_begin
+ .long 1b - .
+ .popsection
+
+ call \func
+2:
+ .pushsection .discard.instr_end
+ .long 2b - .
+ .popsection
+
+ .else
call \func
+ .endif
+
jmp .L_restore
SYM_FUNC_END(\name)
_ASM_NOKPROBE(\name)
@@ -68,13 +83,16 @@ SYM_FUNC_END(\name)
THUNK ___preempt_schedule, preempt_schedule
EXPORT_SYMBOL(___preempt_schedule)

+.pushsection .noinstr.text, "ax"
THUNK ___preempt_schedule_notrace, preempt_schedule_notrace, check_if=1
+.popsection
EXPORT_SYMBOL(___preempt_schedule_notrace)
#endif

#if defined(CONFIG_TRACE_IRQFLAGS) \
|| defined(CONFIG_DEBUG_LOCK_ALLOC) \
|| defined(CONFIG_PREEMPTION)
+.section .noinstr.text, "ax"
SYM_CODE_START_LOCAL_NOALIGN(.L_restore)
popq %r11
popq %r10