Date: Wed, 9 Oct 2024 12:18:42 +0000 From: Vasily Postnicov <shamaz.mazum@gmail.com> To: Peter Grehan <grehan@freebsd.org> Cc: freebsd-virtualization@freebsd.org Subject: Re: Running Mezzano in bhyve Message-ID: <CADnZ6BkWd-v=y0L9%2BGiu=ys_Cuk5nm6djApSXYLufYuv=WnQWQ@mail.gmail.com> In-Reply-To: <17f4077d-647d-4848-9d6f-97f9886ef636@freebsd.org> References: <CADnZ6B=ex24mbGN3du6UuS84akJZAxTcG5xqt0HB0RN5S262cQ@mail.gmail.com> <17f4077d-647d-4848-9d6f-97f9886ef636@freebsd.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
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.
>
>
[-- Attachment #2 --]
<div dir="ltr"><div dir="ltr">Thanks! It worked, but Mezanno crashes after a short period of time:<div><br></div><div>Begin PCI scan.<br>PCI:0:1F:0 8086:7000 Intel Corporation - 82371SB PIIX3 ISA [Natoma/Triton II] 6:1:0 rid: 0 hdr: 0 intr: FF<br>PCI:0:1D:0 FB5D:40FB NIL - NIL 3:0:0 rid: 0 hdr: 0 intr: FF<br> 40: MSI 84<br>PCI:0:5:0 1AF4:1000 Red Hat, Inc - Virtio network device 2:0:0 rid: 0 hdr: 0 intr: A<br> 40: Unknown capability 11<br> 4C: MSI 80<br>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<br> 40: MSI 88<br>Detected AHCI ABAR at C1002000<br>AHCI IRQ is B<br>Host Capabilities FF30FF3F<br>Global Host Control 80000000<br>Interrupt Status 0<br>Ports Implemented 1<br>Version 10300<br>Command Completion Coalescing Control 0<br>Command Completion Coalescing Ports 0<br>Enclosure Management Location 0<br>Enclosure Management Control 0<br>Host Capabilities Extended 4<br>BIOS/OS Handoff Control and Status 0<br>AHCI HBA version 1.300<br>Handler: 0<br>Config register: 17<br>----- PANIC -----<br>Early page fault on address 80000035B0<br>Local CPU is #<7A4AF9><br>Run queues:<br>Thread #<1468079 Thread Initial thread> holds the world<br>Run queue #<1498139>/SUPERVISOR:<br>Run queue #<1498159>/HIGH:<br>Run queue #<1498179>/NORMAL:<br>Run queue #<1498199>/LOW:<br>IRQ state:<br>IRQ #<1497DF9 Irq :Number 0> - 0 (86 delivered)<br> #<1499119> PIT [exclusive]<br>IRQ #<1497E29 Irq :Number 1> - 1 (1 delivered)<br> #<1499699> INTEL-8042-KEYBOARD [exclusive]<br>IRQ #<1498009 Irq :Number B> - B (0 delivered)<br> #<149C959> #<149C909><br>IRQ #<1498039 Irq :Number C> - C (0 delivered)<br> #<14993D9> INTEL-8042-AUXILIARY [exclusive]<br>Active timers: (current time is 147260)<br>Thread #<1468079 Thread Initial thread> ACTIVE #<1498669 Wait-Queue Heartbeat wait queue><br>TIFH: 1 TPFH: NIL<br>20000121FB90 7FFF892B07 DEBUG-DUMP<br>20000121FD20 7FFF800FAE (LAMBDA IN PANIC-1)<br>20000121FE30 7FFF80073F PANIC-1<br>20000121FE50 7FFF800633 PANIC<br>20000121FEC0 7FFF8820B1 FATAL-PAGE-FAULT<br>20000121FEF0 7FFF88114B %PAGE-FAULT-HANDLER<br>20000121FF40 7FFF87F3BB %%INTERRUPT-SERVICE-ROUTINES<br>20000121FFD0 80000035B0 #<unknown><br>200000A1FFF0 7FFF800841 %CALL-ON-WIRED-STACK-WITHOUT-INTERRUPTS<br>20000221FE60 7FFF958E90 (SETF PCI-CONFIG/16)<br>20000221FE90 7FFF9B5670 AHCI-PCI-REGISTER<br>20000221FEF0 7FFF95B9C9 (FLET DX-LAMBDA IN PCI-DETECT)<br>20000221FF50 7FFF95B22E MAP-PCI-DEVICES<br>20000221FF90 7FFF955671 PCI-DETECT<br>20000221FFA0 7FFF93C8F4 INITIALIZE-PLATFORM<br>20000221FFC0 7FFF8D7F03 BOOTLOADER-ENTRY-POINT<br></div><div><br></div><div>Looks like it executes an interrupt handler with calling something "on a wired stack without interrupts". Postmortem rflags:</div><div>root@vonbraun:~ # bhyvectl --vm=ubuntu --get-rflags<br>rflags[0] 0x0000000000000046<br></div><div><br></div><div>I do not know what to think, that %cal-on-wired-stack-without-interrupts seems to be legit to me: <a href="https://github.com/froggey/Mezzano/blob/master/supervisor/x86-64/interrupts.lisp">https://github.com/froggey/Mezzano/blob/master/supervisor/x86-64/interrupts.lisp</a></div><div>Anyway, thanks again for the help!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">ср, 9 окт. 2024 г. в 11:20, Peter Grehan <<a href="mailto:grehan@freebsd.org">grehan@freebsd.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">> Hi! Mezzano is an operating system written in Common lisp. I would like <br>
> to test it in bhyve. When I launch it, it spins infinitely in a loop <br>
> measuring how many CPU cycles it makes in a unit of time (I understood <br>
> it by adding various debug messages).<br>
> <br>
> The timer it uses is something called a PIT: <br>
> <a href="https://wiki.osdev.org/Programmable_Interval_Timer" rel="noreferrer" target="_blank">https://wiki.osdev.org/Programmable_Interval_Timer</a> <br>
> <<a href="https://wiki.osdev.org/Programmable_Interval_Timer" rel="noreferrer" target="_blank">https://wiki.osdev.org/Programmable_Interval_Timer</a>><br>
> <br>
> The problem is, once the timer is configured it fires an interrupt only <br>
> once, while it obviously must fire interrupts constantly at some <br>
> frequency (100 Hz, as I understand from the code).<br>
> <br>
> Is the PIT supported by bhyve? Does FreeBSD use it anywhere in its kernel?<br>
<br>
Yes, though mode 3 of the timer isn't supported by the device <br>
emulation. It appears that Mezzano uses that mode<br>
<br>
<a href="https://github.com/froggey/Mezzano/blob/master/supervisor/x86-64/time.lisp#L20" rel="noreferrer" target="_blank">https://github.com/froggey/Mezzano/blob/master/supervisor/x86-64/time.lisp#L20</a><br>
<br>
Try this patch to the PIT code to see if it helps<br>
<a href="https://people.freebsd.org/~grehan/bhyve_vatpit.diff" rel="noreferrer" target="_blank">https://people.freebsd.org/~grehan/bhyve_vatpit.diff</a><br>
<br>
later,<br>
<br>
Peter.<br>
<br>
</blockquote></div></div>
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADnZ6BkWd-v=y0L9%2BGiu=ys_Cuk5nm6djApSXYLufYuv=WnQWQ>
