diff mbox series

arch/arm64/include/asm/jump_label.h: use asm_volatile_goto

Message ID 20180909154731.GA20381@gmail.com (mailing list archive)
State New, archived
Headers show
Series arch/arm64/include/asm/jump_label.h: use asm_volatile_goto | expand

Commit Message

Miguel Ojeda Sept. 9, 2018, 3:47 p.m. UTC
All other uses of "asm goto" go through asm_volatile_goto
(including the arm version of the same file). For consistency,
use it here as well.

Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
---
 arch/arm64/include/asm/jump_label.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Will Deacon Sept. 10, 2018, 9:50 a.m. UTC | #1
On Sun, Sep 09, 2018 at 05:47:31PM +0200, Miguel Ojeda wrote:
> All other uses of "asm goto" go through asm_volatile_goto
> (including the arm version of the same file). For consistency,
> use it here as well.
> 
> Cc: Nick Desaulniers <ndesaulniers@google.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> ---
>  arch/arm64/include/asm/jump_label.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks, I'll pick this up as a fix.

Will

> diff --git a/arch/arm64/include/asm/jump_label.h b/arch/arm64/include/asm/jump_label.h
> index 1b5e0e843c3a..7e2b3e360086 100644
> --- a/arch/arm64/include/asm/jump_label.h
> +++ b/arch/arm64/include/asm/jump_label.h
> @@ -28,7 +28,7 @@
>  
>  static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
>  {
> -	asm goto("1: nop\n\t"
> +	asm_volatile_goto("1: nop\n\t"
>  		 ".pushsection __jump_table,  \"aw\"\n\t"
>  		 ".align 3\n\t"
>  		 ".quad 1b, %l[l_yes], %c0\n\t"
> @@ -42,7 +42,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran
>  
>  static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
>  {
> -	asm goto("1: b %l[l_yes]\n\t"
> +	asm_volatile_goto("1: b %l[l_yes]\n\t"
>  		 ".pushsection __jump_table,  \"aw\"\n\t"
>  		 ".align 3\n\t"
>  		 ".quad 1b, %l[l_yes], %c0\n\t"
> -- 
> 2.17.1
>
Nick Desaulniers Sept. 10, 2018, 5:02 p.m. UTC | #2
On Mon, Sep 10, 2018 at 2:49 AM Will Deacon <will.deacon@arm.com> wrote:
>
> On Sun, Sep 09, 2018 at 05:47:31PM +0200, Miguel Ojeda wrote:
> > All other uses of "asm goto" go through asm_volatile_goto
> > (including the arm version of the same file). For consistency,
> > use it here as well.
> >
> > Cc: Nick Desaulniers <ndesaulniers@google.com>
> > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > Cc: Will Deacon <will.deacon@arm.com>
> > Cc: linux-arm-kernel@lists.infradead.org
> > Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> > ---
> >  arch/arm64/include/asm/jump_label.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
>
> Thanks, I'll pick this up as a fix.
>
> Will
>
> > diff --git a/arch/arm64/include/asm/jump_label.h b/arch/arm64/include/asm/jump_label.h
> > index 1b5e0e843c3a..7e2b3e360086 100644
> > --- a/arch/arm64/include/asm/jump_label.h
> > +++ b/arch/arm64/include/asm/jump_label.h
> > @@ -28,7 +28,7 @@
> >
> >  static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
> >  {
> > -     asm goto("1: nop\n\t"
> > +     asm_volatile_goto("1: nop\n\t"
> >                ".pushsection __jump_table,  \"aw\"\n\t"
> >                ".align 3\n\t"
> >                ".quad 1b, %l[l_yes], %c0\n\t"
> > @@ -42,7 +42,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran
> >
> >  static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
> >  {
> > -     asm goto("1: b %l[l_yes]\n\t"
> > +     asm_volatile_goto("1: b %l[l_yes]\n\t"
> >                ".pushsection __jump_table,  \"aw\"\n\t"
> >                ".align 3\n\t"
> >                ".quad 1b, %l[l_yes], %c0\n\t"
> > --
> > 2.17.1
> >

Yes, this should help avoid a known miscompile in gcc < 4.8.2 (at
least for x86_64; not sure how backend specific the asm goto
implementation is in gcc, but this shouldn't hurt).
https://lkml.org/lkml/2018/9/7/1628

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
diff mbox series

Patch

diff --git a/arch/arm64/include/asm/jump_label.h b/arch/arm64/include/asm/jump_label.h
index 1b5e0e843c3a..7e2b3e360086 100644
--- a/arch/arm64/include/asm/jump_label.h
+++ b/arch/arm64/include/asm/jump_label.h
@@ -28,7 +28,7 @@ 
 
 static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
 {
-	asm goto("1: nop\n\t"
+	asm_volatile_goto("1: nop\n\t"
 		 ".pushsection __jump_table,  \"aw\"\n\t"
 		 ".align 3\n\t"
 		 ".quad 1b, %l[l_yes], %c0\n\t"
@@ -42,7 +42,7 @@  static __always_inline bool arch_static_branch(struct static_key *key, bool bran
 
 static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
 {
-	asm goto("1: b %l[l_yes]\n\t"
+	asm_volatile_goto("1: b %l[l_yes]\n\t"
 		 ".pushsection __jump_table,  \"aw\"\n\t"
 		 ".align 3\n\t"
 		 ".quad 1b, %l[l_yes], %c0\n\t"