diff mbox

[Xen-devel] xen/arm32: __cmpxchg_mb should be marked always_inline

Message ID 1396544950-21909-1-git-send-email-julien.grall@linaro.org
State Accepted, archived
Headers show

Commit Message

Julien Grall April 3, 2014, 5:09 p.m. UTC
Currently __cmpxchg_mb is only marked inline. The compiler can decide to not
inline this function. In this case, the call to __cmpxchg will be inlined
but not optimised. This will result linking failure because of __bad_cmpxchg.

Catched by clang 3.5.
---
 xen/include/asm-arm/arm32/cmpxchg.h |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Ian Campbell April 8, 2014, 2:36 p.m. UTC | #1
On Thu, 2014-04-03 at 18:09 +0100, Julien Grall wrote:
> Currently __cmpxchg_mb is only marked inline. The compiler can decide to not
> inline this function. In this case, the call to __cmpxchg will be inlined
> but not optimised. This will result linking failure because of __bad_cmpxchg.
> 
> Catched by clang 3.5.

"caught". 

Acked-by: Ian Campbell <ian.campbell@citrix.com>

But there is no S-o-b. If you offer one here I'll fix the spelling as I
commit.

> ---
>  xen/include/asm-arm/arm32/cmpxchg.h |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/include/asm-arm/arm32/cmpxchg.h b/xen/include/asm-arm/arm32/cmpxchg.h
> index 70c6090..3f4e7a1 100644
> --- a/xen/include/asm-arm/arm32/cmpxchg.h
> +++ b/xen/include/asm-arm/arm32/cmpxchg.h
> @@ -112,8 +112,9 @@ static always_inline unsigned long __cmpxchg(
>  	return oldval;
>  }
>  
> -static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
> -					 unsigned long new, int size)
> +static always_inline unsigned long __cmpxchg_mb(volatile void *ptr,
> +                                                unsigned long old,
> +                                                unsigned long new, int size)
>  {
>  	unsigned long ret;
>
Julien Grall April 8, 2014, 2:38 p.m. UTC | #2
On 04/08/2014 03:36 PM, Ian Campbell wrote:
> On Thu, 2014-04-03 at 18:09 +0100, Julien Grall wrote:
>> Currently __cmpxchg_mb is only marked inline. The compiler can decide to not
>> inline this function. In this case, the call to __cmpxchg will be inlined
>> but not optimised. This will result linking failure because of __bad_cmpxchg.
>>
>> Catched by clang 3.5.
> 
> "caught". 
> 
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> 
> But there is no S-o-b. If you offer one here I'll fix the spelling as I
> commit.

Oops, sorry.

Signed-off-by: Julien Grall <julien.grall@linaro.org>

Regards,
Ian Campbell April 8, 2014, 3:27 p.m. UTC | #3
On Tue, 2014-04-08 at 15:38 +0100, Julien Grall wrote:
> On 04/08/2014 03:36 PM, Ian Campbell wrote:
> > On Thu, 2014-04-03 at 18:09 +0100, Julien Grall wrote:
> >> Currently __cmpxchg_mb is only marked inline. The compiler can decide to not
> >> inline this function. In this case, the call to __cmpxchg will be inlined
> >> but not optimised. This will result linking failure because of __bad_cmpxchg.
> >>
> >> Catched by clang 3.5.
> > 
> > "caught". 
> > 
> > Acked-by: Ian Campbell <ian.campbell@citrix.com>
> > 
> > But there is no S-o-b. If you offer one here I'll fix the spelling as I
> > commit.
> 
> Oops, sorry.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>

Applied.
diff mbox

Patch

diff --git a/xen/include/asm-arm/arm32/cmpxchg.h b/xen/include/asm-arm/arm32/cmpxchg.h
index 70c6090..3f4e7a1 100644
--- a/xen/include/asm-arm/arm32/cmpxchg.h
+++ b/xen/include/asm-arm/arm32/cmpxchg.h
@@ -112,8 +112,9 @@  static always_inline unsigned long __cmpxchg(
 	return oldval;
 }
 
-static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
-					 unsigned long new, int size)
+static always_inline unsigned long __cmpxchg_mb(volatile void *ptr,
+                                                unsigned long old,
+                                                unsigned long new, int size)
 {
 	unsigned long ret;