Subject: two OS'es on two procs of MP system
To: None <tech-kern@netbsd.org>
From: Zeljko Vrba <zvrba@globalnet.hr>
List: tech-kern
Date: 06/22/2005 17:15:43
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

I do not really know the details of multiprocessors and APICs but from
what I gather, the processors are pretty much independent - each has its
own GDT, LDT, page tables, etc.

My idea was to use the boot processor for running one operating system
and the 1st application processor to run another OS. Of course, each
would have its dedicated physical memory which the other OS wouldn't touch.

The setup would be like this:
- - boot NetBSD on the first processor only, and allocate it e.g. only a
half of the available physical RAM.
- - a NetBSD application executes a special code (new system call?) to
boot the OS on the second processor
- - while the OS on the 2nd processor is running, NetBSD is halted waiting
for some kind of an interrupt to wake it up (in which case the 2nd OS
would become dormant)
- - both OS-es could share the PCI HW configuration. in fact NetBSD can
configure all hardware on boot and give the information to the '2nd OS'
in shared memory.

Now, since NetBSD on proc0 would be dormant while the 2nd OS is running,
there would be no contention for hardware. Also the OS-es would use
distinct physical memory, so there would be no problem either.

Why would I want such a setup - for fast development. If my prototype OS
crashes, reboot takes a few minutes - a waste of time. In my setup, the
other processor would triple fault -- and I don't know if it's possible
to send e.g. a NMI to boot processor via APIC in such case.. Then NetBSD
would wake up and take control of the machine again. Then also OS
debugging facilities come to mind (e.g. debugging the new OS from NetBSD
on different proc)

Maybe I'd also provision for the NetBSD in the 'dormant' state to handle
only local timer interrupts and keyboard events (e.g. it could recognize
a special key sequence to halt the 2nd OS and in other cases just
forward the interrupt to the 2nd proc). The timer on boot processor
could also be used as a watchdog timer and if the 2nd processor doesn't
send some message (IPI?) within some time interval, the NetBSD takes
control again.

NetBSD would also then be used as a main development platform for the
new OS (which, again, is probably going to be based on NetBSD).

Does this idea I've just written make any sense? Is it at least
theoretically possible to do? If not, why? Has it already been done?
Maybe I should just use XEN for development purposes (then XEN has an
API that I'd need to learn...)?

thanks for the answers and patience to read this..
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCuYCfFtofFpCIfhMRA06tAJ90QNwkJu1ZdjI2MQKiSlvS6w/WnACeKjfx
0lOS4IlVl1wlUUGY7+WrYZg=
=EaQc
-----END PGP SIGNATURE-----