diff mbox series

[SRU,Trusty,1/1] UBUNTU: SAUCE: x86: Use barrier_nospec in arch/x86/um/asm/barrier.h

Message ID 20180727124952.30882-1-juergh@canonical.com
State New
Headers show
Series [SRU,Trusty,1/1] UBUNTU: SAUCE: x86: Use barrier_nospec in arch/x86/um/asm/barrier.h | expand

Commit Message

Juerg Haefliger July 27, 2018, 12:49 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1774181

Modify the duplicate rdtsc_barrier() in arch/x86/um/asm/barrier.h.

Fixes: b3d7ad85b80b ("x86: Introduce barrier_nospec")
Signed-off-by: Juerg Haefliger <juergh@canonical.com>
---
 arch/x86/um/asm/barrier.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Stefan Bader July 27, 2018, 1:20 p.m. UTC | #1
On 27.07.2018 14:49, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/1774181
> 
> Modify the duplicate rdtsc_barrier() in arch/x86/um/asm/barrier.h.
> 
> Fixes: b3d7ad85b80b ("x86: Introduce barrier_nospec")
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---

For whomever applies, is there any requirement where to put this or is it ok
just on top?

-Stefan

>  arch/x86/um/asm/barrier.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/x86/um/asm/barrier.h b/arch/x86/um/asm/barrier.h
> index 7d01b8c56c00..f16760f3d848 100644
> --- a/arch/x86/um/asm/barrier.h
> +++ b/arch/x86/um/asm/barrier.h
> @@ -68,8 +68,7 @@
>   */
>  static inline void rdtsc_barrier(void)
>  {
> -	alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
> -	alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
> +	barrier_nospec();
>  }
>  
>  #endif
>
Juerg Haefliger July 27, 2018, 1:47 p.m. UTC | #2
On Fri, 27 Jul 2018 15:20:15 +0200
Stefan Bader <stefan.bader@canonical.com> wrote:

> On 27.07.2018 14:49, Juerg Haefliger wrote:
> > BugLink: https://bugs.launchpad.net/bugs/1774181
> > 
> > Modify the duplicate rdtsc_barrier() in arch/x86/um/asm/barrier.h.
> > 
> > Fixes: b3d7ad85b80b  is
> > Signed-off-by: Juerg Haefliger <juergh@canonical.com>  
> Acked-by: Stefan Bader <stefan.bader@canonical.com>
> > ---  
> 
> For whomever applies, is there any requirement where to put this or
> is it ok just on top?

Anywhere after ("x86: Introduce barrier_nospec") is fine.

...Juerg

> -Stefan
> 
> >  arch/x86/um/asm/barrier.h | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/arch/x86/um/asm/barrier.h b/arch/x86/um/asm/barrier.h
> > index 7d01b8c56c00..f16760f3d848 100644
> > --- a/arch/x86/um/asm/barrier.h
> > +++ b/arch/x86/um/asm/barrier.h
> > @@ -68,8 +68,7 @@
> >   */
> >  static inline void rdtsc_barrier(void)
> >  {
> > -	alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
> > -	alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
> > +	barrier_nospec();
> >  }
> >  
> >  #endif
> >   
> 
>
Kleber Sacilotto de Souza July 27, 2018, 3:48 p.m. UTC | #3
On 07/27/18 14:49, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/1774181
> 
> Modify the duplicate rdtsc_barrier() in arch/x86/um/asm/barrier.h.
> 
> Fixes: b3d7ad85b80b ("x86: Introduce barrier_nospec")
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

> ---
>  arch/x86/um/asm/barrier.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/x86/um/asm/barrier.h b/arch/x86/um/asm/barrier.h
> index 7d01b8c56c00..f16760f3d848 100644
> --- a/arch/x86/um/asm/barrier.h
> +++ b/arch/x86/um/asm/barrier.h
> @@ -68,8 +68,7 @@
>   */
>  static inline void rdtsc_barrier(void)
>  {
> -	alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
> -	alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
> +	barrier_nospec();
>  }
>  
>  #endif
>
Kleber Sacilotto de Souza July 27, 2018, 3:49 p.m. UTC | #4
On 07/27/18 14:49, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/1774181
> 
> Modify the duplicate rdtsc_barrier() in arch/x86/um/asm/barrier.h.
> 
> Fixes: b3d7ad85b80b ("x86: Introduce barrier_nospec")
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>
> ---
>  arch/x86/um/asm/barrier.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/x86/um/asm/barrier.h b/arch/x86/um/asm/barrier.h
> index 7d01b8c56c00..f16760f3d848 100644
> --- a/arch/x86/um/asm/barrier.h
> +++ b/arch/x86/um/asm/barrier.h
> @@ -68,8 +68,7 @@
>   */
>  static inline void rdtsc_barrier(void)
>  {
> -	alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
> -	alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
> +	barrier_nospec();
>  }
>  
>  #endif
> 

Applied to trusty/master-next branch.

Thanks,
Kleber
diff mbox series

Patch

diff --git a/arch/x86/um/asm/barrier.h b/arch/x86/um/asm/barrier.h
index 7d01b8c56c00..f16760f3d848 100644
--- a/arch/x86/um/asm/barrier.h
+++ b/arch/x86/um/asm/barrier.h
@@ -68,8 +68,7 @@ 
  */
 static inline void rdtsc_barrier(void)
 {
-	alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
-	alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
+	barrier_nospec();
 }
 
 #endif