byteduck/duckOS

duckOS hangs when booting on an old version of QEMU.

PF94 opened this issue · 14 comments

PF94 commented

This does not occur on Bochs nor 86box. Appears to be a issue related to the drive.

Interesting. Are you building it yourself? And if so, are you using the qemu script (make qemu)? Is there any serial log output?

PF94 commented

Interesting. Are you building it yourself? And if so, are you using the qemu script (make qemu)? Is there any serial log output?

I am building it myself and I am indeed using make qemu.

grkb@grkb-inspiron3537:~/duckOS/cmake-build$ make qemu
qemu-system-x86_64: --display help: Invalid parameter 'help'
qemu-system-x86_64: --display help: Invalid parameter 'help'
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: multiboot knows VBE. we don't
[kinit] [INFO] Starting duckOS...
[kinit] [DEBUG] BIOS boot disk: 0x8
[MemoryManager] [DEBUG] Adding memory region from 0x0 -> 0x9efff (Unused, Unreserved)
[MemoryManager] [DEBUG] Ignoring too-small memory region at 0x9fc00
[MemoryManager] [DEBUG] Adding memory region from 0xf0000 -> 0xfffff (Used, Reserved)
[MemoryManager] [DEBUG] Adding memory region from 0x100000 -> 0x1ffdffff (Unused, Unreserved)
[MemoryManager] [DEBUG] Adding memory region from 0x1ffe0000 -> 0x1fffffff (Used, Reserved)
[MemoryManager] [DEBUG] Adding memory region from 0xfeffc000 -> 0xfeffffff (Used, Reserved)
[MemoryManager] [DEBUG] Adding memory region from 0xfffc0000 -> 0xffffffff (Used, Reserved)
[Device] [DEBUG] Device 1,5 registered
[Device] [DEBUG] Device 1,8 registered
[Device] [DEBUG] Device 1,3 registered
[I8042] [DEBUG] Attempting to initialize...
[I8042] [DEBUG] Found dual-channel controller
[I8042] [DEBUG] Keyboard available
[I8042] [DEBUG] Mouse available
[I8042] [DEBUG] Keyboard successfully enabled
[Device] [DEBUG] Device 13,0 registered
[I8042] [DEBUG] Mouse successfully enabled
[Device] [DEBUG] Device 13,1 registered
[I8042/Mouse] [DEBUG] Initializing mouse...
[I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[I8042] [WARN] Read timed out...
[I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[I8042] [WARN] Read timed out...
[I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[I8042] [WARN] Read timed out...
[I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[I8042] [WARN] Read timed out...
[I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[I8042] [WARN] Read timed out...
[I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[I8042] [WARN] Read timed out...
[I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[I8042] [WARN] Read timed out...
[I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[I8042] [WARN] Read timed out...
[I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[I8042] [WARN] Read timed out...
[I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[I8042] [WARN] Read timed out...
[I8042] [WARN] Read timed out...
[I8042/Mouse] [DEBUG] Mouse initialized!
[Device] [DEBUG] Device 5,2 registered
[Device] [DEBUG] Device 1,16 registered
[CommandLine] [INFO] Command line options: 'kernel/duckk32 '''
[Device] [DEBUG] Device 29,0 registered
[VGA] [INFO] Found a bochs-compatible VGA device at 0:2.0
[VGA] [DEBUG] virtual framebuffer mapped from 0xfd000000 to 0xc0261000
[kinit] [INFO] Debug mode is enabled.
[kinit] [DEBUG] First stage complete.
[TaskManager] [DEBUG] Initializing tasking...
[kinit] [DEBUG] Tasking initialized.
[Device] [DEBUG] Device 4,0 registered
[kinit] [DEBUG] Initializing disk...
[Device] [DEBUG] Device 3,0 registered
[PATA] [DEBUG] IDE controller capable of bus mastering
[PATA] [INFO] Setup disk QEMU HARDDISK using DMA (284544 blocks)

Question: are there any other VM software out there that supports raw image disk files besides Bochs? That one runs slowly and takes a few minutes for Pond to show up.

Interesting - definitely something with the disk. I could add more debug logging to the IDE driver to pinpoint these issues, since I have seen them on real hardware before (but never qemu).

You could try using PIO instead, which might work. Edit the line near the end of scripts/qemu.sh from -append \"\" to -append \"use_pio\".

PF94 commented

That seems to be bugged as it oddly still uses this "DMA" thing.

[I8042/Mouse] [DEBUG] Mouse initialized!
[Device] [DEBUG] Device 5,2 registered
[Device] [DEBUG] Device 1,16 registered
[CommandLine] [INFO] Command line options: 'kernel/duckk32 "use_pio"'
[Device] [DEBUG] Device 29,0 registered
[VGA] [INFO] Found a bochs-compatible VGA device at 0:2.0
[VGA] [DEBUG] virtual framebuffer mapped from 0xfd000000 to 0xc0261000
[kinit] [INFO] Debug mode is enabled.
[kinit] [DEBUG] First stage complete.
[TaskManager] [DEBUG] Initializing tasking...
[kinit] [DEBUG] Tasking initialized.
[Device] [DEBUG] Device 4,0 registered
[kinit] [DEBUG] Initializing disk...
[Device] [DEBUG] Device 3,0 registered
[PATA] [DEBUG] IDE controller capable of bus mastering
[PATA] [INFO] Setup disk QEMU HARDDISK using DMA (284544 blocks)
PF94 commented

I got it to boot with PIO however it still hangs there.

image

PF94 commented

I wonder if there's also a bug with I8042? Because that bug doesn't occur on Bochs when I checked it's output. Additionally this does not occur on the (outdated) v86 instance.

Perhaps QEMU's way of implementing the PS/2 mice is weird since moving the mice too much also causes it to print out warnings (which also occur on Bochs) about the event buffer being full.

Interesting. Are you using KVM? You could try removing the kvm flag from the qemu arguments in qemu.sh and see if that fixes it.

As for the PS/2 driver, there is a problem with that. I do think it shows up on the v86 version too, but that doesn't actually start from a cold boot since that would take a few minutes - it loads an already booted memory state, so you don't see most of the logs from when it boots.

PF94 commented

Interesting. Are you using KVM? You could try removing the kvm flag from the qemu arguments in qemu.sh and see if that fixes it.

Disabling KVM does not seem to help.

image

Hmm, weird. I can't reproduce this, but the first thing that comes to mind is that it could be an issue with the way the interrupts are being handled or something. You could try adding some debug prints in PATADevice::handle_irq (kernel/device/PATADevice.cpp) to see if it's getting the interrupt or if there's something wrong with its state.

PF94 commented

Hmm, weird. I can't reproduce this

What's your QEMU version? Mine's 4.2.1.

Edit: I added some debug output on PATADevice::handle_irq and while it floods the serial output on Bochs with what I decided it to print, nothing shows up on QEMU.

Hmm... Looks like your QEMU is pretty out of date - mine is 7.1.0. Which distro are you using?

PF94 commented

Hmm... Looks like your QEMU is pretty out of date - mine is 7.1.0. Which distro are you using?

Ubuntu 20.04, I was compiling 7.1.0 before I had to go to bed. perhaps 7.1.0 will fix issues.

Ubuntu 20.04, I was compiling 7.1.0 before I had to go to bed. perhaps 7.1.0 will fix issues.

Yeah, hopefully that will fix it. Either way, it shouldn't be broken on an older qemu version, so I'll have to try and figure out why this is happening.

PF94 commented

Yeah, hopefully that will fix it. Either way, it shouldn't be broken on an older qemu version, so I'll have to try and figure out why this is happening.

image

seems to fix it.