qboot icon indicating copy to clipboard operation
qboot copied to clipboard

virtio block device causes kernel hang during startup

Open osresearch opened this issue 7 years ago • 2 comments

Booting a minimal kernel config with qboot and an attached virtio drive causes a kernel hang somewhere in the startup. This was run as:

qemu-3.0.0/x86_64-softmmu/qemu-system-x86_64 \
 --machine pc \
 --drive file=disk.img,format=raw,if=virtio \
 --device virtio-net,netdev=net0 \
 --kernel vmlinux-tiny \
 --initrd initrd-tiny \
 --bios qboot/bios.bin \

The problem appears with qemu-2.7 and with accel=kvm as well.

The dmesg output compared to SeaBIOS looks like an interrupt or PCI configuration issue:

--- seabios.txt	2018-10-31 18:09:07.935999826 -0400
+++ qboot.txt	2018-10-31 18:09:11.991999825 -0400
@@ -4,60 +4,52 @@
  e820: BIOS-provided physical RAM map:
  BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
  BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
+ BIOS-e820: [mem 0x00000000000d0000-0x00000000000effff] ACPI NVS
  BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
- BIOS-e820: [mem 0x0000000000100000-0x0000000007fddfff] usable
- BIOS-e820: [mem 0x0000000007fde000-0x0000000007ffffff] reserved
- BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
+ BIOS-e820: [mem 0x0000000000100000-0x0000000007ffffff] usable
  bootconsole [earlyser0] enabled
  NX (Execute Disable) protection: active
  tsc: Fast TSC calibration using PIT
  e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
  e820: remove [mem 0x000a0000-0x000fffff] usable
- e820: last_pfn = 0x7fde max_arch_pfn = 0x400000000
+ e820: last_pfn = 0x8000 max_arch_pfn = 0x400000000
  x86/PAT: Configuration [0-7]: WB  WT  UC- UC  WB  WT  UC- UC  
- found SMP MP-table at [mem 0x000f5930-0x000f593f] mapped at [ffffffffff200930]
  Base memory trampoline at [ffff880000099000] 99000 size 24576
  BRK [0x01b2e000, 0x01b2efff] PGTABLE
  BRK [0x01b2f000, 0x01b2ffff] PGTABLE
  BRK [0x01b30000, 0x01b30fff] PGTABLE
- BRK [0x01b31000, 0x01b31fff] PGTABLE
- RAMDISK: [mem 0x07a92000-0x07fcffff]
+ RAMDISK: [mem 0x07ac2000-0x07ffffff]
  Zone ranges:
-   DMA32    [mem 0x0000000000001000-0x0000000007fddfff]
+   DMA32    [mem 0x0000000000001000-0x0000000007ffffff]
    Normal   empty
  Movable zone start for each node
  Early memory node ranges
    node   0: [mem 0x0000000000001000-0x000000000009efff]
-   node   0: [mem 0x0000000000100000-0x0000000007fddfff]
- Initmem setup node 0 [mem 0x0000000000001000-0x0000000007fddfff]
- On node 0 totalpages: 32636
+   node   0: [mem 0x0000000000100000-0x0000000007ffffff]
+ Initmem setup node 0 [mem 0x0000000000001000-0x0000000007ffffff]
+ On node 0 totalpages: 32670
    DMA32 zone: 448 pages used for memmap
    DMA32 zone: 21 pages reserved
-   DMA32 zone: 32636 pages, LIFO batch:7
- Intel MultiProcessor Specification v1.4
- MPTABLE: OEM ID: BOCHSCPU
- MPTABLE: Product ID: 0.1         
- MPTABLE: APIC at: 0xFEE00000
- Processor #0 (Bootup-CPU)
- IOAPIC[0]: apic_id 0, version 32, address 0xfec00000, GSI 0-23
- Processors: 1
- e820: [mem 0x08000000-0xfffbffff] available for PCI devices
+   DMA32 zone: 32670 pages, LIFO batch:7
+ e820: [mem 0x08000000-0xffffffff] available for PCI devices
  clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
  random: get_random_bytes called from 0xffffffff81a69a17 with crng_init=0
  pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
  pcpu-alloc: [0] 0 
- Built 1 zonelists, mobility grouping on.  Total pages: 32167
+ Built 1 zonelists, mobility grouping on.  Total pages: 32201
  Kernel command line: console=ttyS0,57600 earlyprintk=ttyS0 console=ttyS0 debug
  PID hash table entries: 512 (order: 0, 4096 bytes)
  Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
  Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
- Memory: 111292K/130544K available (6152K kernel code, 413K rwdata, 456K rodata, 516K init, 272K bss, 19252K reserved, 0K cma-reserved)
- NR_IRQS: 4352, nr_irqs: 48, preallocated irqs: 16
+ Memory: 111424K/130680K available (6152K kernel code, 413K rwdata, 456K rodata, 516K init, 272K bss, 19256K reserved, 0K cma-reserved)
+ NR_IRQS: 4352, nr_irqs: 24, preallocated irqs: 16
  console [ttyS0] enabled
+ console [ttyS0] enabled
+ bootconsole [earlyser0] disabled
  bootconsole [earlyser0] disabled
  tsc: Fast TSC calibration using PIT
- tsc: Detected 2807.907 MHz processor
- Calibrating delay loop (skipped), value calculated using timer frequency.. 5615.81 BogoMIPS (lpj=28079070)
+ tsc: Detected 2807.903 MHz processor
+ Calibrating delay loop (skipped), value calculated using timer frequency.. 5615.80 BogoMIPS (lpj=28079030)
  pid_max: default: 4096 minimum: 301
  Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
  Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
@@ -67,7 +59,7 @@
  Spectre V2 : Spectre mitigation: kernel not compiled with retpoline; no mitigation available!
  Speculative Store Bypass: Vulnerable
  Performance Events: PMU not available due to virtualization, using software events only.
- ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
+ Not enabling interrupt remapping due to skipped IO-APIC setup
  devtmpfs: initialized
  clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
  futex hash table entries: 16 (order: -4, 384 bytes)
@@ -87,7 +79,7 @@
  pci 0000:00:00.0: [8086:1237] type 00 class 0x060000
  pci 0000:00:01.0: [8086:7000] type 00 class 0x060100
  pci 0000:00:01.1: [8086:7010] type 00 class 0x010180
- pci 0000:00:01.1: reg 0x20: [io  0xc060-0xc06f]
+ pci 0000:00:01.1: reg 0x20: [io  0x0000-0x000f]
  pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io  0x01f0-0x01f7]
  pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io  0x03f6]
  pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io  0x0170-0x0177]
@@ -96,26 +88,34 @@
  pci 0000:00:01.3: quirk: [io  0x0600-0x063f] claimed by PIIX4 ACPI
  pci 0000:00:01.3: quirk: [io  0x0700-0x070f] claimed by PIIX4 SMB
  pci 0000:00:02.0: [1234:1111] type 00 class 0x030000
- pci 0000:00:02.0: reg 0x10: [mem 0xfd000000-0xfdffffff pref]
- pci 0000:00:02.0: reg 0x18: [mem 0xfebd0000-0xfebd0fff]
- pci 0000:00:02.0: reg 0x30: [mem 0xfebc0000-0xfebcffff pref]
- pci 0000:00:02.0: vgaarb: setting as boot VGA device
- pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
+ pci 0000:00:02.0: reg 0x10: [mem 0x00000000-0x00ffffff pref]
+ pci 0000:00:02.0: reg 0x18: [mem 0x00000000-0x00000fff]
+ pci 0000:00:02.0: reg 0x30: [mem 0x00000000-0x0000ffff pref]
+ pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=none,locks=none
  pci 0000:00:03.0: [1af4:1000] type 00 class 0x020000
- pci 0000:00:03.0: reg 0x10: [io  0xc040-0xc05f]
- pci 0000:00:03.0: reg 0x14: [mem 0xfebd1000-0xfebd1fff]
- pci 0000:00:03.0: reg 0x20: [mem 0xfe000000-0xfe003fff 64bit pref]
- pci 0000:00:03.0: reg 0x30: [mem 0xfeb80000-0xfebbffff pref]
+ pci 0000:00:03.0: reg 0x10: [io  0x0000-0x001f]
+ pci 0000:00:03.0: reg 0x14: [mem 0x00000000-0x00000fff]
+ pci 0000:00:03.0: reg 0x20: [mem 0x00000000-0x00003fff 64bit pref]
+ pci 0000:00:03.0: reg 0x30: [mem 0x00000000-0x0003ffff pref]
  pci 0000:00:04.0: [1af4:1001] type 00 class 0x010000
- pci 0000:00:04.0: reg 0x10: [io  0xc000-0xc03f]
- pci 0000:00:04.0: reg 0x14: [mem 0xfebd2000-0xfebd2fff]
- pci 0000:00:04.0: reg 0x20: [mem 0xfe004000-0xfe007fff 64bit pref]
+ pci 0000:00:04.0: reg 0x10: [io  0x0000-0x003f]
+ pci 0000:00:04.0: reg 0x14: [mem 0x00000000-0x00000fff]
+ pci 0000:00:04.0: reg 0x20: [mem 0x00000000-0x00003fff 64bit pref]
  pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
- pci 0000:00:01.0: PIIX/ICH IRQ router [8086:7000]
  PCI: pci_cache_line_size set to 64 bytes
  e820: reserve RAM buffer [mem 0x0009fc00-0x0009ffff]
- e820: reserve RAM buffer [mem 0x07fde000-0x07ffffff]
  clocksource: Switched to clocksource refined-jiffies
+ pci 0000:00:02.0: BAR 0: assigned [mem 0x08000000-0x08ffffff pref]
+ pci 0000:00:03.0: BAR 6: assigned [mem 0x09000000-0x0903ffff pref]
+ pci 0000:00:02.0: BAR 6: assigned [mem 0x09040000-0x0904ffff pref]
+ pci 0000:00:03.0: BAR 4: assigned [mem 0x100000000-0x100003fff 64bit pref]
+ pci 0000:00:04.0: BAR 4: assigned [mem 0x100004000-0x100007fff 64bit pref]
+ pci 0000:00:02.0: BAR 2: assigned [mem 0x09050000-0x09050fff]
+ pci 0000:00:03.0: BAR 1: assigned [mem 0x09051000-0x09051fff]
+ pci 0000:00:04.0: BAR 1: assigned [mem 0x09052000-0x09052fff]
+ pci 0000:00:04.0: BAR 0: assigned [io  0x1000-0x103f]
+ pci 0000:00:03.0: BAR 0: assigned [io  0x1040-0x105f]
+ pci 0000:00:01.1: BAR 4: assigned [io  0x1060-0x106f]
  pci_bus 0000:00: resource 4 [io  0x0000-0xffff]
  pci_bus 0000:00: resource 5 [mem 0x00000000-0xffffffffff]
  NET: Registered protocol family 2
@@ -128,7 +128,6 @@
  pci 0000:00:00.0: Limiting direct PCI/PCI transfers
  pci 0000:00:01.0: PIIX3: Enabling Passive Release
  pci 0000:00:01.0: Activating ISA DMA hang workarounds
- pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
  PCI: CLS 0 bytes, default 64
  Unpacking initramfs...
  Freeing initrd memory: 5368K
@@ -140,25 +139,9 @@
  io scheduler cfq registered (default)
  io scheduler mq-deadline registered
  io scheduler kyber registered
- virtio-pci 0000:00:03.0: PCI->APIC IRQ transform: INT A -> IRQ 11
- virtio-pci 0000:00:04.0: PCI->APIC IRQ transform: INT A -> IRQ 11
+ virtio-pci 0000:00:03.0: enabling device (0000 -> 0003)
+ virtio-pci 0000:00:04.0: enabling device (0000 -> 0003)
  Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
  serial8250: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A

osresearch avatar Oct 31 '18 22:10 osresearch

perhaps you could try this https://github.com/bonzini/qboot/pull/19 to fix the problem ?

pengkh avatar Jul 12 '19 11:07 pengkh

I don't think #19 is related. Anyway it's merged now.

bonzini avatar Jul 12 '19 13:07 bonzini