linux-stable/arch/arc
Pavel Kozlov ba5f2f952e 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:30:22 +02:00
..
boot arc: dts: Harmonize EHCI/OHCI DT nodes name 2022-10-17 16:32:12 -07:00
configs mm/slab: rename CONFIG_SLAB to CONFIG_SLAB_DEPRECATED 2023-05-26 19:01:47 +02:00
include ARC: atomics: Add compiler barrier to atomic operations... 2023-09-19 12:30:22 +02:00
kernel SMP cross-CPU function-call updates for v6.4: 2023-04-28 15:03:43 -07:00
lib
mm asm-generic updates for 6.5 2023-07-06 10:06:04 -07:00
plat-axs10x
plat-hsdk
plat-sim
plat-tb10x
Kbuild
Kconfig mm/fault: convert remaining simple cases to lock_mm_and_find_vma() 2023-06-24 14:12:58 -07:00
Kconfig.debug
Makefile