From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755068AbdIFWqd (ORCPT ); Wed, 6 Sep 2017 18:46:33 -0400 Received: from mga05.intel.com ([192.55.52.43]:39086 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753053AbdIFWq1 (ORCPT ); Wed, 6 Sep 2017 18:46:27 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,355,1500966000"; d="scan'208";a="132548046" From: Miguel Bernal Marin To: Josh Poimboeuf , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: linux-kernel@vger.kernel.org, x86@kernel.org Subject: [PATCH v2 2/3] locking/rwsem/x86: Add stack frame dependency for __up_write() Date: Wed, 6 Sep 2017 17:45:00 -0500 Message-Id: <20170906224501.11816-3-miguel.bernal.marin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170906224501.11816-1-miguel.bernal.marin@linux.intel.com> References: <20170906052613.30058-1-miguel.bernal.marin@linux.intel.com> <20170906224501.11816-1-miguel.bernal.marin@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kernel/locking/rwsem.o: warning: objtool: up_write()+0x17: call without frame pointer save/setup The warning means gcc 7.2.0 placed the __up_write() inline asm (and its call instruction) before the frame pointer setup in up_write(), 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 762167afaec0..d26b6916b935 100644 --- a/arch/x86/include/asm/rwsem.h +++ b/arch/x86/include/asm/rwsem.h @@ -186,14 +186,16 @@ static inline void __up_read(struct rw_semaphore *sem) static inline void __up_write(struct rw_semaphore *sem) { long tmp; + register void *__sp asm(_ASM_SP); + asm volatile("# beginning __up_write\n\t" - LOCK_PREFIX " xadd %1,(%2)\n\t" + LOCK_PREFIX " xadd %1,(%3)\n\t" /* subtracts 0xffff0001, returns the old value */ " jns 1f\n\t" " call call_rwsem_wake\n" /* expects old value in %edx */ "1:\n\t" "# ending __up_write\n" - : "+m" (sem->count), "=d" (tmp) + : "+m" (sem->count), "=d" (tmp), "+r" (__sp) : "a" (sem), "1" (-RWSEM_ACTIVE_WRITE_BIAS) : "memory", "cc"); } -- 2.14.1