flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > SMP tutorial or help |
Author |
|
FlashBurn 28 Apr 2006, 11:10
If you have some time and a cdrw, you could burn the attached iso image and boot it. If there stands something like "2 CPUs and 1 IO-APICs found" then I can help you. Otherwise I have to look how to init and find multi core cpus! I think there was something with cpuid. There you have to look for the number of cores and logical cpus.
|
|||||||||||
28 Apr 2006, 11:10 |
|
fonolite 01 May 2006, 01:23
Thanks!
I'll try it and report soon. |
|||
01 May 2006, 01:23 |
|
Madis731 01 May 2006, 14:53
Should it work under emulator too? I've made some _MP_ detection myself and it works under QEMU. Too bad I don't have any experience with interrupts to send an IPI to another CPU. Only one of them is working and the other remains halted - according to Intel it is waiting initiative from the bootstrap, but :S how!?
Ok, here's what I've got: Code: OS-Loader... drive: 0xE0 ,fs: ISO9660 kernel: SYSTEM/KERNEL, size: 00005558, loaded at 00100000 sometimes it even halts at the 3rd line on "ke" (the first two letters) |
|||
01 May 2006, 14:53 |
|
FlashBurn 01 May 2006, 15:45
Yes it should work under an emulator, too. I have tested it under Qemu and Bochs and it does work. I think you tested it with >14 CPUs. I don´t know why but it wont work with >14 CPUs (the detection) and the os doesn´t work with >10 CPUs. So please test it with max 8 CPUs I know that it works there, because I can test it in Bochs with that and until there is >8 CPU support in Bochs I have to wait to find the problem.
You said that it sometimes even doesn´t get till after the kernel is loaded?! This is strange. I haven´t seen this in any emu and on any pc. Have you only tested it in qemu or also on a real pc? Also which version of qemu does you use? Edit:: It is also possible that you´ve tested it under the x86-64 qemu, because I also tested it there now and it seems that qemu crashed. But this has to be a failure of qemu, because under bochs it does work also under a 64bit cpu. |
|||
01 May 2006, 15:45 |
|
fonolite 02 May 2006, 00:41
Hi, this is only what I've got
Code: OS-Loader... drive: 0xEF ,fs: ISO9660 kernel: SYSTEM/KERNEL, size: 00005558, loaded at 00100000 What does "drive" mean? ps) Anyway, CPUID with eax=1, the number of logical core is 2. |
|||
02 May 2006, 00:41 |
|
FlashBurn 02 May 2006, 04:50
Drive is the bios number for your cd-drive. When you also doesn´t get to the cpu detection routine then I think I have to do some more work on it. The only think that is missing are some delays, but on the pcs I have tested the code it worked.
Anyway, I´ve read the documentation and it says that also on a dual core pc you have to have 2 cpu entries in the mp configuration table! So you have to go trough it. I will post some more details on how to start the aps when I´m back home! |
|||
02 May 2006, 04:50 |
|
FlashBurn 25 Jul 2006, 16:00
It has been a while till I looked at my smp init code and I modified it to also use same delay for the other cpus to get up!
This is a debug build and it would be nice if some could run it on a real pc. It is equal if it is an uni cpu system or a smp system, but a smp system would be better! When you´ve tested it, you should say what it printed on your screen!
|
|||||||||||
25 Jul 2006, 16:00 |
|
FlashBurn 29 Jul 2006, 16:32
Is there no one who tested?
Now I have a new version. This one uses ACPI (if it is available) for detecting cpus and io-apics. It would be nice if you could test it!
|
|||||||||||
29 Jul 2006, 16:32 |
|
Madis731 31 Jul 2006, 10:07
In QEMU upto 13 CPUs can be started (wierd number) and until then it works okay, but when there are 255 CPUs, it just starts 13 of them and gives an error...
Haven't tried on a real PC yet. It prints almost the same stuff as before: Code: OS-Loader... drive E0, ISO9660 kernel size 5899 @ 100000 ;These next lines are interesting: ABFound 13 CPUs and 1 IO-APICs _ The line before the last printed line has A, B and F and the A is printed before the BFound.... text appears P.S. I'm very interested in the SMP topic, but I was on a vacation and touring Europe for the past 10 days Now I'm getting back on track... |
|||
31 Jul 2006, 10:07 |
|
FlashBurn 31 Jul 2006, 10:20
On my qemu (newest version) it can start up to 14 cpus. But I will try to check out what the problem is. The problem is that it is not that easy with qemu and bochs doesn´t support >8 cpus at the moment
Edit:: I found the function which makes the problems, my slab allocator. But I haven´t found the reason or the right code which fails |
|||
31 Jul 2006, 10:20 |
|
Madis731 01 Aug 2006, 10:29
Maybe its me but my tries on QEMU have always failed. I could start at most 2 CPUs (1 BSP+1 AP) :S and they keep halting. Maybe its that I don't give them any pause (delay).
I think I'm still too n00b in interrupts and mapped memory - is your code in C? I made it in ASM and because everything else is C, I can't be sure of my translation and understanding of it (the code). |
|||
01 Aug 2006, 10:29 |
|
FlashBurn 01 Aug 2006, 20:25
My whole OS is in asm, because I don´t realy like C for that. I´m using cpu opcodes for which you need to write a loop in C and this is not so effective!
Tomorrow I needn´t to work, so maybe I could write a simple algorithm to start up other cpus! For debugging bochs is better than qemu! So give it a try. |
|||
01 Aug 2006, 20:25 |
|
Madis731 02 Aug 2006, 08:04
Sorry, I can't remember all the OSs out there :S give me a hint on what you are doing - is there a link or something? There is no WWW in your profile
I'm glad to hear its in asm - I don't know why I suggested C I will try Bochs someday, but I've already accustomed to QEMUs keyboard shortcuts and its console commands |
|||
02 Aug 2006, 08:04 |
|
FlashBurn 02 Aug 2006, 08:50
Yeah, I have no page for my os I wanted to make one, but I haven´t found the time for that and os programming is much more interesting!
You may have a look over here: http://www.osdever.net/tutorials/pdf/mp.pdf There you can get how to detect the number of cpus in a system. If you want I can give you my smp init function. |
|||
02 Aug 2006, 08:50 |
|
FlashBurn 02 Aug 2006, 15:23
I finally found the failures (yes, I found more than I needed ) in my slab allocator and then I also found a failure in my gdt code and now I can run on PCs with 255 cpus (only tested with qemu)
@Madis731 Maybe you could show me your code and I can help you with the start-up code for the cpus!? Edit:: I just read a old post of you and how do you know the number of the cpus which have been started up in qemu? Edit:: Even newer code, now it should also run on pcs where the apic is deactivated, but I can´t test it, because I have no such pc available. So please test it and say if it works for you.
|
|||||||||||
02 Aug 2006, 15:23 |
|
Madis731 03 Aug 2006, 08:08
@Flashburn: In QEMU you can press Ctrl+Alt+2 and type 'info cpus'. I'm still waiting because it takes a lot of time to start up all those 255 CPUs
Half of them already in ~30 seconds... But it seems to be working You gave me that link and I saw some new info that I didn't know before. I think I'm going to start over and search for something I missed before. Maybe I have just been too lazy and I didn't care to look carefully in the _MP_s, but I'll post if anything comes up (success & failures...). EDIT: I guess it would be much faster with REAL 255 CPUs because they all start at once, but there should be a progressbar in QEMU - 220 CPUs (AP) and counting. Already over 5 minutes. I think that every started AP will increase load on emulation :S EDIT2: and finally after 6 or 7 minutes (didn't know that I have to time it ) it finished with a message that "Found 255 CPUs and 0 IO-APICs" |
|||
03 Aug 2006, 08:08 |
|
FlashBurn 03 Aug 2006, 08:21
On my pc it takes not so long (amd xp 1900+) and it has to find a io-apic, because there is no smp system without io-apic. Which qemu version do you use?
|
|||
03 Aug 2006, 08:21 |
|
Madis731 03 Aug 2006, 09:04
Still 8, I'm planning on using 8.2 and I wonder why it tells my 1 CPU (in the init), I have Dual-core I know: T2500@2GHz
and with many CPUs it screams out "Could not open '\\.\kqemu' - QEMU acceleration layer not activated" about number of CPU times With 25CPU I tested - it found one APIC and that is fine - it also took only 6 seconds. Maybe I need to download the accelerator I read somewhere... EDIT: And when I thought that I should use the 64-bit variant, now it doesn't work at all - just hangs. I wonder why it does that because it should be backward compatible and well...I don't know. |
|||
03 Aug 2006, 09:04 |
|
FlashBurn 03 Aug 2006, 09:19
I have the same problem with the 64bit version of qemu, but with the 64bit version of bochs it does work I´m using qemu 0.8.2 w/o kqemu and it takes only 3-4 seconds for me.
I will test if I can find teh reason why it doesn´t work with the 64bit qemu! |
|||
03 Aug 2006, 09:19 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.