From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751753AbdINVm1 (ORCPT ); Thu, 14 Sep 2017 17:42:27 -0400 Received: from mga01.intel.com ([192.55.52.88]:37330 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751542AbdINVm0 (ORCPT ); Thu, 14 Sep 2017 17:42:26 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,395,1500966000"; d="scan'208";a="128840986" Date: Thu, 14 Sep 2017 16:42:23 -0500 From: Miguel Bernal Marin To: Ingo Molnar Cc: Josh Poimboeuf , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" , linux-kernel@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v2 1/3] locking/rwsem/x86: Add stack frame dependency for __up_read() Message-ID: <20170914214223.GA14740@miguelinux-clr.zpn.intel.com> References: <20170906052613.30058-1-miguel.bernal.marin@linux.intel.com> <20170906224501.11816-1-miguel.bernal.marin@linux.intel.com> <20170906224501.11816-2-miguel.bernal.marin@linux.intel.com> <20170907071242.rgbw33qmjhhkujyl@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170907071242.rgbw33qmjhhkujyl@gmail.com> User-Agent: Mutt/1.9.0 (2017-09-02) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 07, 2017 at 09:12:42AM +0200, Ingo Molnar wrote: > > * Miguel Bernal Marin wrote: > > > kernel/locking/rwsem.o: warning: objtool: up_read()+0x11: call without frame pointer save/setup > > > > The warning means gcc 7.2.0 placed the __up_read() inline asm (and its > > call instruction) before the frame pointer setup in up_read(), > > which breaks frame pointer convention and can result in incorrect > > stack traces. > > > > Force a stack frame to be created before the call instruction by listing > > the stack pointer as an output operand in the inline asm statement. > > > > Signed-off-by: Miguel Bernal Marin > > --- > > arch/x86/include/asm/rwsem.h | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h > > index a34e0d4b957d..762167afaec0 100644 > > --- a/arch/x86/include/asm/rwsem.h > > +++ b/arch/x86/include/asm/rwsem.h > > @@ -166,14 +166,16 @@ static inline bool __down_write_trylock(struct rw_semaphore *sem) > > static inline void __up_read(struct rw_semaphore *sem) > > { > > long tmp; > > + register void *__sp asm(_ASM_SP); > > + > > asm volatile("# beginning __up_read\n\t" > > - LOCK_PREFIX " xadd %1,(%2)\n\t" > > + LOCK_PREFIX " xadd %1,(%3)\n\t" > > /* subtracts 1, returns the old value */ > > " jns 1f\n\t" > > " call call_rwsem_wake\n" /* expects old value in %edx */ > > "1:\n" > > "# ending __up_read\n" > > - : "+m" (sem->count), "=d" (tmp) > > + : "+m" (sem->count), "=d" (tmp), "+r" (__sp) > > : "a" (sem), "1" (-RWSEM_ACTIVE_READ_BIAS) > > : "memory", "cc"); > > Please also convert it to named operands (in separate patches!) - this apparently > BASIC inspired labeling syntax of GCC is utterly confusing, counterproductive and > somewhat embarrasing as well, considering that we write 2017. Sorry for delay response, So I will add the named operands on the v3 > > Thanks, > > Ingo -- Regards, Miguel Bernal Marin Open Source Technology Center https://clearlinux.org Intel Corporation