]> git.baikalelectronics.ru Git - kernel.git/commit
xtensa: add missing exclusive access state management
authorMax Filippov <jcmvbkbc@gmail.com>
Fri, 31 Jul 2020 19:38:05 +0000 (12:38 -0700)
committerMax Filippov <jcmvbkbc@gmail.com>
Fri, 31 Jul 2020 21:15:57 +0000 (14:15 -0700)
commitb8b4d9252c32924c9b267d473e8235bf08d2c64d
tree3b2aef37c8000b3ae4a6f205f35c6e0c4dbf53f0
parentfc7883ef9f1ec48c6a2b3b95ba23e1d96e0f9ba3
xtensa: add missing exclusive access state management

The result of the s32ex opcode is recorded in the ATOMCTL special
register and must be retrieved with the getex opcode. Context switch
between s32ex and getex may trash the ATOMCTL register and result in
duplicate update or missing update of the atomic variable.
Add atomctl8 field to the struct thread_info and use getex to swap
ATOMCTL bit 8 as a part of context switch.
Clear exclusive access monitor on kernel entry.

Cc: stable@vger.kernel.org
Fixes: 255a80c534d4 ("xtensa: add exclusive atomics support")
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
arch/xtensa/include/asm/thread_info.h
arch/xtensa/kernel/asm-offsets.c
arch/xtensa/kernel/entry.S