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>
next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000e3012f06240a41fd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=3Dubuntu --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! =D1=81=D1=80, 9 =D0=BE=D0=BA=D1=82. 2024=E2=80=AF=D0=B3. =D0=B2 11:20, Pete= r 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.lis= p#L20 > > Try this patch to the PIT code to see if it helps > https://people.freebsd.org/~grehan/bhyve_vatpit.diff > > later, > > Peter. > > --000000000000e3012f06240a41fd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr">Thanks! It worked, but Mezanno crashes af= ter a short=C2=A0period 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>=C2=A0 =C2=A0 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>=C2=A0 =C2=A0 4= 0: Unknown capability 11<br>=C2=A0 =C2=A0 4C: MSI 80<br>PCI:0:3:0 8086:2821= Intel Corporation - 82801HR/HO/HH (ICH8R/DO/DH) 6 port SATA Controller [AH= CI mode] 1:6:1 rid: 0 hdr: 0 intr: B<br>=C2=A0 =C2=A0 40: MSI 88<br>Detecte= d AHCI ABAR at C1002000<br>AHCI IRQ is B<br>Host Capabilities FF30FF3F<br>G= lobal Host Control 80000000<br>Interrupt Status 0<br>Ports Implemented 1<br= >Version 10300<br>Command Completion Coalescing Control 0<br>Command Comple= tion Coalescing Ports 0<br>Enclosure Management Location 0<br>Enclosure Man= agement Control 0<br>Host Capabilities Extended 4<br>BIOS/OS Handoff Contro= l 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>Ru= n 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>=C2=A0 #<1499119> PIT [exclusive]<br>IRQ = #<1497E29 Irq :Number 1> - 1 (1 delivered)<br>=C2=A0 #<1499699>= INTEL-8042-KEYBOARD [exclusive]<br>IRQ #<1498009 Irq :Number B> - B = (0 delivered)<br>=C2=A0 #<149C959> #<149C909><br>IRQ #<14980= 39 Irq :Number C> - C (0 delivered)<br>=C2=A0 #<14993D9> INTEL-804= 2-AUXILIARY [exclusive]<br>Active timers: (current time is 147260)<br>Threa= d #<1468079 Thread Initial thread> ACTIVE #<1498669 Wait-Queue Hea= rtbeat wait queue><br>TIFH: 1 TPFH: NIL<br>20000121FB90 7FFF892B07 DEBUG= -DUMP<br>20000121FD20 7FFF800FAE (LAMBDA IN PANIC-1)<br>20000121FE30 7FFF80= 073F PANIC-1<br>20000121FE50 7FFF800633 PANIC<br>20000121FEC0 7FFF8820B1 FA= TAL-PAGE-FAULT<br>20000121FEF0 7FFF88114B %PAGE-FAULT-HANDLER<br>20000121FF= 40 7FFF87F3BB %%INTERRUPT-SERVICE-ROUTINES<br>20000121FFD0 80000035B0 #<= unknown><br>200000A1FFF0 7FFF800841 %CALL-ON-WIRED-STACK-WITHOUT-INTERRU= PTS<br>20000221FE60 7FFF958E90 (SETF PCI-CONFIG/16)<br>20000221FE90 7FFF9B5= 670 AHCI-PCI-REGISTER<br>20000221FEF0 7FFF95B9C9 (FLET DX-LAMBDA IN PCI-DET= ECT)<br>20000221FF50 7FFF95B22E MAP-PCI-DEVICES<br>20000221FF90 7FFF955671 = PCI-DETECT<br>20000221FFA0 7FFF93C8F4 INITIALIZE-PLATFORM<br>20000221FFC0 7= FFF8D7F03 BOOTLOADER-ENTRY-POINT<br></div><div><br></div><div>Looks like it= executes an interrupt handler with calling something "on a wired stac= k without interrupts". Postmortem rflags:</div><div>root@vonbraun:~ # = bhyvectl --vm=3Dubuntu --get-rflags<br>rflags[0] 0x0000000000000046<br></di= v><div><br></div><div>I do not know what to think, that %cal-on-wired-stack= -without-interrupts seems to be legit to me:=C2=A0<a href=3D"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= =3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=D1=81=D1=80, 9 =D0= =BE=D0=BA=D1=82. 2024=E2=80=AF=D0=B3. =D0=B2 11:20, Peter Grehan <<a hre= f=3D"mailto:grehan@freebsd.org">grehan@freebsd.org</a>>:<br></div><block= quote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-w= idth: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=3D"https://wiki.osdev.org/Programmable_Interval_Timer" rel=3D"= noreferrer" target=3D"_blank">https://wiki.osdev.org/Programmable_Interval_= Timer</a> <br> > <<a href=3D"https://wiki.osdev.org/Programmable_Interval_Timer" rel= =3D"noreferrer" target=3D"_blank">https://wiki.osdev.org/Programmable_Inter= val_Timer</a>><br> > <br> > The problem is, once the timer is configured it fires an interrupt onl= y <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 ker= nel?<br> <br> =C2=A0 Yes, though mode 3 of the timer isn't supported by the device <b= r> emulation. It appears that Mezzano uses that mode<br> <br> <a href=3D"https://github.com/froggey/Mezzano/blob/master/supervisor/x86-64= /time.lisp#L20" rel=3D"noreferrer" target=3D"_blank">https://github.com/fro= ggey/Mezzano/blob/master/supervisor/x86-64/time.lisp#L20</a><br> <br> =C2=A0 Try this patch to the PIT code to see if it helps<br> =C2=A0 =C2=A0 =C2=A0<a href=3D"https://people.freebsd.org/~grehan/bhyve_vat= pit.diff" rel=3D"noreferrer" target=3D"_blank">https://people.freebsd.org/~= grehan/bhyve_vatpit.diff</a><br> <br> later,<br> <br> Peter.<br> <br> </blockquote></div></div> --000000000000e3012f06240a41fd--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADnZ6BkWd-v=y0L9%2BGiu=ys_Cuk5nm6djApSXYLufYuv=WnQWQ>