From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2992554AbcBSMF3 (ORCPT ); Fri, 19 Feb 2016 07:05:29 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:38543 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424067AbcBSMFX (ORCPT ); Fri, 19 Feb 2016 07:05:23 -0500 Subject: Re: [PATCH] sched/x86: Add stack frame dependency to __preempt_schedule[_notrace] To: Josh Poimboeuf , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org References: <56BDB5A8.9030006@suse.cz> <20160212144543.GA29004@treble.redhat.com> <20160212171037.GV6357@twins.programming.kicks-ass.net> <20160212183206.GB29004@treble.redhat.com> <20160212201011.GW6357@twins.programming.kicks-ass.net> <20160215163134.GA20585@treble.redhat.com> <20160215200156.GA3018@treble.redhat.com> <20160218174158.GA28230@treble.redhat.com> Cc: Peter Zijlstra , Linus Torvalds , linux-kernel@vger.kernel.org, live-patching@vger.kernel.org From: Jiri Slaby Message-ID: <56C70500.1020904@suse.cz> Date: Fri, 19 Feb 2016 13:05:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160218174158.GA28230@treble.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/18/2016, 06:41 PM, Josh Poimboeuf wrote: > If __preempt_schedule() or __preempt_schedule_notrace() is referenced at > the beginning of a function, gcc can insert the asm inline "call > ___preempt_schedule[_notrace]" instruction before setting up a stack > frame, which breaks frame pointer convention if CONFIG_FRAME_POINTER is > enabled and can result in bad stack traces. > > Force a stack frame to be created if CONFIG_FRAME_POINTER is enabled by > listing the stack pointer as an output operand for the inline asm > statements. > > Specifically this fixes the following stacktool warnings: > > stacktool: drivers/scsi/hpsa.o: hpsa_scsi_do_simple_cmd.constprop.106()+0x79: call without frame pointer save/setup ... > Reported-by: Jiri Slaby This patch and adding lbug_with_loc to global_noreturns makes all stacktool warnings go away here. > Signed-off-by: Josh Poimboeuf > --- > arch/x86/include/asm/preempt.h | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h > index 01bcde8..d397deb 100644 > --- a/arch/x86/include/asm/preempt.h > +++ b/arch/x86/include/asm/preempt.h > @@ -94,10 +94,19 @@ static __always_inline bool should_resched(int preempt_offset) > > #ifdef CONFIG_PREEMPT > extern asmlinkage void ___preempt_schedule(void); > -# define __preempt_schedule() asm ("call ___preempt_schedule") > +# define __preempt_schedule() \ > +({ \ > + register void *__sp asm(_ASM_SP); \ > + asm volatile ("call ___preempt_schedule" : "+r"(__sp)); \ > +}) > + > extern asmlinkage void preempt_schedule(void); > extern asmlinkage void ___preempt_schedule_notrace(void); > -# define __preempt_schedule_notrace() asm ("call ___preempt_schedule_notrace") > +# define __preempt_schedule_notrace() \ > +({ \ > + register void *__sp asm(_ASM_SP); \ > + asm volatile ("call ___preempt_schedule_notrace" : "+r"(__sp)); \ > +}) > extern asmlinkage void preempt_schedule_notrace(void); > #endif > > thanks, -- js suse labs