]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.132/arc-atomics-unbork-atomic_fetch_-op.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 4.9.132 / arc-atomics-unbork-atomic_fetch_-op.patch
CommitLineData
12eb7899
GKH
1From foo@baz Thu Oct 4 12:38:43 PDT 2018
2From: Will Deacon <will.deacon@arm.com>
3Date: Thu, 30 Aug 2018 13:52:38 -0700
4Subject: ARC: atomics: unbork atomic_fetch_##op()
5
6From: Will Deacon <will.deacon@arm.com>
7
8[ Upstream commit 3fcbb8260a87efb691d837e8cd24e81f65b3eb70 ]
9
10In 4.19-rc1, Eugeniy reported weird boot and IO errors on ARC HSDK
11
12| INFO: task syslogd:77 blocked for more than 10 seconds.
13| Not tainted 4.19.0-rc1-00007-gf213acea4e88 #40
14| "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this
15| message.
16| syslogd D 0 77 76 0x00000000
17|
18| Stack Trace:
19| __switch_to+0x0/0xac
20| __schedule+0x1b2/0x730
21| io_schedule+0x5c/0xc0
22| __lock_page+0x98/0xdc
23| find_lock_entry+0x38/0x100
24| shmem_getpage_gfp.isra.3+0x82/0xbfc
25| shmem_fault+0x46/0x138
26| handle_mm_fault+0x5bc/0x924
27| do_page_fault+0x100/0x2b8
28| ret_from_exception+0x0/0x8
29
30He bisected to 84c6591103db ("locking/atomics,
31asm-generic/bitops/lock.h: Rewrite using atomic_fetch_*()")
32
33This commit however only unmasked the real issue introduced by commit
344aef66c8ae9 ("locking/atomic, arch/arc: Fix build") which missed the
35retry-if-scond-failed branch in atomic_fetch_##op() macros.
36
37The bisected commit started using atomic_fetch_##op() macros for building
38the rest of atomics.
39
40Fixes: 4aef66c8ae9 ("locking/atomic, arch/arc: Fix build")
41Reported-by: Eugeniy Paltsev <paltsev@synopsys.com>
42Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
43Signed-off-by: Will Deacon <will.deacon@arm.com>
44Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
45[vgupta: wrote changelog]
46Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
47Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
48---
49 arch/arc/include/asm/atomic.h | 2 +-
50 1 file changed, 1 insertion(+), 1 deletion(-)
51
52--- a/arch/arc/include/asm/atomic.h
53+++ b/arch/arc/include/asm/atomic.h
54@@ -84,7 +84,7 @@ static inline int atomic_fetch_##op(int
55 "1: llock %[orig], [%[ctr]] \n" \
56 " " #asm_op " %[val], %[orig], %[i] \n" \
57 " scond %[val], [%[ctr]] \n" \
58- " \n" \
59+ " bnz 1b \n" \
60 : [val] "=&r" (val), \
61 [orig] "=&r" (orig) \
62 : [ctr] "r" (&v->counter), \