Guru meditation when rebooting Phar Lap ETS

Discussions about using non Windows and Linux guests such as FreeBSD, DOS, OS/2, OpenBSD, etc.
Post Reply
jwestfah
Posts: 9
Joined: 27. Jul 2011, 19:32
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows XP

Guru meditation when rebooting Phar Lap ETS

Post by jwestfah »

Hi, I've been working on getting Phar Lap ETS RTOS running under VirtualBox, and I've had a lot of success. One problem that remains is that I get a guru meditation when I try to reboot the VM. This is a change in behavior from 4.2 (tried recently with 4.2.16) where the VM would just hang when it gets the reboot command. In VirtualBox 4.3.10, we now get this guru meditation. Log file attached.
Attachments
VBox.zip
(32.71 KiB) Downloaded 49 times
klaus
Oracle Corporation
Posts: 1110
Joined: 10. May 2007, 14:57

Re: Guru meditation when rebooting Phar Lap ETS

Post by klaus »

Cool, so this software depends on triple faults triggering a reboot (don't ask me why you got a hang with 4.2, the triple fault behavior in VirtualBox should've always been to trigger a Guru Meditation). Not really reliable, as the triple fault behavior is defined by the chipset (the CPU will go into shutdown, and the corresponding bus cycle is detected by the chipset, which in the typical configuration triggers a CPU reset)...

Since VirtualBox 4.3.0 the behavior can be configured, see VBoxManage modifyvm --triplefaultreset in the manual, see http://www.virtualbox.org/manual/ch08.h ... e-modifyvm
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Guru meditation when rebooting Phar Lap ETS

Post by michaln »

I didn't know that any OS that reboots the system by triple faulting the CPU was still in active use :) ETS clearly uses the classic trick of setting the IDT limit to zero and triggering an interrupt, a method of forcing a triple fault shown in the Intel 286 manual back in 1984 or so.

The change in VirtualBox behavior you observe when going from 4.2.x to 4.3.x is caused by different treatment of triple faults. Older versions didn't really do anything and the VM would effectively get stuck. In 4.3, triple faults are reported as critical errors which is what they almost always are. Except in your case they're not, or at least not always.

Klaus already mentioned the fix. Hopefully it works for you, it's certainly not been tested with Phar Lap ETS.
jwestfah
Posts: 9
Joined: 27. Jul 2011, 19:32
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows XP

Re: Guru meditation when rebooting Phar Lap ETS

Post by jwestfah »

Thanks for the quick responses. Setting triplefaultreset to on with modifyvm does indeed cause reset to work if I only assign a single CPU to the system. However, ETS supports SMP, and I still get the guru meditation when resetting with multiple CPUs assigned to the system.
jwestfah
Posts: 9
Joined: 27. Jul 2011, 19:32
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows XP

Re: Guru meditation when rebooting Phar Lap ETS

Post by jwestfah »

Hmm, I'm also getting intermittent hangs at boot after a successful triple fault reboot. Without the PUEL extension pack, it appears to try booting iPXE, with the extension pack it just hangs at boot.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Guru meditation when rebooting Phar Lap ETS

Post by michaln »

The best suggestion I have right now is "don't reset the system by triple faulting". Use the PS/2 system port A (92h), keyboard controller, or ACPI.

There are two problems with resetting by triple faults. First, only the CPU is reset, not the entire system. That means for example that if there's any bus master activity at the wrong time, the reboot can fail. Second, it's usually useful to treat triple faults as a fatal error and capture the VM state for debugging.

As for the hangs, I doubt we can debug/fix that without ETS. Or do you know why/where exactly the VM is hanging?
jwestfah
Posts: 9
Joined: 27. Jul 2011, 19:32
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows XP

Re: Guru meditation when rebooting Phar Lap ETS

Post by jwestfah »

What about changing the behavior of the "triplefaultreset" modifyvm option to just trigger a "normal" reset, like using the Machine->Reset menu option? I've prototyped this with OSE and it seems to work perfectly, even in SMP mode. From a cursory glance, this appears to be how qemu handles triple fault, and according to my coworker, resets "just work" in qemu.

I'll post my patch to the dev list and we can discuss it there.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Guru meditation when rebooting Phar Lap ETS

Post by michaln »

jwestfah wrote:What about changing the behavior of the "triplefaultreset" modifyvm option to just trigger a "normal" reset, like using the Machine->Reset menu option?
Because that's not the way things work. There's software out there which relies on a triple fault only resetting the CPU and performing a warm reboot (and not really resetting the system at all).

In the SMP case, completely resetting the VM would be an option, but that's probably too confusing to actually implement. What might work would be for the BIOS to trigger a hard reset if it detects a CPU reset but warm reboot was not requested.
jwestfah
Posts: 9
Joined: 27. Jul 2011, 19:32
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows XP

Re: Guru meditation when rebooting Phar Lap ETS

Post by jwestfah »

Okay, fair enough. If you're interested in testing it, I can give you an image.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Guru meditation when rebooting Phar Lap ETS

Post by michaln »

Yes, I'm interested... please PM me if necessary.

BTW do you know what, if anything, ETS writes into the CMOS shutdown byte (offset 0xF in the CMOS non-volatile memory)?
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Guru meditation when rebooting Phar Lap ETS

Post by michaln »

michaln wrote:BTW do you know what, if anything, ETS writes into the CMOS shutdown byte (offset 0xF in the CMOS non-volatile memory)?
To answer myself, nothing. Or maybe it writes zero, which amounts to the same thing. And the word at 40:67 doesn't indicate a warm boot either.

After reset, the BIOS ends up in no-man's land, and I'm currently trying to figure out why. All I can say for certain is that this is completely untested, since no single modern OS uses triple fault as a way to reset the system :) The last OS I saw doing that was maybe FreeBSD 1.0 or something like that. Microsoft and IBM OSes never did it (though some used triple faulting as a way to get out of protected mode).
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Guru meditation when rebooting Phar Lap ETS

Post by michaln »

Okay, the immediate cause of the hang problem seems to be an interrupt at the wrong time. I'm fairly certain it's the APIC timer interrupt, which is left enabled at the time ETS triple faults the CPU. But I'm not sure it's the ultimate cause.

I have to do some digging into how a BIOS "should" behave in this situation. I have a feeling it might be expected to trigger a hard system reset, but this is a highly undocumented aspect of PC operation. I'm not at all certain all systems behave the same, either.
jwestfah
Posts: 9
Joined: 27. Jul 2011, 19:32
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows XP

Re: Guru meditation when rebooting Phar Lap ETS

Post by jwestfah »

Thanks for looking into this Michael!
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Guru meditation when rebooting Phar Lap ETS

Post by michaln »

FYI, I have a fix for the single VCPU case, a BIOS change which will force a VM reset in this situation.

The SMP case needs investigation because I need to figure out what's actually supposed to happen. Should triple faulting one CPU reset only that one CPU or all CPUs? I just don't know.
Post Reply