linux-stable/arch/arc
Pavel Kozlov 0476f2016d ARC: atomics: Add compiler barrier to atomic operations...
commit 42f51fb24f upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a09b
("cpumask: re-introduce constant-sized cpumask optimizations").

|
| percpu: BUG: failure at mm/percpu.c:2981/pcpu_build_alloc_info()!
|

The write operation performed by the SCOND instruction in the atomic
inline asm code is not properly passed to the compiler. The compiler
cannot correctly optimize a nested loop that runs through the cpumask
in the pcpu_build_alloc_info() function.

Fix this by add a compiler barrier (memory clobber in inline asm).

Apparently atomic ops used to have memory clobber implicitly via
surrounding smp_mb(). However commit b64be68369
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68369 ("ARC: atomics: implement relaxed variants")
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
[vgupta: tweaked the changelog and added Fixes tag]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-09-19 12:23:00 +02:00
..
boot ARC: haps: bump memory to 1 GB 2021-03-12 07:22:23 -08:00
configs ARC: [plat-eznps]: Drop support for EZChip NPS platform 2020-10-05 21:02:29 -07:00
include ARC: atomics: Add compiler barrier to atomic operations... 2023-09-19 12:23:00 +02:00
kernel ARC: entry: fix syscall_trace_exit argument 2022-04-27 14:39:00 +02:00
lib treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
mm arc: iounmap() arg is volatile 2022-11-03 23:59:15 +09:00
plat-axs10x treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
plat-hsdk ARC: [hsdk]: Enable FPU_SAVE_RESTORE 2021-01-08 13:46:58 -08:00
plat-sim ARC: merge HAPS-HS with nSIM-HS configs 2019-10-28 12:12:31 -07:00
plat-tb10x treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
Kbuild treewide: Add SPDX license identifier - Kbuild 2019-05-30 11:32:33 -07:00
Kconfig Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
Kconfig.debug
Makefile arc: replace cc-option-yn uses with cc-option 2021-09-03 08:17:20 +09:00