From patchwork Wed Jun 10 12:06:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Poimboeuf X-Patchwork-Id: 6578881 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8E58B9F1C1 for ; Wed, 10 Jun 2015 12:09:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7BAD320601 for ; Wed, 10 Jun 2015 12:09:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5AB6920576 for ; Wed, 10 Jun 2015 12:09:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932876AbbFJMJL (ORCPT ); Wed, 10 Jun 2015 08:09:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37623 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933310AbbFJMHS (ORCPT ); Wed, 10 Jun 2015 08:07:18 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 21E46CA645; Wed, 10 Jun 2015 12:07:18 +0000 (UTC) Received: from treble.redhat.com (ovpn-113-89.phx2.redhat.com [10.3.113.89]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5AC726q013878; Wed, 10 Jun 2015 08:07:14 -0400 From: Josh Poimboeuf To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Cc: Michal Marek , Peter Zijlstra , Andy Lutomirski , Borislav Petkov , Linus Torvalds , Andi Kleen , x86@kernel.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Subject: [PATCH v5 07/10] x86/asm/acpi: Fix asmvalidate warnings for wakeup_64.S Date: Wed, 10 Jun 2015 07:06:15 -0500 Message-Id: <2817f5690aa760a601a614b738545fd60b087bbb.1433937132.git.jpoimboe@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix the following asmvalidate warnings: asmvalidate: arch/x86/kernel/acpi/wakeup_64.o: wakeup_long64()+0x15: unsupported jump to outside of function asmvalidate: arch/x86/kernel/acpi/wakeup_64.o: wakeup_long64()+0x55: unsupported jump to outside of function asmvalidate: arch/x86/kernel/acpi/wakeup_64.o: wakeup_long64(): unsupported fallthrough at end of function asmvalidate: arch/x86/kernel/acpi/wakeup_64.o: do_suspend_lowlevel()+0x9a: unsupported jump to outside of function asmvalidate: arch/x86/kernel/acpi/wakeup_64.o: do_suspend_lowlevel()+0x116: unsupported jump to outside of function asmvalidate: arch/x86/kernel/acpi/wakeup_64.o: do_suspend_lowlevel(): unsupported fallthrough at end of function asmvalidate: arch/x86/kernel/acpi/wakeup_64.o: do_suspend_lowlevel(): missing FP_SAVE/RESTORE macros 1. wakeup_long64() isn't a function that can be called. It's actually redirected to via a return instruction in the entry code. It shouldn't be annotated as a callable function. Change ENDPROC -> PROC accordingly. 2. do_suspend_lowlevel() is a non-leaf callable function, so save/restore the frame pointer with FP_SAVE/RESTORE. 3. Remove the unnecessary jump to .Lresume_point, as it just results in jumping to the next instruction (which is a nop because of the align). Otherwise asmvalidate gets confused by the jump. 4. Change the "jmp restore_processor_state" to a call instruction, because jumping outside the function's boundaries isn't allowed. Now restore_processor_state() will return back to do_suspend_lowlevel() instead of do_suspend_lowlevel()'s caller. 5. Remove superfluous rsp changes. Signed-off-by: Josh Poimboeuf Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Pavel Machek Cc: linux-pm@vger.kernel.org Acked-by: Pavel Machek --- arch/x86/kernel/acpi/wakeup_64.S | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S index 8c35df4..7e442be 100644 --- a/arch/x86/kernel/acpi/wakeup_64.S +++ b/arch/x86/kernel/acpi/wakeup_64.S @@ -5,6 +5,7 @@ #include #include #include +#include # Copyright 2003 Pavel Machek , distribute under GPLv2 @@ -33,13 +34,13 @@ ENTRY(wakeup_long64) movq saved_rip, %rax jmp *%rax -ENDPROC(wakeup_long64) +END(wakeup_long64) bogus_64_magic: jmp bogus_64_magic ENTRY(do_suspend_lowlevel) - subq $8, %rsp + FP_SAVE xorl %eax, %eax call save_processor_state @@ -70,12 +71,11 @@ ENTRY(do_suspend_lowlevel) movq %rdi, saved_rdi movq %rsi, saved_rsi - addq $8, %rsp movl $3, %edi xorl %eax, %eax call x86_acpi_enter_sleep_state + /* in case something went wrong, restore the machine status and go on */ - jmp .Lresume_point .align 4 .Lresume_point: @@ -108,8 +108,9 @@ ENTRY(do_suspend_lowlevel) movq pt_regs_r15(%rax), %r15 xorl %eax, %eax - addq $8, %rsp - jmp restore_processor_state + call restore_processor_state + FP_RESTORE + ret ENDPROC(do_suspend_lowlevel) .data