Availability of SMP Documentation

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
watermirror
Member
Member
Posts: 25
Joined: Tue Nov 05, 2013 4:06 am

Availability of SMP Documentation

Post by watermirror »

hi, is there any document can help to write a kernel with smp?
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Re: Availability of SMP Documentation

Post by thepowersgang »

There is, it's linked from the wiki's SMP page and is entitled "Intel Multiprocessor Specification". From my recollection, this contains the instructions required to initialise non-boot processors and the quirks of multi-processor machines.

Next time, please read the forum rules and search the wiki (Or if you already did, state so in the post and explain why doing so didn't answer your question), people here get a little tired of new members just asking before searching.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
watermirror
Member
Member
Posts: 25
Joined: Tue Nov 05, 2013 4:06 am

Re: Availability of SMP Documentation

Post by watermirror »

hi, i am sorry.
but i did have read the wiki.but still do not know how to start.

i am develop a virtualiztion system with intel-vt, now i have to move to multi-core, one VM on one core.but i do not know what should i do.
so i asked here.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Availability of SMP Documentation

Post by Combuster »

Have you actually gotten far enough to do a single processor kernel running virtualisation of your own? Or even your own kernel with userspace?

I have the impression you're not even halfway there, which means you the questions you have make no sense because you lack experience with the basics.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Availability of SMP Documentation

Post by Brendan »

Hi,
Combuster wrote:Have you actually gotten far enough to do a single processor kernel running virtualisation of your own? Or even your own kernel with userspace?
I'd hope not - the idea of retro-fitting SMP to an existing/complex thing is scary (more scary than designing for SMP from the beginning). ;)
watermirror wrote:i am develop a virtualiztion system with intel-vt, now i have to move to multi-core, one VM on one core.
One VM per core sounds bad to me. For example, if the computer has 4 CPUs you should be able to have 3 virtual machines where each virtual machine thinks it has 2 CPUs, or one virtual machine that thinks it has 8 CPUs, or 8 virtual machines that think they have a CPU each, or anything else.

This means having "something" to determine which virtual CPUs are using the real CPU/s when, where virtual CPUs share real CPUs if/when necessary; including (e.g.) the ability to detect when a virtual CPU executes a "HLT" instruction (and stops needing a real CPU) and when a virtual CPU receives an IRQ or something (and starts wanting a real CPU again). Of course that "something" is a scheduler, and isn't very different to a normal OS's scheduler except that it's scheduling virtual CPUs that belong to virtual machines instead of scheduling threads that belong to processes.

With this in mind; I'd want boot code, code to start the other CPUs, some basic memory management, then a scheduler. I wouldn't bother implementing any of the "Intel-VT" code until after all that works. I'd also make it so that the virtualisation code is replaceable/modular - e.g. one module that uses "Intel-VT", one that uses "AMD-SVM", one that uses JIT/interpreting, etc (where all of these modules rely on the same "boot code, memory management and scheduling" framework).


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
songziming
Member
Member
Posts: 71
Joined: Fri Jun 28, 2013 1:48 am
Contact:

Re: Availability of SMP Documentation

Post by songziming »

Reinventing the Wheel, code: https://github.com/songziming/wheel
Post Reply