Problems with APIC on QEMU

General discussion about Visopsys. We'll create more specific forums if the number of posts justifies that.
nextvolume
Posts: 30
Joined: Sun Sep 01, 2013 7:58 pm

Problems with APIC on QEMU

Post by nextvolume » Thu Oct 30, 2014 11:02 pm

Visopsys 0.75 does not boot successfully on QEMU (tested on 2.0.0 and 2.1.0), it stays still while waiting for IDE drive interrupts.. (as compiling the kernel with debug enabled reveals). I did a bit of research and I found the culprit: it is the APIC support that was added in this very release.
Visopsys disables any old-style interrupt controllers if it finds an APIC-compatible interrupt controller.
It seems that QEMU's APIC support does not work correctly, and thus the kernel seems unable to get (at least some) interrupts.
The workaround right now is disabling the APIC driver, but as there is no way to configure a Visopsys kernel when compiling or at runtime, one first needs to comment the relevant line for the APIC driver in src/kernel/kernelDevice.c (just make a search for APIC in the file) in the sources and then build the system from sources again.
This makes Visopsys 0.75 work and boot fine on QEMU.

I made floppy, CD and USB images with APIC already disabled:
http://unhaut.fav.cc/visopsys/visopsys- ... ic-img.zip (floppy)
http://unhaut.fav.cc/visopsys/visopsys- ... ic-iso.zip (CD ISO image)
http://unhaut.fav.cc/visopsys/visopsys- ... ic-usb.zip (USB image)

You can use these with QEMU until this issue is fixed.
Visopsys@Unhaut - http://unhaut.fav.cc/visopsys

User avatar
andymc
Posts: 479
Joined: Tue Nov 16, 2010 7:20 pm

Re: Problems with APIC on QEMU

Post by andymc » Fri Oct 31, 2014 12:41 am

Ah, dang, sorry guys. I didn't test the new APIC code with Qemu, only VMware and some real systems.

I notice that when I turn on the APIC in VirtualBox things fail also.

I'll look into it.

User avatar
andymc
Posts: 479
Joined: Tue Nov 16, 2010 7:20 pm

Re: Problems with APIC on QEMU

Post by andymc » Fri Oct 31, 2014 12:46 am

I tried to make the new APIC code quite conservative, only enabling itself when it thinks everything is kosher, but when it does enable, it has to disable the PIC. Mixed mode is complicated, and not really recommended, so in the kernel it has to be one or the other.

User avatar
andymc
Posts: 479
Joined: Tue Nov 16, 2010 7:20 pm

Re: Problems with APIC on QEMU

Post by andymc » Thu Dec 04, 2014 3:50 am

Hi nextvolume,

I was seeing similar error messages in VirtualBox, but I've had difficulties setting up Qemu on my dev machine. Could you possibly try dropping this version of the APIC driver into your source tree, and see whether it solves the problems you've been seeing with missing interrupts, etc.?

I seem to have solved it in VirtualBox, and the error messages were so similar to Qemu (Ronaldees had the same error messages). It would be helpful if you guys could give it a quick test.
Attachments
kernelApicDriver.c
(26.76 KiB) Downloaded 504 times

User avatar
andymc
Posts: 479
Joined: Tue Nov 16, 2010 7:20 pm

Re: Problems with APIC on QEMU

Post by andymc » Thu Dec 04, 2014 4:33 pm

Alright, I did get Qemu up and running. There are some seemingly-harmless error messages from the RTC driver, but the APIC code seems alright now.

The problem was related to prioritizing multiple interrupts-in-service, for anyone who's interested in that level of detail ;-)

nextvolume
Posts: 30
Joined: Sun Sep 01, 2013 7:58 pm

Re: Problems with APIC on QEMU

Post by nextvolume » Thu Dec 04, 2014 10:02 pm

I dropped the file in the 0.75N1 source tree and unfortunately it does not work for me in QEMU.
Visopsys@Unhaut - http://unhaut.fav.cc/visopsys

User avatar
andymc
Posts: 479
Joined: Tue Nov 16, 2010 7:20 pm

Re: Problems with APIC on QEMU

Post by andymc » Thu Dec 04, 2014 11:34 pm

Thanks for trying it. Hmm, perhaps I changed something else in my tree (not in that file) that helps. Everything seems good with this Qemu (downloaded today) and my 0.76 tree. I was thinking I'm ready to do another release, though I will do some more testing for a few days. Do you want to try a pre-release 0.76 .iso?

nextvolume
Posts: 30
Joined: Sun Sep 01, 2013 7:58 pm

Re: Problems with APIC on QEMU

Post by nextvolume » Fri Dec 05, 2014 9:11 am

Yes, it would be nice if I could try a prelease ISO.
Visopsys@Unhaut - http://unhaut.fav.cc/visopsys

User avatar
andymc
Posts: 479
Joined: Tue Nov 16, 2010 7:20 pm

Re: Problems with APIC on QEMU

Post by andymc » Mon Dec 08, 2014 12:12 am

Here we go. This is just about ready to release, I think, unless you guys tell me it's still seriously broken http://visopsys.org/files/visopsys/viso ... 07-iso.zip

nextvolume
Posts: 30
Joined: Sun Sep 01, 2013 7:58 pm

Re: Problems with APIC on QEMU

Post by nextvolume » Wed Dec 10, 2014 8:50 am

Unfortunately it still won't work on QEMU, I use version 2.1.0.
Just an idea: ever thought about registering if a certain key is pressed in the OS loader, and then disabling APIC if it was?
Visopsys@Unhaut - http://unhaut.fav.cc/visopsys

Post Reply