From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21474C4332D for ; Fri, 20 Mar 2020 18:38:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D80CF20775 for ; Fri, 20 Mar 2020 18:38:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727618AbgCTSie (ORCPT ); Fri, 20 Mar 2020 14:38:34 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:36896 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727471AbgCTSiZ (ORCPT ); Fri, 20 Mar 2020 14:38:25 -0400 Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jFMXH-00023k-De for linux-kernel@vger.kernel.org; Fri, 20 Mar 2020 19:38:23 +0100 Received: from nanos.tec.linutronix.de (localhost [IPv6:::1]) by nanos.tec.linutronix.de (Postfix) with ESMTP id 9FEAC1040C6 for ; Fri, 20 Mar 2020 19:38:18 +0100 (CET) Message-Id: <20200320180034.003248957@linutronix.de> User-Agent: quilt/0.65 Date: Fri, 20 Mar 2020 19:00:12 +0100 From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Paul McKenney , Josh Poimboeuf , "Joel Fernandes (Google)" , "Steven Rostedt (VMware)" , Masami Hiramatsu , Alexei Starovoitov , Frederic Weisbecker , Mathieu Desnoyers , Brian Gerst , Juergen Gross , Alexandre Chartre , Peter Zijlstra , Tom Lendacky , Paolo Bonzini , kvm@vger.kernel.org Subject: [patch V3 16/23] x86/entry/64: Mark ___preempt_schedule_notrace() thunk noinstr References: <20200320175956.033706968@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-transfer-encoding: 8-bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=3.0 tests=DATE_IN_PAST_03_06, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB451C4332D for ; Fri, 20 Mar 2020 22:05:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6ED920777 for ; Fri, 20 Mar 2020 22:05:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727789AbgCTWFi (ORCPT ); Fri, 20 Mar 2020 18:05:38 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:37490 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727372AbgCTWEP (ORCPT ); Fri, 20 Mar 2020 18:04:15 -0400 Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jFPk8-0004bo-Q3; Fri, 20 Mar 2020 23:03:52 +0100 Received: from nanos.tec.linutronix.de (localhost [IPv6:::1]) by nanos.tec.linutronix.de (Postfix) with ESMTP id 965401040C6; Fri, 20 Mar 2020 23:03:48 +0100 (CET) Message-Id: <20200320180034.003248957@linutronix.de> User-Agent: quilt/0.65 Date: Fri, 20 Mar 2020 19:00:12 +0100 From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Paul McKenney , Josh Poimboeuf , "Joel Fernandes (Google)" , "Steven Rostedt (VMware)" , Masami Hiramatsu , Alexei Starovoitov , Frederic Weisbecker , Mathieu Desnoyers , Brian Gerst , Juergen Gross , Alexandre Chartre , Peter Zijlstra , Tom Lendacky , Paolo Bonzini , kvm@vger.kernel.org Subject: [RESEND][patch V3 16/23] x86/entry/64: Mark ___preempt_schedule_notrace() thunk noinstr References: <20200320175956.033706968@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-transfer-encoding: 8-bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Message-ID: <20200320180012._0Gv8ade9q1ZP2qvRN_iDuNLFyAfgkZWH7_EBnSHDTU@z> 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 --- 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