From: Pavel Kozlov<pavel.kozlov@xxxxxxxxxxxx>
Notify a compiler about write operations and prevent unwanted
optimizations. Add the "memory" clobber to the clobber list.
An obvious problem with unwanted compiler optimizations appeared after
the cpumask optimization commit 596ff4a09b89 ("cpumask: re-introduce
constant-sized cpumask optimizations").
After this commit the SMP kernels for ARC no longer loads because of
failed assert in the percpu allocator initialization routine:
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.
Add the "memory" clobber to fix this.
Link:https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/135
Cc:<stable@xxxxxxxxxxxxxxx> # v6.3+
Signed-off-by: Pavel Kozlov<pavel.kozlov@xxxxxxxxxxxx>