From: Ingo Molnar <mingo@kernel.org>
To: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
"H . Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH v2 1/3] locking/rwsem/x86: Add stack frame dependency for __up_read()
Date: Thu, 7 Sep 2017 09:12:42 +0200 [thread overview]
Message-ID: <20170907071242.rgbw33qmjhhkujyl@gmail.com> (raw)
In-Reply-To: <20170906224501.11816-2-miguel.bernal.marin@linux.intel.com>
* Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> 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 <miguel.bernal.marin@linux.intel.com>
> ---
> 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.
Thanks,
Ingo
next prev parent reply other threads:[~2017-09-07 7:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 5:26 [PATCH 0/3] locking/rwsem/x86: Add stack frame dependency for some inline asm Miguel Bernal Marin
2017-09-06 5:26 ` [PATCH 1/3] locking/rwsem/x86: Add stack frame dependency for __up_read() Miguel Bernal Marin
2017-09-06 5:26 ` [PATCH 2/3] locking/rwsem/x86: Add stack frame dependency for __up_write() Miguel Bernal Marin
2017-09-06 5:26 ` [PATCH 3/3] locking/rwsem/x86: Add stack frame dependency for __downgrade_write() Miguel Bernal Marin
2017-09-06 21:33 ` Josh Poimboeuf
2017-09-06 22:14 ` Miguel Bernal Marin
2017-09-07 7:04 ` Peter Zijlstra
2017-09-06 22:44 ` [PATCH v2 0/3] locking/rwsem/x86: Add stack frame dependency for some inline asm Miguel Bernal Marin
2017-09-06 22:44 ` [PATCH v2 1/3] locking/rwsem/x86: Add stack frame dependency for __up_read() Miguel Bernal Marin
2017-09-07 7:12 ` Ingo Molnar [this message]
2017-09-14 21:42 ` Miguel Bernal Marin
2017-09-06 22:45 ` [PATCH v2 2/3] locking/rwsem/x86: Add stack frame dependency for __up_write() Miguel Bernal Marin
2017-09-06 22:45 ` [PATCH v2 3/3] locking/rwsem/x86: Add stack frame dependency for __downgrade_write() Miguel Bernal Marin
2017-09-06 23:05 ` [PATCH v2 0/3] locking/rwsem/x86: Add stack frame dependency for some inline asm Josh Poimboeuf
2017-09-19 23:37 ` [PATCH v3 0/6] " Miguel Bernal Marin
2017-09-19 23:37 ` [PATCH v3 1/6] locking/rwsem/x86: Add stack frame dependency for __up_read() Miguel Bernal Marin
2017-09-19 23:37 ` [PATCH v3 2/6] locking/rwsem/x86: Add stack frame dependency for __up_write() Miguel Bernal Marin
2017-09-19 23:37 ` [PATCH v3 3/6] locking/rwsem/x86: Add stack frame dependency for __downgrade_write() Miguel Bernal Marin
2017-09-19 23:37 ` [PATCH v3 4/6] x86, asm/rwsem: Use named operands in __up_read() Miguel Bernal Marin
2017-09-19 23:37 ` [PATCH v3 5/6] x86, asm/rwsem: Use named operands in __up_write() Miguel Bernal Marin
2017-09-19 23:37 ` [PATCH v3 6/6] x86, asm/rwsem: Use named operands in __downgrade_write() Miguel Bernal Marin
2017-09-20 21:24 ` [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm Josh Poimboeuf
2017-09-21 16:59 ` Miguel Bernal Marin
2017-09-25 17:34 ` Miguel Bernal Marin
2017-09-25 19:00 ` Josh Poimboeuf
2017-09-25 19:03 ` Josh Poimboeuf
2017-09-25 21:34 ` Miguel Bernal Marin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170907071242.rgbw33qmjhhkujyl@gmail.com \
--to=mingo@kernel.org \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.bernal.marin@linux.intel.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®