Re: Running Mezzano in bhyve

From: Vasily Postnicov <shamaz.mazum_at_gmail.com>
Date: Wed, 09 Oct 2024 12:18:42 UTC
Thanks! It worked, but Mezanno crashes after a short period of time:

Begin PCI scan.
PCI:0:1F:0 8086:7000 Intel Corporation - 82371SB PIIX3 ISA [Natoma/Triton
II] 6:1:0 rid: 0 hdr: 0 intr: FF
PCI:0:1D:0 FB5D:40FB NIL - NIL 3:0:0 rid: 0 hdr: 0 intr: FF
    40: MSI 84
PCI:0:5:0 1AF4:1000 Red Hat, Inc - Virtio network device 2:0:0 rid: 0 hdr:
0 intr: A
    40: Unknown capability 11
    4C: MSI 80
PCI:0:3:0 8086:2821 Intel Corporation - 82801HR/HO/HH (ICH8R/DO/DH) 6 port
SATA Controller [AHCI mode] 1:6:1 rid: 0 hdr: 0 intr: B
    40: MSI 88
Detected AHCI ABAR at C1002000
AHCI IRQ is B
Host Capabilities FF30FF3F
Global Host Control 80000000
Interrupt Status 0
Ports Implemented 1
Version 10300
Command Completion Coalescing Control 0
Command Completion Coalescing Ports 0
Enclosure Management Location 0
Enclosure Management Control 0
Host Capabilities Extended 4
BIOS/OS Handoff Control and Status 0
AHCI HBA version 1.300
Handler: 0
Config register: 17
----- PANIC -----
Early page fault on address 80000035B0
Local CPU is #<7A4AF9>
Run queues:
Thread #<1468079 Thread Initial thread> holds the world
Run queue #<1498139>/SUPERVISOR:
Run queue #<1498159>/HIGH:
Run queue #<1498179>/NORMAL:
Run queue #<1498199>/LOW:
IRQ state:
IRQ #<1497DF9 Irq :Number 0> - 0 (86 delivered)
  #<1499119> PIT [exclusive]
IRQ #<1497E29 Irq :Number 1> - 1 (1 delivered)
  #<1499699> INTEL-8042-KEYBOARD [exclusive]
IRQ #<1498009 Irq :Number B> - B (0 delivered)
  #<149C959> #<149C909>
IRQ #<1498039 Irq :Number C> - C (0 delivered)
  #<14993D9> INTEL-8042-AUXILIARY [exclusive]
Active timers: (current time is 147260)
Thread #<1468079 Thread Initial thread> ACTIVE #<1498669 Wait-Queue
Heartbeat wait queue>
TIFH: 1 TPFH: NIL
20000121FB90 7FFF892B07 DEBUG-DUMP
20000121FD20 7FFF800FAE (LAMBDA IN PANIC-1)
20000121FE30 7FFF80073F PANIC-1
20000121FE50 7FFF800633 PANIC
20000121FEC0 7FFF8820B1 FATAL-PAGE-FAULT
20000121FEF0 7FFF88114B %PAGE-FAULT-HANDLER
20000121FF40 7FFF87F3BB %%INTERRUPT-SERVICE-ROUTINES
20000121FFD0 80000035B0 #<unknown>
200000A1FFF0 7FFF800841 %CALL-ON-WIRED-STACK-WITHOUT-INTERRUPTS
20000221FE60 7FFF958E90 (SETF PCI-CONFIG/16)
20000221FE90 7FFF9B5670 AHCI-PCI-REGISTER
20000221FEF0 7FFF95B9C9 (FLET DX-LAMBDA IN PCI-DETECT)
20000221FF50 7FFF95B22E MAP-PCI-DEVICES
20000221FF90 7FFF955671 PCI-DETECT
20000221FFA0 7FFF93C8F4 INITIALIZE-PLATFORM
20000221FFC0 7FFF8D7F03 BOOTLOADER-ENTRY-POINT

Looks like it executes an interrupt handler with calling something "on a
wired stack without interrupts". Postmortem rflags:
root@vonbraun:~ # bhyvectl --vm=ubuntu --get-rflags
rflags[0] 0x0000000000000046

I do not know what to think, that %cal-on-wired-stack-without-interrupts
seems to be legit to me:
https://github.com/froggey/Mezzano/blob/master/supervisor/x86-64/interrupts.lisp
Anyway, thanks again for the help!

ср, 9 окт. 2024 г. в 11:20, Peter Grehan <grehan@freebsd.org>:

> > Hi! Mezzano is an operating system written in Common lisp. I would like
> > to test it in bhyve. When I launch it, it spins infinitely in a loop
> > measuring how many CPU cycles it makes in a unit of time (I understood
> > it by adding various debug messages).
> >
> > The timer it uses is something called a PIT:
> > https://wiki.osdev.org/Programmable_Interval_Timer
> > <https://wiki.osdev.org/Programmable_Interval_Timer>
> >
> > The problem is, once the timer is configured it fires an interrupt only
> > once, while it obviously must fire interrupts constantly at some
> > frequency (100 Hz, as I understand from the code).
> >
> > Is the PIT supported by bhyve? Does FreeBSD use it anywhere in its
> kernel?
>
>   Yes, though mode 3 of the timer isn't supported by the device
> emulation. It appears that Mezzano uses that mode
>
>
> https://github.com/froggey/Mezzano/blob/master/supervisor/x86-64/time.lisp#L20
>
>   Try this patch to the PIT code to see if it helps
>      https://people.freebsd.org/~grehan/bhyve_vatpit.diff
>
> later,
>
> Peter.
>
>