Bug 52312

Summary: ERROR:target/arm/internals.h:923:regime_is_user: code should not be reached
Product: Sisyphus Reporter: Vitaly Chikunov <vt>
Component: qemuAssignee: Alexey Shabalin <shaba>
Status: VERIFIED FIXED QA Contact: qa-sisyphus
Severity: normal    
Priority: P5 CC: glebfm, iv, shaba, vt
Version: unstable   
Hardware: x86   
OS: Linux   

Description Vitaly Chikunov 2024-12-02 06:52:13 MSK
Регрессия в qemu 9.1.1 не позволяющая загрузить ядро 6.13.
Фикс в v9.1.2 / v9.2.0-rc0.
Нужно или собрать 9.1.2, или добавить патч.

Upstream bugreports:

https://lore.kernel.org/all/ZxD2NooqEr9_86_E@arm.com/#t
https://lore.kernel.org/linux-arm-kernel/87jze590cu.fsf@draig.linaro.org/T/

Patch:

https://lore.kernel.org/qemu-devel/20241017172331.822587-1-peter.maydell@linaro.org/T/#mc0b7080b81acbd33b240a065bac8319d4421d9f2
Comment 1 Vitaly Chikunov 2024-12-02 07:00:52 MSK
Впрочем, я не проверял этот фикс. Именно такой баг возникает при загрузке без KVM, при загрузке с KVM поведение отличается.

Без KVM:

```
vm-run --tcg --loglevel=debug --append='earlycon' uname -a
...
[    0.460172] CPU features: detected: Scalable Vector Extension
[    0.496849] alternatives: applying system-wide alternatives
[    0.543516] CPU features: detected: Hardware dirty bit management on CPU0-3
[    0.546594] SVE: maximum available vector length 256 bytes per vector
[    0.547671] SVE: default vector length 64 bytes per vector
**
ERROR:../target/arm/internals.h:959:regime_is_user: code should not be reached
Bail out! ERROR:../target/arm/internals.h:959:regime_is_user: code should not be reached
Command terminated by signal 6
```

С KVM:

```
vm-run --loglevel=debug --append='earlycon' uname -a
...
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x481fd010]
[    0.000000] Linux version 6.13.0-6.13-alt0.rc1 (builder@localhost.localdomain) (gcc-14 (GCC) 14.2.1 20241028 (ALT Sisyphus 14.2.1-alt1), GNU ld (GNU Binutils) 2.43.1.20241025) #1 SMP PREEMPT_DYNAMIC Mon Dec  2 03:33:29 UTC 2024
[    0.000000] KASLR disabled on command line
[    0.000000] random: crng init done
[    0.000000] Machine model: linux,dummy-virt
[    0.000000] printk: debug: ignoring loglevel setting.
[    0.000000] efi: UEFI not found.
[    0.000000] earlycon: pl11 at MMIO 0x0000000009000000 (options '')
[    0.000000] printk: legacy bootconsole [pl11] enabled
[    0.000000] OF: reserved mem: Reserved memory: No reserved-memory node in the DT
[    0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] NODE_DATA(0) allocated [mem 0x13f7f3540-0x13f7f947f]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x00000000ffffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000013fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] cma: Reserved 256 MiB at 0x00000000f0000000 on node -1
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: Trusted OS migration not required
[    0.000000] psci: SMC Calling Convention v1.1
[    0.000000] smccc: KVM: hypervisor services detected (0x00000000 0x00000000 0x00000000 0x00000003)
[    0.000000] percpu: Embedded 34 pages/cpu s100632 r8192 d30440 u139264
[    0.000000] pcpu-alloc: s100632 r8192 d30440 u139264 alloc=34*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [0] 4 [0] 5 [0] 6 [0] 7
[    0.000000] Internal error: Oops - Undefined instruction: 0000000002000000 [#1] SMP
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 UID: 0 PID: 0 Comm: swapper Not tainted 6.13.0-6.13-alt0.rc1 #1
[    0.000000] Hardware name: linux,dummy-virt (DT)
[    0.000000] pstate: 004000c5 (nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    0.000000] pc : __cpuinfo_store_cpu+0xe8/0x240
[    0.000000] lr : cpuinfo_store_boot_cpu+0x34/0x88
[    0.000000] sp : ffff800082013df0
[    0.000000] x29: ffff800082013df0 x28: 000000000000008e x27: ffff800081e38128
[    0.000000] x26: ffff800081702190 x25: ffff80008201f040 x24: ffff0000ff7d1d00
[    0.000000] x23: ffff80008201ec00 x22: ffff800081e39100 x21: ffff8000816f9750
[    0.000000] x20: ffff800081f55280 x19: ffff0000ff6be2e0 x18: 0000000000000000
[    0.000000] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
[    0.000000] x14: 000000000000002f x13: 000000013f7f9490 x12: 0000008000000000
[    0.000000] x11: 0000000000000000 x10: 00000000007f8000 x9 : 000000013f808000
[    0.000000] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 000000013f7f94c0
[    0.000000] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 1100010011111111
[    0.000000] x2 : 0000000000000001 x1 : 0000000084448004 x0 : ffff0000ff6be2e0
[    0.000000] Call trace:
[    0.000000]  __cpuinfo_store_cpu+0xe8/0x240 (P)
[    0.000000]  cpuinfo_store_boot_cpu+0x34/0x88 (L)
[    0.000000]  cpuinfo_store_boot_cpu+0x34/0x88
[    0.000000]  smp_prepare_boot_cpu+0x30/0x58
[    0.000000]  start_kernel+0x514/0x9d0
[    0.000000]  __primary_switched+0x88/0x98
[    0.000000] Code: f100085f 54000600 f2580c7f 54000060 (d538a482)
[    0.000000] ---[ end trace 0000000000000000 ]---
[    0.000000] Kernel panic - not syncing: Attempted to kill the idle task!
[    0.000000] Rebooting in 600 seconds..
```
Comment 2 Vitaly Chikunov 2024-12-02 22:45:34 MSK
С KVM у 6.13 другой баг и пока не понятно будут ли его вообще фиксить.

https://lore.kernel.org/all/20241202045830.e4yy3nkvxtzaybxk@altlinux.org/

В даный момент мы не можем собирать ядра с тестом загрузки на aarch64.

Так как, без kvm - эта regime_is_user проблема в qemu 9.1.1, с kvm - проблема с MPAM в ядрах и/или нашем ARM hardware на сборочнице (на другом хосте с aarch64 я её воспроизвести не смог).
Comment 3 Repository Robot 2024-12-03 02:47:31 MSK
qemu-9.1.2-alt1 -> sisyphus:

 Mon Dec 02 2024 Alexey Shabalin <shaba@altlinux> 9.1.2-alt1
 - 9.1.2 (ALT#52312).
Comment 4 Vitaly Chikunov 2024-12-03 06:26:10 MSK
Спасибо. Так хоть по TCG стало загружаться.