Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933593AbbFJNTZ (ORCPT ); Wed, 10 Jun 2015 09:19:25 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:40575 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754197AbbFJNTS (ORCPT ); Wed, 10 Jun 2015 09:19:18 -0400 Date: Wed, 10 Jun 2015 15:19:14 +0200 From: Pavel Machek To: Josh Poimboeuf Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , 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 , linux-pm@vger.kernel.org Subject: Re: [PATCH v5 07/10] x86/asm/acpi: Fix asmvalidate warnings for wakeup_64.S Message-ID: <20150610131914.GA25572@amd> References: <2817f5690aa760a601a614b738545fd60b087bbb.1433937132.git.jpoimboe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2817f5690aa760a601a614b738545fd60b087bbb.1433937132.git.jpoimboe@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3649 Lines: 100 Hi! > 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. But I see -> END. > 2. do_suspend_lowlevel() is a non-leaf callable function, so > save/restore the frame pointer with FP_SAVE/RESTORE. It does not work with the frame pointer itself. Is FP_SAVE/RESTORE still neccessary? Will you need FP_RESTORE to wakeup_long64, then? > 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. It also results in flushing the pipeline. Ok, I guess this one is unneccessary. > 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. Did you test the changes? Do you plan to make similar changes to wakeup_32.S? > 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) > This should result in no binary code changes, so that's ok with me... > ENTRY(do_suspend_lowlevel) > - subq $8, %rsp > + FP_SAVE > xorl %eax, %eax > call save_processor_state > Are you sure? Stuff like movq $saved_context, %rax movq %rsp, pt_regs_sp(%rax) follows. And you did not modify wakeup_long64, which now receives different value in saved_rsp. > @@ -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) Umm. I rather liked the direct jump. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/