All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Will Deacon <will.deacon@arm.com>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arch/arm64/include/asm/jump_label.h: use asm_volatile_goto
Date: Mon, 10 Sep 2018 10:02:09 -0700	[thread overview]
Message-ID: <CAKwvOdn3SgUhPSUBwBm26X-Y3te1iYqwS9v=nyGCzC6KVNtJ6Q@mail.gmail.com> (raw)
In-Reply-To: <20180910095008.GB31531@arm.com>

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>

-- 
Thanks,
~Nick Desaulniers

WARNING: multiple messages have this Message-ID (diff)
From: ndesaulniers@google.com (Nick Desaulniers)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arch/arm64/include/asm/jump_label.h: use asm_volatile_goto
Date: Mon, 10 Sep 2018 10:02:09 -0700	[thread overview]
Message-ID: <CAKwvOdn3SgUhPSUBwBm26X-Y3te1iYqwS9v=nyGCzC6KVNtJ6Q@mail.gmail.com> (raw)
In-Reply-To: <20180910095008.GB31531@arm.com>

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 at 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>

-- 
Thanks,
~Nick Desaulniers

  reply	other threads:[~2018-09-10 17:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-09 15:47 [PATCH] arch/arm64/include/asm/jump_label.h: use asm_volatile_goto Miguel Ojeda
2018-09-09 15:47 ` Miguel Ojeda
2018-09-10  9:50 ` Will Deacon
2018-09-10  9:50   ` Will Deacon
2018-09-10 17:02   ` Nick Desaulniers [this message]
2018-09-10 17:02     ` Nick Desaulniers

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='CAKwvOdn3SgUhPSUBwBm26X-Y3te1iYqwS9v=nyGCzC6KVNtJ6Q@mail.gmail.com' \
    --to=ndesaulniers@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=will.deacon@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.