Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735357 > unrolled thread

[PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm

Started byMiguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
First post2017-09-20 01:40 +0200
Last post2017-09-25 21:10 +0200
Articles 12 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> - 2017-09-20 01:40 +0200
    [PATCH v3 5/6] x86, asm/rwsem: Use named operands in __up_write() Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> - 2017-09-20 01:40 +0200
    [PATCH v3 2/6] locking/rwsem/x86: Add stack frame dependency for __up_write() Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> - 2017-09-20 01:40 +0200
    [PATCH v3 6/6] x86, asm/rwsem: Use named operands in __downgrade_write() Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> - 2017-09-20 01:40 +0200
    [PATCH v3 1/6] locking/rwsem/x86: Add stack frame dependency for __up_read() Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> - 2017-09-20 01:40 +0200
    [PATCH v3 4/6] x86, asm/rwsem: Use named operands in __up_read() Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> - 2017-09-20 01:40 +0200
    Re: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for  some inline asm Josh Poimboeuf <jpoimboe@redhat.com> - 2017-09-20 23:30 +0200
      Re: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for  some inline asm Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> - 2017-09-21 19:10 +0200
      Re: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for  some inline asm Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> - 2017-09-25 19:40 +0200
        Re: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for  some inline asm Josh Poimboeuf <jpoimboe@redhat.com> - 2017-09-25 21:10 +0200
          Re: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for  some inline asm Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> - 2017-09-25 23:40 +0200
        Re: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for  some inline asm Josh Poimboeuf <jpoimboe@redhat.com> - 2017-09-25 21:10 +0200

#1735357 — [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm

FromMiguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Date2017-09-20 01:40 +0200
Subject[PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm
Message-ID<urAhr-3q4-3@gated-at.bofh.it>
Some warning were showed by objtool using gcc 7.2.0

kernel/locking/rwsem.o: warning: objtool: up_read()+0x11: call without frame pointer save/setup
kernel/locking/rwsem.o: warning: objtool: up_write()+0x17: call without frame pointer save/setup
kernel/locking/rwsem.o: warning: objtool: downgrade_write()+0x22: call without frame pointer save/setup

which means gcc placed an inline asm function and its call instruction before
the frame pointer setup.
 
This series forces a stack frame to be created before the call instruction
by listing the stack pointer as an output operand in the inline asm statement.

Also to be easy to maintain and understand the operands from the extended
assembler instructions were converted to named operands.

Changes in v3:
  - Convert to named operands

Changes in v2:
  - Update first parameter from _ASM_ADD to '%3' at __downgrade_write()


Miguel Bernal Marin (6):
  locking/rwsem/x86: Add stack frame dependency for __up_read()
  locking/rwsem/x86: Add stack frame dependency for __up_write()
  locking/rwsem/x86: Add stack frame dependency for __downgrade_write()
  x86, asm/rwsem: Use named operands in __up_read()
  x86, asm/rwsem: Use named operands in __up_write()
  x86, asm/rwsem: Use named operands in __downgrade_write()

 arch/x86/include/asm/rwsem.h | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

-- 
2.14.1

[toc] | [next] | [standalone]


#1735358 — [PATCH v3 5/6] x86, asm/rwsem: Use named operands in __up_write()

FromMiguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Date2017-09-20 01:40 +0200
Subject[PATCH v3 5/6] x86, asm/rwsem: Use named operands in __up_write()
Message-ID<urAhs-3q4-9@gated-at.bofh.it>
In reply to#1735357
Since GCC version 3.1, it is possible to specify input and output
operands using symbolic names which can be referenced within the
assembler code.

Convert to named operands makes easy to understand and maintain for
future changes.

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
 arch/x86/include/asm/rwsem.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h
index 2b3fb6d316f5..3245902e961f 100644
--- a/arch/x86/include/asm/rwsem.h
+++ b/arch/x86/include/asm/rwsem.h
@@ -189,14 +189,14 @@ static inline void __up_write(struct rw_semaphore *sem)
 	register void *__sp asm(_ASM_SP);
 
 	asm volatile("# beginning __up_write\n\t"
-		     LOCK_PREFIX "  xadd      %1,(%3)\n\t"
+		     LOCK_PREFIX "  xadd      %[tmp],(%[sem])\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), "+r" (__sp)
-		     : "a" (sem), "1" (-RWSEM_ACTIVE_WRITE_BIAS)
+		     : "+m" (sem->count), [tmp] "=d" (tmp), "+r" (__sp)
+		     : [sem] "a" (sem), "[tmp]" (-RWSEM_ACTIVE_WRITE_BIAS)
 		     : "memory", "cc");
 }
 
-- 
2.14.1

[toc] | [prev] | [next] | [standalone]


#1735359 — [PATCH v3 2/6] locking/rwsem/x86: Add stack frame dependency for __up_write()

FromMiguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Date2017-09-20 01:40 +0200
Subject[PATCH v3 2/6] locking/rwsem/x86: Add stack frame dependency for __up_write()
Message-ID<urAhs-3q4-11@gated-at.bofh.it>
In reply to#1735357
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 <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 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

[toc] | [prev] | [next] | [standalone]


#1735361 — [PATCH v3 6/6] x86, asm/rwsem: Use named operands in __downgrade_write()

FromMiguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Date2017-09-20 01:40 +0200
Subject[PATCH v3 6/6] x86, asm/rwsem: Use named operands in __downgrade_write()
Message-ID<urAhs-3q4-19@gated-at.bofh.it>
In reply to#1735357
Since GCC version 3.1, it is possible to specify input and output
operands using symbolic names which can be referenced within the
assembler code.

Convert to named operands makes easy to understand and maintain for
future changes.

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
 arch/x86/include/asm/rwsem.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h
index 3245902e961f..1f5d083599ba 100644
--- a/arch/x86/include/asm/rwsem.h
+++ b/arch/x86/include/asm/rwsem.h
@@ -208,7 +208,7 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
 	register void *__sp asm(_ASM_SP);
 
 	asm volatile("# beginning __downgrade_write\n\t"
-		     LOCK_PREFIX _ASM_ADD "%3,(%2)\n\t"
+		     LOCK_PREFIX _ASM_ADD "%[inc],(%[sem])\n\t"
 		     /*
 		      * transitions 0xZZZZ0001 -> 0xYYYY0001 (i386)
 		      *     0xZZZZZZZZ00000001 -> 0xYYYYYYYY00000001 (x86_64)
@@ -218,7 +218,7 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
 		     "1:\n\t"
 		     "# ending __downgrade_write\n"
 		     : "+m" (sem->count), "+r" (__sp)
-		     : "a" (sem), "er" (-RWSEM_WAITING_BIAS)
+		     : [sem] "a" (sem), [inc] "er" (-RWSEM_WAITING_BIAS)
 		     : "memory", "cc");
 }
 
-- 
2.14.1

[toc] | [prev] | [next] | [standalone]


#1735362 — [PATCH v3 1/6] locking/rwsem/x86: Add stack frame dependency for __up_read()

FromMiguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Date2017-09-20 01:40 +0200
Subject[PATCH v3 1/6] locking/rwsem/x86: Add stack frame dependency for __up_read()
Message-ID<urAhs-3q4-17@gated-at.bofh.it>
In reply to#1735357
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");
 }
-- 
2.14.1

[toc] | [prev] | [next] | [standalone]


#1735364 — [PATCH v3 4/6] x86, asm/rwsem: Use named operands in __up_read()

FromMiguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Date2017-09-20 01:40 +0200
Subject[PATCH v3 4/6] x86, asm/rwsem: Use named operands in __up_read()
Message-ID<urAhs-3q4-27@gated-at.bofh.it>
In reply to#1735357
Since GCC version 3.1, it is possible to specify input and output
operands using symbolic names which can be referenced within the
assembler code.

Convert to named operands makes easy to understand and maintain for
future changes.

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
 arch/x86/include/asm/rwsem.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h
index 8400ad3e17dc..2b3fb6d316f5 100644
--- a/arch/x86/include/asm/rwsem.h
+++ b/arch/x86/include/asm/rwsem.h
@@ -169,14 +169,14 @@ static inline void __up_read(struct rw_semaphore *sem)
 	register void *__sp asm(_ASM_SP);
 
 	asm volatile("# beginning __up_read\n\t"
-		     LOCK_PREFIX "  xadd      %1,(%3)\n\t"
+		     LOCK_PREFIX "  xadd      %[tmp],(%[sem])\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), "+r" (__sp)
-		     : "a" (sem), "1" (-RWSEM_ACTIVE_READ_BIAS)
+		     : "+m" (sem->count), [tmp] "=d" (tmp), "+r" (__sp)
+		     : [sem] "a" (sem), "[tmp]" (-RWSEM_ACTIVE_READ_BIAS)
 		     : "memory", "cc");
 }
 
-- 
2.14.1

[toc] | [prev] | [next] | [standalone]


#1736168 — Re: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm

FromJosh Poimboeuf <jpoimboe@redhat.com>
Date2017-09-20 23:30 +0200
SubjectRe: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm
Message-ID<urUJc-8w7-31@gated-at.bofh.it>
In reply to#1735357
On Tue, Sep 19, 2017 at 06:37:39PM -0500, Miguel Bernal Marin wrote:
> Some warning were showed by objtool using gcc 7.2.0
> 
> kernel/locking/rwsem.o: warning: objtool: up_read()+0x11: call without frame pointer save/setup
> kernel/locking/rwsem.o: warning: objtool: up_write()+0x17: call without frame pointer save/setup
> kernel/locking/rwsem.o: warning: objtool: downgrade_write()+0x22: call without frame pointer save/setup
> 
> which means gcc placed an inline asm function and its call instruction before
> the frame pointer setup.
>  
> This series forces a stack frame to be created before the call instruction
> by listing the stack pointer as an output operand in the inline asm statement.
> 
> Also to be easy to maintain and understand the operands from the extended
> assembler instructions were converted to named operands.

I've got a patch going around which will change the way we do this, so
you'll probably need to do a v3 after my patch gets merged.  I'll add
you to cc for the next revision.

-- 
Josh

[toc] | [prev] | [next] | [standalone]


#1736879 — Re: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm

FromMiguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Date2017-09-21 19:10 +0200
SubjectRe: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm
Message-ID<usd99-3OI-39@gated-at.bofh.it>
In reply to#1736168
On Wed, Sep 20, 2017 at 04:24:18PM -0500, Josh Poimboeuf wrote:
> On Tue, Sep 19, 2017 at 06:37:39PM -0500, Miguel Bernal Marin wrote:
> > Some warning were showed by objtool using gcc 7.2.0
> > 
> > kernel/locking/rwsem.o: warning: objtool: up_read()+0x11: call without frame pointer save/setup
> > kernel/locking/rwsem.o: warning: objtool: up_write()+0x17: call without frame pointer save/setup
> > kernel/locking/rwsem.o: warning: objtool: downgrade_write()+0x22: call without frame pointer save/setup
> > 
> > which means gcc placed an inline asm function and its call instruction before
> > the frame pointer setup.
> >  
> > This series forces a stack frame to be created before the call instruction
> > by listing the stack pointer as an output operand in the inline asm statement.
> > 
> > Also to be easy to maintain and understand the operands from the extended
> > assembler instructions were converted to named operands.
> 
> I've got a patch going around which will change the way we do this, so
> you'll probably need to do a v3 after my patch gets merged.  I'll add
> you to cc for the next revision.
> 

Ok, I will wait to see your changes merged.

Thanks.


> -- 
> Josh

-- 
Regards,

Miguel Bernal Marin                     Open Source Technology Center
https://clearlinux.org                              Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1739190 — Re: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm

FromMiguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Date2017-09-25 19:40 +0200
SubjectRe: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm
Message-ID<utFwm-15m-13@gated-at.bofh.it>
In reply to#1736168
On Wed, Sep 20, 2017 at 04:24:18PM -0500, Josh Poimboeuf wrote:
> On Tue, Sep 19, 2017 at 06:37:39PM -0500, Miguel Bernal Marin wrote:
> > Some warning were showed by objtool using gcc 7.2.0
> > 
> > kernel/locking/rwsem.o: warning: objtool: up_read()+0x11: call without frame pointer save/setup
> > kernel/locking/rwsem.o: warning: objtool: up_write()+0x17: call without frame pointer save/setup
> > kernel/locking/rwsem.o: warning: objtool: downgrade_write()+0x22: call without frame pointer save/setup
> > 
> > which means gcc placed an inline asm function and its call instruction before
> > the frame pointer setup.
> >  
> > This series forces a stack frame to be created before the call instruction
> > by listing the stack pointer as an output operand in the inline asm statement.
> > 
> > Also to be easy to maintain and understand the operands from the extended
> > assembler instructions were converted to named operands.
> 
> I've got a patch going around which will change the way we do this, so
> you'll probably need to do a v3 after my patch gets merged.  I'll add
> you to cc for the next revision.
> 

With your new patches (at v4.14.-rc2) the warning is not seen any more,
so I will send only the named operand patches (in separate thread), as
this fix is not more needed.


> -- 
> Josh

-- 
Regards,

Miguel Bernal Marin                     Open Source Technology Center
https://clearlinux.org                              Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1739227 — Re: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm

FromJosh Poimboeuf <jpoimboe@redhat.com>
Date2017-09-25 21:10 +0200
SubjectRe: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm
Message-ID<utGVs-27d-11@gated-at.bofh.it>
In reply to#1739190
On Mon, Sep 25, 2017 at 02:00:43PM -0500, Josh Poimboeuf wrote:
> On Mon, Sep 25, 2017 at 12:34:19PM -0500, Miguel Bernal Marin wrote:
> > On Wed, Sep 20, 2017 at 04:24:18PM -0500, Josh Poimboeuf wrote:
> > > On Tue, Sep 19, 2017 at 06:37:39PM -0500, Miguel Bernal Marin wrote:
> > > > Some warning were showed by objtool using gcc 7.2.0
> > > > 
> > > > kernel/locking/rwsem.o: warning: objtool: up_read()+0x11: call without frame pointer save/setup
> > > > kernel/locking/rwsem.o: warning: objtool: up_write()+0x17: call without frame pointer save/setup
> > > > kernel/locking/rwsem.o: warning: objtool: downgrade_write()+0x22: call without frame pointer save/setup
> > > > 
> > > > which means gcc placed an inline asm function and its call instruction before
> > > > the frame pointer setup.
> > > >  
> > > > This series forces a stack frame to be created before the call instruction
> > > > by listing the stack pointer as an output operand in the inline asm statement.
> > > > 
> > > > Also to be easy to maintain and understand the operands from the extended
> > > > assembler instructions were converted to named operands.
> > > 
> > > I've got a patch going around which will change the way we do this, so
> > > you'll probably need to do a v3 after my patch gets merged.  I'll add
> > > you to cc for the next revision.
> > > 
> > 
> > With your new patches (at v4.14.-rc2) the warning is not seen any more,
> > so I will send only the named operand patches (in separate thread), as
> > this fix is not more needed.
> 
> Any chance you tested with GCC 7?  With GCC 6 and older you might still
> see the warnings.

Sorry, reading again it looks like your warnings only started showing up
in GCC 7.2.0?  If so, then it does make sense that your fix isn't needed
any more, because my patch fixed this issue for *all* inline asm for GCC
7+.

-- 
Josh

[toc] | [prev] | [next] | [standalone]


#1739290 — Re: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm

FromMiguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Date2017-09-25 23:40 +0200
SubjectRe: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm
Message-ID<utJgC-3Dz-7@gated-at.bofh.it>
In reply to#1739227
On Mon, Sep 25, 2017 at 02:03:21PM -0500, Josh Poimboeuf wrote:
> On Mon, Sep 25, 2017 at 02:00:43PM -0500, Josh Poimboeuf wrote:
> > On Mon, Sep 25, 2017 at 12:34:19PM -0500, Miguel Bernal Marin wrote:
> > > On Wed, Sep 20, 2017 at 04:24:18PM -0500, Josh Poimboeuf wrote:
> > > > On Tue, Sep 19, 2017 at 06:37:39PM -0500, Miguel Bernal Marin wrote:
> > > > > Some warning were showed by objtool using gcc 7.2.0
> > > > > 
> > > > > kernel/locking/rwsem.o: warning: objtool: up_read()+0x11: call without frame pointer save/setup
> > > > > kernel/locking/rwsem.o: warning: objtool: up_write()+0x17: call without frame pointer save/setup
> > > > > kernel/locking/rwsem.o: warning: objtool: downgrade_write()+0x22: call without frame pointer save/setup
> > > > > 
> > > > > which means gcc placed an inline asm function and its call instruction before
> > > > > the frame pointer setup.
> > > > >  
> > > > > This series forces a stack frame to be created before the call instruction
> > > > > by listing the stack pointer as an output operand in the inline asm statement.
> > > > > 
> > > > > Also to be easy to maintain and understand the operands from the extended
> > > > > assembler instructions were converted to named operands.
> > > > 
> > > > I've got a patch going around which will change the way we do this, so
> > > > you'll probably need to do a v3 after my patch gets merged.  I'll add
> > > > you to cc for the next revision.
> > > > 
> > > 
> > > With your new patches (at v4.14.-rc2) the warning is not seen any more,
> > > so I will send only the named operand patches (in separate thread), as
> > > this fix is not more needed.
> > 
> > Any chance you tested with GCC 7?  With GCC 6 and older you might still
> > see the warnings.
> 
> Sorry, reading again it looks like your warnings only started showing up
> in GCC 7.2.0?  If so, then it does make sense that your fix isn't needed
> any more, because my patch fixed this issue for *all* inline asm for GCC
> 7+.
> 

Yes it was with GCC 7.2.0


> -- 
> Josh

-- 
Regards,

Miguel Bernal Marin                     Open Source Technology Center
https://clearlinux.org                              Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1739228 — Re: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm

FromJosh Poimboeuf <jpoimboe@redhat.com>
Date2017-09-25 21:10 +0200
SubjectRe: [PATCH v3 0/6] locking/rwsem/x86: Add stack frame dependency for some inline asm
Message-ID<utGVs-27d-13@gated-at.bofh.it>
In reply to#1739190
On Mon, Sep 25, 2017 at 12:34:19PM -0500, Miguel Bernal Marin wrote:
> On Wed, Sep 20, 2017 at 04:24:18PM -0500, Josh Poimboeuf wrote:
> > On Tue, Sep 19, 2017 at 06:37:39PM -0500, Miguel Bernal Marin wrote:
> > > Some warning were showed by objtool using gcc 7.2.0
> > > 
> > > kernel/locking/rwsem.o: warning: objtool: up_read()+0x11: call without frame pointer save/setup
> > > kernel/locking/rwsem.o: warning: objtool: up_write()+0x17: call without frame pointer save/setup
> > > kernel/locking/rwsem.o: warning: objtool: downgrade_write()+0x22: call without frame pointer save/setup
> > > 
> > > which means gcc placed an inline asm function and its call instruction before
> > > the frame pointer setup.
> > >  
> > > This series forces a stack frame to be created before the call instruction
> > > by listing the stack pointer as an output operand in the inline asm statement.
> > > 
> > > Also to be easy to maintain and understand the operands from the extended
> > > assembler instructions were converted to named operands.
> > 
> > I've got a patch going around which will change the way we do this, so
> > you'll probably need to do a v3 after my patch gets merged.  I'll add
> > you to cc for the next revision.
> > 
> 
> With your new patches (at v4.14.-rc2) the warning is not seen any more,
> so I will send only the named operand patches (in separate thread), as
> this fix is not more needed.

Any chance you tested with GCC 7?  With GCC 6 and older you might still
see the warnings.

-- 
Josh

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web