[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 02/17] xen: arm32: resync bitops with Linux v3.14-rc7



On 03/20/2014 03:45 PM, Ian Campbell wrote:
> This pulls in the following Linux commits:
> 
> commit c36ef4b1762302a493c6cb754073bded084700e2
> Author: Will Deacon <will.deacon@xxxxxxx>
> Date:   Wed Nov 23 11:28:25 2011 +0100
> 
>     ARM: 7171/1: unwind: add unwind directives to bitops assembly macros
> 
>     The bitops functions (e.g. _test_and_set_bit) on ARM do not have unwind
>     annotations and therefore the kernel cannot backtrace out of them on a
>     fatal error (for example, NULL pointer dereference).
> 
>     This patch annotates the bitops assembly macros with UNWIND annotations
>     so that we can produce a meaningful backtrace on error. Callers of the
>     macros are modified to pass their function name as a macro parameter,
>     enforcing that the macros are used as standalone function implementations.
> 
>     Acked-by: Dave Martin <dave.martin@xxxxxxxxxx>
>     Signed-off-by: Will Deacon <will.deacon@xxxxxxx>
>     Signed-off-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>
> 
> commit d779c07dd72098a7416d907494f958213b7726f3
> Author: Will Deacon <will.deacon@xxxxxxx>
> Date:   Thu Jun 27 12:01:51 2013 +0100
> 
>     ARM: bitops: prefetch the destination word for write prior to strex
> 
>     The cost of changing a cacheline from shared to exclusive state can be
>     significant, especially when this is triggered by an exclusive store,
>     since it may result in having to retry the transaction.
> 
>     This patch prefixes our atomic bitops implementation with prefetchw,
>     to try and grab the line in exclusive state from the start. The testop
>     macro is left alone, since the barrier semantics limit the usefulness
>     of prefetching data.
> 
>     Acked-by: Nicolas Pitre <nico@xxxxxxxxxx>
>     Signed-off-by: Will Deacon <will.deacon@xxxxxxx>
> 
> commit b7ec699405f55667caeb46d96229d75bf33a83ad
> Author: Will Deacon <will.deacon@xxxxxxx>
> Date:   Tue Nov 19 15:46:11 2013 +0100
> 
>     ARM: 7893/1: bitops: only emit .arch_extension mp if CONFIG_SMP
> 
>     Uwe reported a build failure when targetting a NOMMU platform with my
>     recent prefetch changes:
> 
>       arch/arm/lib/changebit.S: Assembler messages:
>       arch/arm/lib/changebit.S:15: Error: architectural extension `mp' is
>                         not allowed for the current base architecture
> 
>     This is due to use of the .arch_extension mp directive immediately prior
>     to an ALT_SMP(...) instruction. Whilst the ALT_SMP macro will expand to
>     nothing if !CONFIG_SMP, gas will still choke on the directive.
> 
>     This patch fixes the issue by only emitting the sequence (including the
>     directive) if CONFIG_SMP=y.
> 
>     Tested-by: Uwe Kleine-KÃnig <u.kleine-koenig@xxxxxxxxxxxxxx>
>     Signed-off-by: Will Deacon <will.deacon@xxxxxxx>
>     Signed-off-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>
> 
> Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Julien Grall <julien.grall@xxxxxxxxxx>

> ---
>  xen/arch/arm/arm32/lib/bitops.h        |   17 +++++++++++++++--
>  xen/arch/arm/arm32/lib/changebit.S     |    4 +---
>  xen/arch/arm/arm32/lib/clearbit.S      |    4 +---
>  xen/arch/arm/arm32/lib/setbit.S        |    4 +---
>  xen/arch/arm/arm32/lib/testchangebit.S |    4 +---
>  xen/arch/arm/arm32/lib/testclearbit.S  |    4 +---
>  xen/arch/arm/arm32/lib/testsetbit.S    |    4 +---
>  7 files changed, 21 insertions(+), 20 deletions(-)
> 
> diff --git a/xen/arch/arm/arm32/lib/bitops.h b/xen/arch/arm/arm32/lib/bitops.h
> index 689f2e8..25784c3 100644
> --- a/xen/arch/arm/arm32/lib/bitops.h
> +++ b/xen/arch/arm/arm32/lib/bitops.h
> @@ -1,13 +1,20 @@
>  #include <xen/config.h>
>  
>  #if __LINUX_ARM_ARCH__ >= 6
> -     .macro  bitop, instr
> +     .macro  bitop, name, instr
> +ENTRY(       \name           )
> +UNWIND(      .fnstart        )
>       ands    ip, r1, #3
>       strneb  r1, [ip]                @ assert word-aligned
>       mov     r2, #1
>       and     r3, r0, #31             @ Get bit offset
>       mov     r0, r0, lsr #5
>       add     r1, r1, r0, lsl #2      @ Get word offset
> +#if __LINUX_ARM_ARCH__ >= 7 && defined(CONFIG_SMP)
> +     .arch_extension mp
> +     ALT_SMP(W(pldw) [r1])
> +     ALT_UP(W(nop))
> +#endif
>       mov     r3, r2, lsl r3
>  1:   ldrex   r2, [r1]
>       \instr  r2, r2, r3
> @@ -15,9 +22,13 @@
>       cmp     r0, #0
>       bne     1b
>       bx      lr
> +UNWIND(      .fnend          )
> +ENDPROC(\name                )
>       .endm
>  
> -     .macro  testop, instr, store
> +     .macro  testop, name, instr, store
> +ENTRY(       \name           )
> +UNWIND(      .fnstart        )
>       ands    ip, r1, #3
>       strneb  r1, [ip]                @ assert word-aligned
>       mov     r2, #1
> @@ -36,6 +47,8 @@
>       cmp     r0, #0
>       movne   r0, #1
>  2:   bx      lr
> +UNWIND(      .fnend          )
> +ENDPROC(\name                )
>       .endm
>  #else
>       .macro  bitop, name, instr
> diff --git a/xen/arch/arm/arm32/lib/changebit.S 
> b/xen/arch/arm/arm32/lib/changebit.S
> index 62954bc..11f41d2 100644
> --- a/xen/arch/arm/arm32/lib/changebit.S
> +++ b/xen/arch/arm/arm32/lib/changebit.S
> @@ -13,6 +13,4 @@
>  #include "bitops.h"
>                  .text
>  fined(CONFIG_SMP)
> -ENTRY(_change_bit)
> -     bitop   eor
> -ENDPROC(_change_bit)
> +bitop        _change_bit, eor
> diff --git a/xen/arch/arm/arm32/lib/clearbit.S 
> b/xen/arch/arm/arm32/lib/clearbit.S
> index 42ce416..1b6a569 100644
> --- a/xen/arch/arm/arm32/lib/clearbit.S
> +++ b/xen/arch/arm/arm32/lib/clearbit.S
> @@ -14,6 +14,4 @@
>  #include "bitops.h"
>                  .text
>  
> -ENTRY(_clear_bit)
> -     bitop   bic
> -ENDPROC(_clear_bit)
> +bitop        _clear_bit, bic
> diff --git a/xen/arch/arm/arm32/lib/setbit.S b/xen/arch/arm/arm32/lib/setbit.S
> index c828851..1f4ef56 100644
> --- a/xen/arch/arm/arm32/lib/setbit.S
> +++ b/xen/arch/arm/arm32/lib/setbit.S
> @@ -13,6 +13,4 @@
>  #include "bitops.h"
>       .text
>  
> -ENTRY(_set_bit)
> -     bitop   orr
> -ENDPROC(_set_bit)
> +bitop        _set_bit, orr
> diff --git a/xen/arch/arm/arm32/lib/testchangebit.S 
> b/xen/arch/arm/arm32/lib/testchangebit.S
> index a7f527c..7f4635c 100644
> --- a/xen/arch/arm/arm32/lib/testchangebit.S
> +++ b/xen/arch/arm/arm32/lib/testchangebit.S
> @@ -13,6 +13,4 @@
>  #include "bitops.h"
>                  .text
>  
> -ENTRY(_test_and_change_bit)
> -     testop  eor, str
> -ENDPROC(_test_and_change_bit)
> +testop       _test_and_change_bit, eor, str
> diff --git a/xen/arch/arm/arm32/lib/testclearbit.S 
> b/xen/arch/arm/arm32/lib/testclearbit.S
> index 8f39c72..4d4152f 100644
> --- a/xen/arch/arm/arm32/lib/testclearbit.S
> +++ b/xen/arch/arm/arm32/lib/testclearbit.S
> @@ -13,6 +13,4 @@
>  #include "bitops.h"
>                  .text
>  
> -ENTRY(_test_and_clear_bit)
> -     testop  bicne, strne
> -ENDPROC(_test_and_clear_bit)
> +testop       _test_and_clear_bit, bicne, strne
> diff --git a/xen/arch/arm/arm32/lib/testsetbit.S 
> b/xen/arch/arm/arm32/lib/testsetbit.S
> index 1b8d273..54f48f9 100644
> --- a/xen/arch/arm/arm32/lib/testsetbit.S
> +++ b/xen/arch/arm/arm32/lib/testsetbit.S
> @@ -13,6 +13,4 @@
>  #include "bitops.h"
>                  .text
>  
> -ENTRY(_test_and_set_bit)
> -     testop  orreq, streq
> -ENDPROC(_test_and_set_bit)
> +testop       _test_and_set_bit, orreq, streq
> 


-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.