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

WARN at init/main.c:1061 start_kernel+0x4bc/0x680 #220

Open
shenki opened this issue Feb 27, 2023 · 2 comments
Open

WARN at init/main.c:1061 start_kernel+0x4bc/0x680 #220

shenki opened this issue Feb 27, 2023 · 2 comments

Comments

@shenki
Copy link
Member

shenki commented Feb 27, 2023

@legoater reported a warning with dev-6.1 on ast2500. I can reproduce on qemu with his configuration:

[    0.002218] ------------[ cut here ]------------
[    0.002338] WARNING: CPU: 0 PID: 0 at init/main.c:1061 start_kernel+0x4bc/0x680
[    0.002785] Interrupts were enabled early
[    0.002872] Modules linked in:
[    0.003077] CPU: 0 PID: 0 Comm: swapper Not tainted 6.1.12-00100-gc6467d425900 #13
[    0.003268] Hardware name: Generic DT based system
[    0.003399] Backtrace: 
[    0.003525]  dump_backtrace from show_stack+0x20/0x24
[    0.003704]  r7:80b01020 r6:00000009 r5:00000153 r4:80a12190
[    0.003822]  show_stack from dump_stack_lvl+0x2c/0x34
[    0.003921]  dump_stack_lvl from dump_stack+0x14/0x1c
[    0.004022]  r5:00000425 r4:809fd2b0
[    0.004083]  dump_stack from __warn+0x80/0xfc
[    0.004170]  __warn from warn_slowpath_fmt+0x90/0xb4
[    0.004268]  r7:80b01020 r6:00000425 r5:809fd2b0 r4:809fd2e8
[    0.004357]  warn_slowpath_fmt from start_kernel+0x4bc/0x680
[    0.004465]  r8:00000000 r7:ffffffff r6:00c0387d r5:9dfffd00 r4:80cb1000
[    0.004574]  start_kernel from 0x0
[    0.004719]  r10:00c5387d r9:410fb767 r8:881f8000 r7:ffffffff r6:00c0387d r5:00000051
[    0.004846]  r4:80b0033c
[    0.004917] ---[ end trace 0000000000000000 ]---

This can be reproduced by building aspeed_g5_defconfig with CONFIG_SMP=n and CONFIG_DEBUG_KMEMLEAK=y.

$ make ARCH=arm O=aspeed-g5-dev aspeed_g5_defconfig
$ ./scripts/config --file aspeed-g5-dev/.config --disable SMP 
$ ./scripts/config --file aspeed-g5-dev/.config --enable CONFIG_DEBUG_KMEMLEAK
@shenki
Copy link
Member Author

shenki commented Feb 28, 2023

v5.17 does not warn.
v5.18 does.

(Note: when building pre-5.16 kernels with Debian's armhf cross compiler, cherry pick 418ace9)

Bisection points to b87cf91 as the culprit.

$ git bisect log 
git bisect start
# status: waiting for both good and bad commits
# good: [f443e374ae131c168a065ea1748feac6b2e76613] Linux 5.17
git bisect good f443e374ae131c168a065ea1748feac6b2e76613
# status: waiting for bad commit, 1 good commit known
# bad: [4b0986a3613c92f4ec1bdc7f60ec66fea135991f] Linux 5.18
git bisect bad 4b0986a3613c92f4ec1bdc7f60ec66fea135991f
# bad: [25fd2d41b505d0640bdfe67aa77c549de2d3c18a] selftests: kselftest framework: provide "finished" helper
git bisect bad 25fd2d41b505d0640bdfe67aa77c549de2d3c18a
# bad: [b4bc93bd76d4da32600795cd323c971f00a2e788] Merge tag 'arm-drivers-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
git bisect bad b4bc93bd76d4da32600795cd323c971f00a2e788
# good: [3fe2f7446f1e029b220f7f650df6d138f91651f2] Merge tag 'sched-core-2022-03-22' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect good 3fe2f7446f1e029b220f7f650df6d138f91651f2
# good: [182966e1cd74ec0e326cd376de241803ee79741b] Merge tag 'media/v5.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
git bisect good 182966e1cd74ec0e326cd376de241803ee79741b
# good: [49a24e9d9c740d3bd8b1200f225f67d45e3d68a5] Make the SOF control, PCM and PM code IPC agnostic
git bisect good 49a24e9d9c740d3bd8b1200f225f67d45e3d68a5
# bad: [8ffa5709e577385a1c8d20fb434cb02732f1d991] Merge tag 'arm-defconfig-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
git bisect bad 8ffa5709e577385a1c8d20fb434cb02732f1d991
# good: [e6aef3496a00a12e78a571f61d98300cf0a86e6a] Merge tag 'm68knommu-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
git bisect good e6aef3496a00a12e78a571f61d98300cf0a86e6a
# bad: [9c0e6a89b592f4c4e4d769dbc22d399ab0685159] Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
git bisect bad 9c0e6a89b592f4c4e4d769dbc22d399ab0685159
# bad: [cafc0eab168917ec9c0cd47d530a40cd40eb2928] ARM: v7m: enable support for IRQ stacks
git bisect bad cafc0eab168917ec9c0cd47d530a40cd40eb2928
# good: [b832faec33d4e27c32490c0732098ecf79b222af] ARM: switch_to: clean up Thumb2 code path
git bisect good b832faec33d4e27c32490c0732098ecf79b222af
# good: [54f481a2308efab49d2b14c3f8263b34fdb1c65e] ARM: remove old-style irq entry
git bisect good 54f481a2308efab49d2b14c3f8263b34fdb1c65e
# good: [4e918ab13eaf40f19938659cb5a22c93172778a8] ARM: assembler: add optimized ldr/str macros to load variables from memory
git bisect good 4e918ab13eaf40f19938659cb5a22c93172778a8
# bad: [b87cf9118e03d8a83039c88fa348165148f5d487] ARM: use TLS register for 'current' on !SMP as well
git bisect bad b87cf9118e03d8a83039c88fa348165148f5d487
# good: [7b9896c352073156a325c3bb0dc4c46e06e2a468] ARM: percpu: add SMP_ON_UP support
git bisect good 7b9896c352073156a325c3bb0dc4c46e06e2a468
# first bad commit: [b87cf9118e03d8a83039c88fa348165148f5d487] ARM: use TLS register for 'current' on !SMP as well

@mdmillerii
Copy link

Considering that b87cf91 is a kconfig change that implies CONFIG_SMP was already broken do you plan to bisect that config (I'd expect on UP qemu to be a sufficient test)?

shenki pushed a commit that referenced this issue Mar 10, 2023
[ Upstream commit 17122c0 ]

Treat any exception during instruction decode for EMULTYPE_SKIP as a
"full" emulation failure, i.e. signal failure instead of queuing the
exception.  When decoding purely to skip an instruction, KVM and/or the
CPU has already done some amount of emulation that cannot be unwound,
e.g. on an EPT misconfig VM-Exit KVM has already processeed the emulated
MMIO.  KVM already does this if a #UD is encountered, but not for other
exceptions, e.g. if a #PF is encountered during fetch.

In SVM's soft-injection use case, queueing the exception is particularly
problematic as queueing exceptions while injecting events can put KVM
into an infinite loop due to bailing from VM-Enter to service the newly
pending exception.  E.g. multiple warnings to detect such behavior fire:

  ------------[ cut here ]------------
  WARNING: CPU: 3 PID: 1017 at arch/x86/kvm/x86.c:9873 kvm_arch_vcpu_ioctl_run+0x1de5/0x20a0 [kvm]
  Modules linked in: kvm_amd ccp kvm irqbypass
  CPU: 3 PID: 1017 Comm: svm_nested_soft Not tainted 6.0.0-rc1+ #220
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
  RIP: 0010:kvm_arch_vcpu_ioctl_run+0x1de5/0x20a0 [kvm]
  Call Trace:
   kvm_vcpu_ioctl+0x223/0x6d0 [kvm]
   __x64_sys_ioctl+0x85/0xc0
   do_syscall_64+0x2b/0x50
   entry_SYSCALL_64_after_hwframe+0x46/0xb0
  ---[ end trace 0000000000000000 ]---
  ------------[ cut here ]------------
  WARNING: CPU: 3 PID: 1017 at arch/x86/kvm/x86.c:9987 kvm_arch_vcpu_ioctl_run+0x12a3/0x20a0 [kvm]
  Modules linked in: kvm_amd ccp kvm irqbypass
  CPU: 3 PID: 1017 Comm: svm_nested_soft Tainted: G        W          6.0.0-rc1+ #220
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
  RIP: 0010:kvm_arch_vcpu_ioctl_run+0x12a3/0x20a0 [kvm]
  Call Trace:
   kvm_vcpu_ioctl+0x223/0x6d0 [kvm]
   __x64_sys_ioctl+0x85/0xc0
   do_syscall_64+0x2b/0x50
   entry_SYSCALL_64_after_hwframe+0x46/0xb0
  ---[ end trace 0000000000000000 ]---

Fixes: 6ea6e84 ("KVM: x86: inject exceptions produced by x86_decode_insn")
Signed-off-by: Sean Christopherson <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants