Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1539826

Re: [PATCH] ARM: add cmpxchg64 helper for ARMv7-M

From Pablo Neira Ayuso <pablo@netfilter.org>
Newsgroups linux.kernel
Subject Re: [PATCH] ARM: add cmpxchg64 helper for ARMv7-M
Date 2016-12-10 13:40 +0100
Message-ID <sMP6y-2g7-7@gated-at.bofh.it> (permalink)
References <sMNep-pA-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Arnd,

On Sat, Dec 10, 2016 at 11:36:34AM +0100, Arnd Bergmann wrote:
> A change to the netfilter code in net-next introduced the first caller of
> cmpxchg64 that can get built on ARMv7-M, leading to an error from the
> assembler that points out the lack of 64-bit atomics on this architecture:
> 
> /tmp/ccMe7djj.s: Assembler messages:
> /tmp/ccMe7djj.s:367: Error: selected processor does not support `ldrexd r0,r1,[lr]' in Thumb mode
> /tmp/ccMe7djj.s:371: Error: selected processor does not support `strexd ip,r2,r3,[lr]' in Thumb mode
> /tmp/ccMe7djj.s:389: Error: selected processor does not support `ldrexd r8,r9,[r7]' in Thumb mode
> /tmp/ccMe7djj.s:393: Error: selected processor does not support `strexd lr,r0,r1,[r7]' in Thumb mode
> scripts/Makefile.build:299: recipe for target 'net/netfilter/nft_counter.o' failed
> 
> This makes ARMv7-M use the same emulation from asm-generic/cmpxchg-local.h
> that we use on architectures earlier than ARMv6K, to fix the build. The
> 32-bit atomics are available on ARMv7-M and we keep using them there.
> This ARM specific change is probably something we should do regardless
> of the netfilter code.
> 
> However, looking at the new nft_counter_reset() function in nft_counter.c,
> this looks incorrect to me not just on ARMv7-M but also on other
> architectures, with at least the following possible race:

Right, Eric Dumazet already spotted this problem. I'm preparing a
patch that doesn't require cmpxchg64(). Will keep you on Cc. Thanks.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] ARM: add cmpxchg64 helper for ARMv7-M Arnd Bergmann <arnd@arndb.de> - 2016-12-10 11:40 +0100
  Re: [PATCH] ARM: add cmpxchg64 helper for ARMv7-M Pablo Neira Ayuso <pablo@netfilter.org> - 2016-12-10 13:40 +0100
    Re: [PATCH] ARM: add cmpxchg64 helper for ARMv7-M Russell King - ARM Linux <linux@armlinux.org.uk> - 2016-12-13 18:10 +0100

csiph-web