Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ARCHS] Linux 6.3 kernel does not boot in SMP configuration #135

Closed
pavelvkozlov opened this issue Jun 27, 2023 · 1 comment
Closed

[ARCHS] Linux 6.3 kernel does not boot in SMP configuration #135

pavelvkozlov opened this issue Jun 27, 2023 · 1 comment
Assignees
Labels

Comments

@pavelvkozlov
Copy link

Linux kernel version from 6.3 doesn't boot in SMP configuration because of assert.

Linux version 6.3.0 (pvk@SNPS-o0WHuHJU73) (arc-buildroot-linux-gnu-gcc.br_real (Buildroot 2021.11-5735-gc96213909348) 12.2.1 20220829, GNU ld (GNU Binutils) 2.38.50.20220215) #2 SMP PREEMPT Thu Jun  1 19:33:20 +04 2023
Memory @ 80000000 [512M]
OF: fdt: Machine model: snps,zebu_hs-smp
earlycon: uart8250 at MMIO32 0xf0000000 (options '115200n8')
printk: bootconsole [uart8250] enabled
Failed to get possible-cpus from dtb, pretending all 4 cpus exist
archs-intc      : 15 priority levels (default 1)

IDENTITY        : ARCVER [0x50] ARCNUM [0x0] CHIPID [ 0x0]
processor [0]   : Unknown Unknown (ARCv2 ISA)
Timers          : Timer0 Timer1 RTC [UP 64-bit] GFRC [SMP 64-bit]
ISA Extn        : atomic ll64 unalign mpy[opt 9] div_rem
BPU             : partial match, cache:2048, Predict Table:16384 Return stk: 8
MMU [v4]        : 8k PAGE, , swalk 2 lvl, JTLB 512 (128x4), uDTLB 8, uITLB 4
I-Cache         : 16K, 2way/set, 64B Line, VIPT
D-Cache         : 16K, 4way/set, 64B Line, PIPT
Peripherals     : 0xc0000000
Vector Table    : 0x80000000
DEBUG           : ActionPoint 4/full
Extn [SMP]      : ARConnect (v2): 4 cores with IPI IDU GFRC
Zone ranges:
  Normal   [mem 0x0000000080000000-0x000000009fffffff]
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x0000000080000000-0x000000009fffffff]
Initmem setup node 0 [mem 0x0000000080000000-0x000000009fffffff]
percpu: BUG: failure at mm/percpu.c:2981/pcpu_build_alloc_info()!

gcc generated __builtin_trap
Path: (null)
CPU: 0 PID: 0 Comm: swapper Not tainted 6.3.0 #2
gcc generated __builtin_trap
ECR: 0x00090005 EFA: 0x80837bd4 ERET: 0x80837bd6
STAT: 0x00080802 [  K     ]   BTA: 0x80be5324
 SP: 0x80cfff88  FP: 0x80dde4c8 BLK: pcpu_embed_first_chunk+0x378/0x5ac
LPS: 0x80be2d8c LPE: 0x80be2d94 LPC: 0x00000000
r00: 0x00000041 r01: 0x80d85924 r02: 0x00000000
r03: 0x80cffee0 r04: 0x00000000 r05: 0x00000000
r06: 0x3a632e75 r07: 0x31383932 r08: 0x7063702f
r09: 0x75625f75 r10: 0x5f646c69 r11: 0x6f6c6c61
r12: 0x00000000 r13: 0x9fd94000 r14: 0x9fd94038
r15: 0x00002000 r16: 0x9fd94020 r17: 0x00002000
r18: 0x0000c300 r19: 0x00000001 r20: 0x00000005
r21: 0x00002000 r22: 0x00014000 r23: 0x00000001
r24: 0x80846fdc r25: 0x80d1a580

Stack Trace:
  pcpu_embed_first_chunk+0x37a/0x5ac

After commit with cpumask optimization torvalds@596ff4a initialization process for per-cpu allocator stops with assert.
I've reproduced this issue on HSDK board and on nSIM.
After the patch in the pcpu_build_alloc_info() function I see broken loop, that fills group_cnt array incorrectly and as a result assert fails.
I guess, the reason may not be in the patch itself, but in compiler optimizations for the loop. Furthered analysis is required.

@abrodkin abrodkin added the bug label Aug 11, 2023
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Aug 15, 2023
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 596ff4a ("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: foss-for-synopsys-dwc-arc-processors#135
Cc: <stable@vger.kernel.org> # v6.3+
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
roxell pushed a commit to roxell/linux that referenced this issue Aug 17, 2023
... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a
("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 b64be68
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68 ("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]
Kaz205 pushed a commit to Kaz205/linux that referenced this issue Sep 17, 2023
commit 42f51fb upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a
("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 b64be68
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68 ("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>
mj22226 pushed a commit to mj22226/linux that referenced this issue Sep 17, 2023
commit 42f51fb upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a
("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 b64be68
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68 ("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>
mj22226 pushed a commit to mj22226/linux that referenced this issue Sep 17, 2023
commit 42f51fb upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a
("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 b64be68
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68 ("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>
Whissi pushed a commit to Whissi/linux-stable that referenced this issue Sep 19, 2023
commit 42f51fb upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a
("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 b64be68
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors/linux#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68 ("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>
Whissi pushed a commit to Whissi/linux-stable that referenced this issue Sep 19, 2023
commit 42f51fb upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a
("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 b64be68
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors/linux#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68 ("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>
Whissi pushed a commit to Whissi/linux-stable that referenced this issue Sep 19, 2023
commit 42f51fb upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a
("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 b64be68
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors/linux#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68 ("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>
feryw pushed a commit to feryw/linux-6.5.z that referenced this issue Sep 28, 2023
commit 42f51fb24fd39cc547c086ab3d8a314cc603a91c upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a09b89
("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 b64be6836993c431e
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors/linux#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be6836993c43 ("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>
@pavelvkozlov
Copy link
Author

Fixed by: torvalds@42f51fb
Use the latest stable 6.5.6 or later kernels that have this fix, Kernels 6.3 and 6.4 may contain described issue.

sileshn pushed a commit to sileshn/ubuntu-kernel-lunar that referenced this issue Dec 4, 2023
BugLink: https://bugs.launchpad.net/bugs/2045079

commit 42f51fb24fd39cc547c086ab3d8a314cc603a91c upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a09b89
("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 b64be68
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors/linux#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68 ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
sileshn pushed a commit to sileshn/ubuntu-kernel-jammy that referenced this issue Jan 10, 2024
BugLink: https://bugs.launchpad.net/bugs/2041702

commit 42f51fb24fd39cc547c086ab3d8a314cc603a91c upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a09b89
("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 b64be68
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors/linux#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68 ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
sileshn pushed a commit to sileshn/ubuntu-kernel-lunar that referenced this issue Jan 10, 2024
BugLink: https://bugs.launchpad.net/bugs/2045079

commit 42f51fb24fd39cc547c086ab3d8a314cc603a91c upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a09b89
("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 b64be68
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors/linux#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68 ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
tuxedo-bot pushed a commit to tuxedocomputers/linux that referenced this issue Jan 17, 2024
BugLink: https://bugs.launchpad.net/bugs/2041999

commit 42f51fb upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a
("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 b64be68
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors/linux#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68 ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
xt0032rus pushed a commit to xt0032rus/android_kernel_xiaomi_sm8550 that referenced this issue May 3, 2024
commit 42f51fb24fd39cc547c086ab3d8a314cc603a91c upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a09b89
("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 b64be68
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors/linux#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68 ("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>
Signed-off-by: xt0032rus <andrey.denikin9@mail.com>
EviraKernel pushed a commit to EviraKernel/android_kernel_google_zuma that referenced this issue Jun 6, 2024
commit 42f51fb24fd39cc547c086ab3d8a314cc603a91c upstream.

... to avoid unwanted gcc optimizations

SMP kernels fail to boot with commit 596ff4a09b89
("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 b64be68
("ARC: atomics: implement relaxed variants") removed the smp_mb() for
the relaxed variants, but failed to add the explicit compiler barrier.

Link: foss-for-synopsys-dwc-arc-processors/linux#135
Cc: <stable@vger.kernel.org> # v6.3+
Fixes: b64be68 ("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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants