Discussion:
Enable SMP support
Almudena Garcia
2018-06-07 21:47:55 UTC
Permalink
Hi all:

Reading this post in Hurd FAQ, I read that Mach has SMP support, but It was
disabled because the Linux device drivers glue code isn't thread-safe.

https://www.gnu.org/software/hurd/faq/smp.html

Then, I ask . Are there any form to enable this SMP support in GNU Mach?
(At my own risk).

I would like to test it.

P.D.: It's only a curiosity, not an urgency
Joshua Branson
2018-06-08 17:06:03 UTC
Permalink
Reading this post in Hurd FAQ, I read that Mach has SMP support, but It was disabled because the Linux device drivers glue code isn't thread-safe.
https://www.gnu.org/software/hurd/faq/smp.html
Then, I ask . Are there any form to enable this SMP support in GNU Mach? (At my own risk).
I would like to test it.
P.D.: It's only a curiosity, not an urgency
That actually sounds like really fun! haha. I bet it would involve
diving into the mach code...I believe that the Hurd currently uses
drivers from linux via DDE. A lot of that code was shoved into
GNU/Mach. You'd have to pull it out, or find the commandline option to
not compile it in...but I don't know how to do it.
James Clarke
2018-06-08 19:27:19 UTC
Permalink
Post by Joshua Branson
Reading this post in Hurd FAQ, I read that Mach has SMP support, but It was disabled because the Linux device drivers glue code isn't thread-safe.
https://www.gnu.org/software/hurd/faq/smp.html
Then, I ask . Are there any form to enable this SMP support in GNU Mach? (At my own risk).
I would like to test it.
P.D.: It's only a curiosity, not an urgency
That actually sounds like really fun! haha. I bet it would involve
diving into the mach code...I believe that the Hurd currently uses
drivers from linux via DDE. A lot of that code was shoved into
GNU/Mach. You'd have to pull it out, or find the commandline option to
not compile it in...but I don't know how to do it.
# Multiprocessor support is still broken.
AH_TEMPLATE([MULTIPROCESSOR], [set things up for a uniprocessor])
mach_ncpus=1
AC_DEFINE_UNQUOTED([NCPUS], [$mach_ncpus], [number of CPUs])
[if [ $mach_ncpus -gt 1 ]; then]
AC_DEFINE([MULTIPROCESSOR], [1], [set things up for a multiprocessor])
[fi]
So enabling it is just a case of tweaking that constant or making it a
configurable option.

James
Almudena Garcia
2018-06-08 21:04:46 UTC
Permalink
But... where is this configuration file?

Do I need to recompile mach after enable the SMP option?
Post by Joshua Branson
Post by Almudena Garcia
Reading this post in Hurd FAQ, I read that Mach has SMP support, but It
was disabled because the Linux device drivers glue code isn't thread-safe.
Post by Joshua Branson
Post by Almudena Garcia
https://www.gnu.org/software/hurd/faq/smp.html
Then, I ask . Are there any form to enable this SMP support in GNU
Mach? (At my own risk).
Post by Joshua Branson
Post by Almudena Garcia
I would like to test it.
P.D.: It's only a curiosity, not an urgency
That actually sounds like really fun! haha. I bet it would involve
diving into the mach code...I believe that the Hurd currently uses
drivers from linux via DDE. A lot of that code was shoved into
GNU/Mach. You'd have to pull it out, or find the commandline option to
not compile it in...but I don't know how to do it.
# Multiprocessor support is still broken.
AH_TEMPLATE([MULTIPROCESSOR], [set things up for a uniprocessor])
mach_ncpus=1
AC_DEFINE_UNQUOTED([NCPUS], [$mach_ncpus], [number of CPUs])
[if [ $mach_ncpus -gt 1 ]; then]
AC_DEFINE([MULTIPROCESSOR], [1], [set things up for a multiprocessor])
[fi]
So enabling it is just a case of tweaking that constant or making it a
configurable option.
James
Almudena Garcia
2018-06-14 15:58:42 UTC
Permalink
Ok, I just found the file in the gnumach sources directory. Now I'm trying
to compile mach, using this guide

https://www.gnu.org/software/hurd/microkernel/mach/gnumach/building.html

But, during the compilation process with dpkg-buildpackage, It shows an
error, and stop.

You can see the error in this log

https://pastebin.com/wZnXQ61y

Feels I syntax error, but I don't sure
Post by Almudena Garcia
But... where is this configuration file?
Do I need to recompile mach after enable the SMP option?
Post by Joshua Branson
Post by Almudena Garcia
Reading this post in Hurd FAQ, I read that Mach has SMP support, but
It was disabled because the Linux device drivers glue code isn't
thread-safe.
Post by Joshua Branson
Post by Almudena Garcia
https://www.gnu.org/software/hurd/faq/smp.html
Then, I ask . Are there any form to enable this SMP support in GNU
Mach? (At my own risk).
Post by Joshua Branson
Post by Almudena Garcia
I would like to test it.
P.D.: It's only a curiosity, not an urgency
That actually sounds like really fun! haha. I bet it would involve
diving into the mach code...I believe that the Hurd currently uses
drivers from linux via DDE. A lot of that code was shoved into
GNU/Mach. You'd have to pull it out, or find the commandline option to
not compile it in...but I don't know how to do it.
# Multiprocessor support is still broken.
AH_TEMPLATE([MULTIPROCESSOR], [set things up for a uniprocessor])
mach_ncpus=1
AC_DEFINE_UNQUOTED([NCPUS], [$mach_ncpus], [number of CPUs])
[if [ $mach_ncpus -gt 1 ]; then]
AC_DEFINE([MULTIPROCESSOR], [1], [set things up for a multiprocessor])
[fi]
So enabling it is just a case of tweaking that constant or making it a
configurable option.
James
Samuel Thibault
2018-06-14 16:36:03 UTC
Permalink
Post by Almudena Garcia
You can see the error in this log
[2]https://pastebin.com/wZnXQ61y
Feels I syntax error, but I don't sure
Look at the very first warning, the rest can be just a consequence of
it. It seems to be saying that it's simply missing the cpu_number()
implementation.

Samuel
Almudena Garcia
2018-06-14 18:21:05 UTC
Permalink
Ok, I found the warning what you refers

../kern/thread.h:401:42: warning: implicit declaration of function
‘cpu_number’; did you mean ‘cpu_idle’? [-Wimplicit-function-declaration]

After check the cpu_number.h file, feels that It don't define the
cpu_number function in multi-processor mode

https://pastebin.com/rnpVCtXp

But I don't found the source file to this library, to check the
implementation.
Post by Samuel Thibault
Post by Almudena Garcia
You can see the error in this log
[2]https://pastebin.com/wZnXQ61y
Feels I syntax error, but I don't sure
Look at the very first warning, the rest can be just a consequence of
it. It seems to be saying that it's simply missing the cpu_number()
implementation.
Samuel
Svante Signell
2018-06-14 22:14:47 UTC
Permalink
Post by Almudena Garcia
Ok, I found the warning what you refers
../kern/thread.h:401:42: warning: implicit declaration of function
‘cpu_number’; did you mean ‘cpu_idle’? [-Wimplicit-function-
declaration]
After check the cpu_number.h file, feels that It don't define the
cpu_number function in multi-processor mode
https://pastebin.com/rnpVCtXp
But I don't found the source file to this library, to check the
implementation.
Hi Almudena,

Did you see the kernel headers
i386/i386/cpu_number.h
...
/*
* Machine-dependent definitions for cpu identification.
*
*/
#ifndef _I386_CPU_NUMBER_H_
#define _I386_CPU_NUMBER_H_

#if NCPUS > 1

/* More-specific code must define cpu_number() and CPU_NUMBER. */
#define CX(addr, reg) addr(,reg,4)

#else /* NCPUS == 1 */

#define CPU_NUMBER(reg)
#define CX(addr,reg) addr

#endif /* NCPUS == 1 */

#ifndef __ASSEMBLER__
#include "kern/cpu_number.h"
#endif

#endif /* _I386_CPU_NUMBER_H_ */

and kern/cpu_number.h:

#ifndef _KERN_CPU_NUMBER_H_
#define _KERN_CPU_NUMBER_H_

/*
* Definitions for cpu identification in multi-processors.
*/

int master_cpu; /* 'master' processor - keeps time */

#if (NCPUS == 1)
/* cpu number is always 0 on a single processor system */
#define cpu_number() (0)

#define CPU_L1_SIZE (1 << CPU_L1_SHIFT)

#endif /* NCPUS == 1 */
#endif /* _KERN_CPU_NUMBER_H_ */

There are no definitions of cpu_number() for more processors than one
:(
Almudena Garcia
2018-06-14 22:31:52 UTC
Permalink
Yes, I concluded the same a few hours ago. I tried to edit
kern/cpu_number.h, to add a new definition with many cores, at this form

int master_cpu; /* 'master' processor - keeps time */

#if (NCPUS == 1)
/* cpu number is always 0 on a single processor system */
#define cpu_number() (0)

#define CPU_L1_SIZE (1 << CPU_L1_SHIFT)

#else
#define cpu_number() (NCPUS)

#endif /* NCPUS == 1 */
#endif /* _KERN_CPU_NUMBER_H_ */

But this was unsuccessfull. Now I'm trying to edit i386/i386/cpu_number.h
to hardcode this function

#ifndef _I386_CPU_NUMBER_H_
#define _I386_CPU_NUMBER_H_

#if NCPUS > 1

/* More-specific code must define cpu_number() and CPU_NUMBER. */
#define CX(addr, reg) addr(,reg,4)
#define CPU_NUMBER(NCPUS)

#else /* NCPUS == 1 */

#define CPU_NUMBER(reg)
#define CX(addr,reg) addr

#endif /* NCPUS == 1 */

#ifndef __ASSEMBLER__
#include "kern/cpu_number.h"
#endif


But problem continues, so I think that the original problem is in a lower
level than this, (probably there isn't any implementation to multiprocessor
case internally)
Post by Svante Signell
Post by Almudena Garcia
Ok, I found the warning what you refers
../kern/thread.h:401:42: warning: implicit declaration of function
‘cpu_number’; did you mean ‘cpu_idle’? [-Wimplicit-function-
declaration]
After check the cpu_number.h file, feels that It don't define the
cpu_number function in multi-processor mode
https://pastebin.com/rnpVCtXp
But I don't found the source file to this library, to check the
implementation.
Hi Almudena,
Did you see the kernel headers
i386/i386/cpu_number.h
...
/*
* Machine-dependent definitions for cpu identification.
*
*/
#ifndef _I386_CPU_NUMBER_H_
#define _I386_CPU_NUMBER_H_
#if NCPUS > 1
/* More-specific code must define cpu_number() and CPU_NUMBER. */
#define CX(addr, reg) addr(,reg,4)
#else /* NCPUS == 1 */
#define CPU_NUMBER(reg)
#define CX(addr,reg) addr
#endif /* NCPUS == 1 */
#ifndef __ASSEMBLER__
#include "kern/cpu_number.h"
#endif
#endif /* _I386_CPU_NUMBER_H_ */
#ifndef _KERN_CPU_NUMBER_H_
#define _KERN_CPU_NUMBER_H_
/*
* Definitions for cpu identification in multi-processors.
*/
int master_cpu; /* 'master' processor - keeps time */
#if (NCPUS == 1)
/* cpu number is always 0 on a single processor system */
#define cpu_number() (0)
#define CPU_L1_SIZE (1 << CPU_L1_SHIFT)
#endif /* NCPUS == 1 */
#endif /* _KERN_CPU_NUMBER_H_ */
There are no definitions of cpu_number() for more processors than one
:(
Amos Jeffries
2018-06-14 23:30:54 UTC
Permalink
Post by Almudena Garcia
Yes, I concluded the same a few hours ago. I tried to edit
kern/cpu_number.h, to add a new definition with many cores, at this form
int     master_cpu;     /* 'master' processor - keeps time */
#if     (NCPUS == 1)
        /* cpu number is always 0 on a single processor system */
#define cpu_number()    (0)
#define CPU_L1_SIZE (1 << CPU_L1_SHIFT)
#else
#define cpu_number() (NCPUS)
I may be wrong, but that does not seem correct.

The man page for cpu_number() state it to be "an unique CPU
identification number for the CPU that this thread is running on". So it
clearly can change at runtime if there are 2+ CPUs on the machine.

Whereas NCPUS is being used by the precompiler as an integer with fixed
value that can be known at pre-compile time. Implied by the "#if NCPUS >
1" statement which this version of the code omits.


AYJ
l***@gmail.com
2018-06-14 23:41:27 UTC
Permalink
Ok, I agree. I didn't read this docs. I'll try to change it
Post by Amos Jeffries
Post by Almudena Garcia
Yes, I concluded the same a few hours ago. I tried to edit
kern/cpu_number.h, to add a new definition with many cores, at this form
int master_cpu; /* 'master' processor - keeps time */
#if (NCPUS == 1)
/* cpu number is always 0 on a single processor system */
#define cpu_number() (0)
#define CPU_L1_SIZE (1 << CPU_L1_SHIFT)
#else
#define cpu_number() (NCPUS)
I may be wrong, but that does not seem correct.
The man page for cpu_number() state it to be "an unique CPU
identification number for the CPU that this thread is running on". So it
clearly can change at runtime if there are 2+ CPUs on the machine.
Whereas NCPUS is being used by the precompiler as an integer with fixed
value that can be known at pre-compile time. Implied by the "#if NCPUS >
1" statement which this version of the code omits.
AYJ
--
Enviado d
Almudena Garcia
2018-06-14 23:52:57 UTC
Permalink
Ok. I understand you. But then... how can I to define cpu_number() function
in multiprocessor? It isn't clear
Post by Amos Jeffries
Post by Almudena Garcia
Yes, I concluded the same a few hours ago. I tried to edit
kern/cpu_number.h, to add a new definition with many cores, at this form
int master_cpu; /* 'master' processor - keeps time */
#if (NCPUS == 1)
/* cpu number is always 0 on a single processor system */
#define cpu_number() (0)
#define CPU_L1_SIZE (1 << CPU_L1_SHIFT)
#else
#define cpu_number() (NCPUS)
I may be wrong, but that does not seem correct.
The man page for cpu_number() state it to be "an unique CPU
identification number for the CPU that this thread is running on". So it
clearly can change at runtime if there are 2+ CPUs on the machine.
Whereas NCPUS is being used by the precompiler as an integer with fixed
value that can be known at pre-compile time. Implied by the "#if NCPUS >
1" statement which this version of the code omits.
AYJ
Almudena Garcia
2018-06-15 16:27:21 UTC
Permalink
I'm trying to define the cpu_number() in multiprocessor.

To do this, I tried to use CPUID assembly x86 instruction, to get the CPU
SMP number.
The function, in C, is this:

static inline char smp_processor_id(void) {
char apic_id = 0;
asm("mov $1, %%eax\n\t"
"cpuid\n\t"
"mov %%bh, %0\n\t" : "=g" (apic_id));
return apic_id;
}

In Linux, after executing this in a test source, It returns '8'

But, when I try to execute It in Hurd, It shows a segmentation fault.

I attach the test source file


Can you help me?
Post by Almudena Garcia
Ok. I understand you. But then... how can I to define cpu_number()
function in multiprocessor? It isn't clear
Post by Amos Jeffries
Post by Almudena Garcia
Yes, I concluded the same a few hours ago. I tried to edit
kern/cpu_number.h, to add a new definition with many cores, at this form
int master_cpu; /* 'master' processor - keeps time */
#if (NCPUS == 1)
/* cpu number is always 0 on a single processor system */
#define cpu_number() (0)
#define CPU_L1_SIZE (1 << CPU_L1_SHIFT)
#else
#define cpu_number() (NCPUS)
I may be wrong, but that does not seem correct.
The man page for cpu_number() state it to be "an unique CPU
identification number for the CPU that this thread is running on". So it
clearly can change at runtime if there are 2+ CPUs on the machine.
Whereas NCPUS is being used by the precompiler as an integer with fixed
value that can be known at pre-compile time. Implied by the "#if NCPUS >
1" statement which this version of the code omits.
AYJ
Richard Braun
2018-06-15 17:18:55 UTC
Permalink
Post by Almudena Garcia
I'm trying to define the cpu_number() in multiprocessor.
To do this, I tried to use CPUID assembly x86 instruction, to get the CPU
SMP number.
static inline char smp_processor_id(void) {
char apic_id = 0;
asm("mov $1, %%eax\n\t"
"cpuid\n\t"
"mov %%bh, %0\n\t" : "=g" (apic_id));
return apic_id;
}
In Linux, after executing this in a test source, It returns '8'
But, when I try to execute It in Hurd, It shows a segmentation fault.
I attach the test source file
Can you help me?
You said in your initial message that you were willing to start all this
at your own risk. Well this is it, and it's only the very beginning.

This inline assembly snippet is invalid because it doesn't tell the
compiler that it uses registers, which may conflict with the code
generated by the compiler. Read the GCC extended inline assembly
documentation carefully, and especially the machine constraints [1]
for the x86 family. The idea is to create an eax variable with the
value 1 in C, pass that to the inline assembly expression with the
appropriate constraint, and do something similar for the returned
value in ebx, and then extract bh from it.
--
Richard Braun

[1] https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/Machine-Constraints.html#Machine-Constraints
Richard Braun
2018-06-15 17:25:06 UTC
Permalink
Post by Almudena Garcia
I'm trying to define the cpu_number() in multiprocessor.
To do this, I tried to use CPUID assembly x86 instruction, to get the CPU
SMP number.
static inline char smp_processor_id(void) {
char apic_id = 0;
asm("mov $1, %%eax\n\t"
"cpuid\n\t"
"mov %%bh, %0\n\t" : "=g" (apic_id));
return apic_id;
}
In Linux, after executing this in a test source, It returns '8'
But, when I try to execute It in Hurd, It shows a segmentation fault.
I attach the test source file
Can you help me?
Also note here that you're confusing the APIC ID, a device identifier at
the hardware level, with the CPU ID, a processor identifier at the kernel
level. On some machines, the APIC ID may be higher than or equal to the
maximum number of processor installed.
--
Richard Braun
Almudena Garcia
2018-06-15 17:36:19 UTC
Permalink
Yes, I saw this.

When I test It in Linux, I used a dual core computer. But the snippet
returns "8" number.

Now I know the reason ;)
Post by Richard Braun
Post by Almudena Garcia
I'm trying to define the cpu_number() in multiprocessor.
To do this, I tried to use CPUID assembly x86 instruction, to get the
CPU
Post by Almudena Garcia
SMP number.
static inline char smp_processor_id(void) {
char apic_id = 0;
asm("mov $1, %%eax\n\t"
"cpuid\n\t"
"mov %%bh, %0\n\t" : "=g" (apic_id));
return apic_id;
}
In Linux, after executing this in a test source, It returns '8'
But, when I try to execute It in Hurd, It shows a segmentation fault.
I attach the test source file
Can you help me?
Also note here that you're confusing the APIC ID, a device identifier at
the hardware level, with the CPU ID, a processor identifier at the kernel
level. On some machines, the APIC ID may be higher than or equal to the
maximum number of processor installed.
--
Richard Braun
Almudena Garcia
2018-06-16 11:17:57 UTC
Permalink
Finally, we got to write a test function to get the apic_id, and It feels
to run correctly.
Now, we're trying to implement another function, to transform the apic_id
in the kernel cpuid.

I attach the current test function to get apic_id with its test file
Post by Almudena Garcia
Yes, I saw this.
When I test It in Linux, I used a dual core computer. But the snippet
returns "8" number.
Now I know the reason ;)
Post by Richard Braun
Post by Almudena Garcia
I'm trying to define the cpu_number() in multiprocessor.
To do this, I tried to use CPUID assembly x86 instruction, to get the
CPU
Post by Almudena Garcia
SMP number.
static inline char smp_processor_id(void) {
char apic_id = 0;
asm("mov $1, %%eax\n\t"
"cpuid\n\t"
"mov %%bh, %0\n\t" : "=g" (apic_id));
return apic_id;
}
In Linux, after executing this in a test source, It returns '8'
But, when I try to execute It in Hurd, It shows a segmentation fault.
I attach the test source file
Can you help me?
Also note here that you're confusing the APIC ID, a device identifier at
the hardware level, with the CPU ID, a processor identifier at the kernel
level. On some machines, the APIC ID may be higher than or equal to the
maximum number of processor installed.
--
Richard Braun
Almudena Garcia
2018-06-16 15:34:13 UTC
Permalink
We have finished the first prototype of kern/cpu_number.h

http://dpaste.com/2QJB8VR

We have to improve many details, about initialization of structures and
implementation of the function (may be better creates a cpu_number.c file,
instead implement the function in the header), but now the compilation
don't fails in this step.

The compilation continues failing, anymore

http://dpaste.com/26VWZ6G
Post by Almudena Garcia
Finally, we got to write a test function to get the apic_id, and It feels
to run correctly.
Now, we're trying to implement another function, to transform the apic_id
in the kernel cpuid.
I attach the current test function to get apic_id with its test file
Post by Almudena Garcia
Yes, I saw this.
When I test It in Linux, I used a dual core computer. But the snippet
returns "8" number.
Now I know the reason ;)
Post by Amos Jeffries
Post by Almudena Garcia
I'm trying to define the cpu_number() in multiprocessor.
To do this, I tried to use CPUID assembly x86 instruction, to get
the CPU
Post by Almudena Garcia
SMP number.
static inline char smp_processor_id(void) {
char apic_id = 0;
asm("mov $1, %%eax\n\t"
"cpuid\n\t"
"mov %%bh, %0\n\t" : "=g" (apic_id));
return apic_id;
}
In Linux, after executing this in a test source, It returns '8'
But, when I try to execute It in Hurd, It shows a segmentation fault.
I attach the test source file
Can you help me?
Also note here that you're confusing the APIC ID, a device identifier at
the hardware level, with the CPU ID, a processor identifier at the kernel
level. On some machines, the APIC ID may be higher than or equal to the
maximum number of processor installed.
--
Richard Braun
Samuel Thibault
2018-06-16 23:03:05 UTC
Permalink
Post by Almudena Garcia
The compilation continues failing, anymore
[2]http://dpaste.com/26VWZ6G
I have now fixed the dumb typo there.

Samuel
Almudena Garcia
2018-06-16 23:21:51 UTC
Permalink
ok. I'll try to update my sources.

But now I have another problem:

The "apt-get source gnumach" feels don't update the sources.

How can I download this?

I tried with

git clone http://git.savannah.gnu.org/cgit/hurd/gnumach.git/


But git don't find the repo
Post by Samuel Thibault
Post by Almudena Garcia
The compilation continues failing, anymore
[2]http://dpaste.com/26VWZ6G
I have now fixed the dumb typo there.
Samuel
Almudena Garcia
2018-06-16 23:44:11 UTC
Permalink
Well, I checked your code, and I fixed another typo in the same file and
line.
I removed the latest ) in

: "0" (new_val), "m" (*(lock)) : "memory") \


http://dpaste.com/1QW4EVF

Now this compiles. But It shows a warning (undefined behavior) in my
cpu_number() code, and shows another error in kern/startup.c

http://dpaste.com/1QR0XSK
Post by Almudena Garcia
ok. I'll try to update my sources.
The "apt-get source gnumach" feels don't update the sources.
How can I download this?
I tried with
git clone http://git.savannah.gnu.org/cgit/hurd/gnumach.git/
But git don't find the repo
Post by Samuel Thibault
Post by Almudena Garcia
The compilation continues failing, anymore
[2]http://dpaste.com/26VWZ6G
I have now fixed the dumb typo there.
Samuel
Almudena Garcia
2018-06-16 23:58:09 UTC
Permalink
Ok. I fixed my undefined behavior in cpu_number(). But It show many errors
http://dpaste.com/2ACQ7VZ
Post by Almudena Garcia
Well, I checked your code, and I fixed another typo in the same file and
line.
I removed the latest ) in
: "0" (new_val), "m" (*(lock)) : "memory") \
http://dpaste.com/1QW4EVF
Now this compiles. But It shows a warning (undefined behavior) in my
cpu_number() code, and shows another error in kern/startup.c
http://dpaste.com/1QR0XSK
Post by Almudena Garcia
ok. I'll try to update my sources.
The "apt-get source gnumach" feels don't update the sources.
How can I download this?
I tried with
git clone http://git.savannah.gnu.org/cgit/hurd/gnumach.git/
But git don't find the repo
Post by Samuel Thibault
Post by Almudena Garcia
The compilation continues failing, anymore
[2]http://dpaste.com/26VWZ6G
I have now fixed the dumb typo there.
Samuel
Samuel Thibault
2018-06-17 08:00:32 UTC
Permalink
Post by Almudena Garcia
and shows another error in kern/startup.c
[2]http://dpaste.com/1QR0XSK
It was just a missing declaration, now fixed.

Samuel
Almudena Garcia
2018-06-17 12:01:13 UTC
Permalink
Yes. We fixed this too.

Last night we was following the error chain, solve many errors and typos as
this.
I'll try to generate a patch to send you the fix.
Post by Samuel Thibault
Post by Almudena Garcia
and shows another error in kern/startup.c
[2]http://dpaste.com/1QR0XSK
It was just a missing declaration, now fixed.
Samuel
Almudena Garcia
2018-06-18 19:16:28 UTC
Permalink
The patch is here

http://dpaste.com/32VFE37

http://dpaste.com/1F3YETN

But my sources were downloaded from apt, so these are outdated.

Now, I'll try to download sources from git master
Post by Almudena Garcia
Yes. We fixed this too.
Last night we was following the error chain, solve many errors and typos
as this.
I'll try to generate a patch to send you the fix.
Post by Samuel Thibault
Post by Almudena Garcia
and shows another error in kern/startup.c
[2]http://dpaste.com/1QR0XSK
It was just a missing declaration, now fixed.
Samuel
Samuel Thibault
2018-06-19 00:26:38 UTC
Permalink
Hello,
[1]http://dpaste.com/32VFE37
[2]http://dpaste.com/1F3YETN
Please post them as attached text files to your mail, so review can take
place.
But my sources were downloaded from apt, so these are outdated.
gnumach doesn't change that fast :)

Samuel
Almudena Garcia
2018-06-19 10:18:48 UTC
Permalink
Here attach the patch files.

About the sources, the gnumach apt sources are dated in 2018/02/18, so It
don't includes your latest fixes.

How can I download sources from git repository?
Post by Samuel Thibault
Hello,
[1]http://dpaste.com/32VFE37
[2]http://dpaste.com/1F3YETN
Please post them as attached text files to your mail, so review can take
place.
But my sources were downloaded from apt, so these are outdated.
gnumach doesn't change that fast :)
Samuel
Joshua Branson
2018-06-19 15:22:23 UTC
Permalink
Post by Almudena Garcia
Here attach the patch files.
About the sources, the gnumach apt sources are dated in 2018/02/18, so It don't includes your latest fixes.
How can I download sources from git repository?
I believe the gnumach repo is located here:

git clone git://git.sv.gnu.org/hurd/gnumach.git

You can find more info underneath the heading, "Instant Development Environment".

https://www.gnu.org/software/hurd/contributing.html
Post by Almudena Garcia
Hello,
[1]http://dpaste.com/32VFE37
[2]http://dpaste.com/1F3YETN
Please post them as attached text files to your mail, so review can take
place.
But my sources were downloaded from apt, so these are outdated.
gnumach doesn't change that fast :)
Samuel
Almudena Garcia
2018-06-27 20:37:55 UTC
Permalink
After to solve the compilation problems, We continue with our SMP work.

We have fixed many little errors and now have just found another big
problem, this time with pmap.c

This feels a problem about page tables and MMU, which feels aren't
implemented for many CPUs

I attach a patch will all changes that we have applied, and the log of the
latest compilation.


Can you help me?
Post by Almudena Garcia
Post by Almudena Garcia
Here attach the patch files.
About the sources, the gnumach apt sources are dated in 2018/02/18, so
It don't includes your latest fixes.
Post by Almudena Garcia
How can I download sources from git repository?
git clone git://git.sv.gnu.org/hurd/gnumach.git
You can find more info underneath the heading, "Instant Development Environment".
https://www.gnu.org/software/hurd/contributing.html
Post by Almudena Garcia
Hello,
[1]http://dpaste.com/32VFE37
[2]http://dpaste.com/1F3YETN
Please post them as attached text files to your mail, so review can take
place.
But my sources were downloaded from apt, so these are outdated.
gnumach doesn't change that fast :)
Samuel
Samuel Thibault
2018-06-27 21:42:29 UTC
Permalink
Hello,
../kern/sched_prim.h:188:1: warning: parameter names (without types) in function declaration
extern void cause_ast_check(processor); /*new*/
Yes, the type for processor is needed, see the patch I have now commited.
/* More-specific code must define cpu_number() and CPU_NUMBER. */
#define CX(addr, reg) addr(,reg,4)
+#define CPU_NUMBER(reg) /*XXX: we think this is not right, but we wanted to bypass the compiling error. Please review. */
It will have to contain the assembler code to get the CPU number indeed.
diff -Naur '--exclude=.git' gnumach/kern/sched_prim.h gnumach-dev/kern/sched_prim.h
--- gnumach/kern/sched_prim.h 2018-06-27 16:52:47.000000000 -0400
+++ gnumach-dev/kern/sched_prim.h 2018-06-27 15:36:46.000000000 -0400
+extern void cause_ast_check(processor); /*new*/
diff -Naur '--exclude=.git' gnumach/kern/thread.h gnumach-dev/kern/thread.h
--- gnumach/kern/thread.h 2018-06-27 16:52:47.000000000 -0400
+++ gnumach-dev/kern/thread.h 2018-06-27 15:36:46.000000000 -0400
+extern void cause_ast_check(processor); /*new*/
There is no need to declare it twice. I have just declared it in a
proper place instead.

Samuel
Almudena Garcia
2018-06-27 23:12:07 UTC
Permalink
*Yes, the type for processor is needed, see the patch I have now commited.*
Ok. I've just to apply your patches and copy my cpu_number() function in
kern/cpu_number.h.
The latest compilation problems have disappeared, but there are any errors
yet.
*> /* More-specific code must define cpu_number() and CPU_NUMBER. */>
we think this is not right, but we wanted to bypass the compiling error.
Please review. */*
*It will have to contain the assembler code to get the CPU number indeed.*
Now we have to add the cpu_number() function in this file.
Hello,
../kern/sched_prim.h:188:1: warning: parameter names (without types) in
function declaration
extern void cause_ast_check(processor); /*new*/
Yes, the type for processor is needed, see the patch I have now commited.
/* More-specific code must define cpu_number() and CPU_NUMBER. */
#define CX(addr, reg) addr(,reg,4)
+#define CPU_NUMBER(reg) /*XXX: we think this is not right, but we
wanted to bypass the compiling error. Please review. */
It will have to contain the assembler code to get the CPU number indeed.
diff -Naur '--exclude=.git' gnumach/kern/sched_prim.h
gnumach-dev/kern/sched_prim.h
--- gnumach/kern/sched_prim.h 2018-06-27 16:52:47.000000000 -0400
+++ gnumach-dev/kern/sched_prim.h 2018-06-27 15:36:46.000000000 -0400
+extern void cause_ast_check(processor); /*new*/
diff -Naur '--exclude=.git' gnumach/kern/thread.h
gnumach-dev/kern/thread.h
--- gnumach/kern/thread.h 2018-06-27 16:52:47.000000000 -0400
+++ gnumach-dev/kern/thread.h 2018-06-27 15:36:46.000000000 -0400
+extern void cause_ast_check(processor); /*new*/
There is no need to declare it twice. I have just declared it in a
proper place instead.
Samuel
Almudena Garcia
2018-06-28 18:31:18 UTC
Permalink
*> /* More-specific code must define cpu_number() and CPU_NUMBER. */>
we think this is not right, but we wanted to bypass the compiling error.
Please review. */*
*It will have to contain the assembler code to get the CPU number indeed.*
We have just added cpu_number() function in this file, fixing a few .S
files.
I attach the patch.

Now the compiler gets the gnumach.o, but It returns another linker error.
I attach logs also.


How can I solve this?
*Yes, the type for processor is needed, see the patch I have now commited.*
Ok. I've just to apply your patches and copy my cpu_number() function in
kern/cpu_number.h.
The latest compilation problems have disappeared, but there are any errors
yet.
*> /* More-specific code must define cpu_number() and CPU_NUMBER. */>
we think this is not right, but we wanted to bypass the compiling error.
Please review. */*
*It will have to contain the assembler code to get the CPU number indeed.*
Now we have to add the cpu_number() function in this file.
Hello,
../kern/sched_prim.h:188:1: warning: parameter names (without types) in
function declaration
extern void cause_ast_check(processor); /*new*/
Yes, the type for processor is needed, see the patch I have now commited.
/* More-specific code must define cpu_number() and CPU_NUMBER. */
#define CX(addr, reg) addr(,reg,4)
+#define CPU_NUMBER(reg) /*XXX: we think this is not right, but we
wanted to bypass the compiling error. Please review. */
It will have to contain the assembler code to get the CPU number indeed.
diff -Naur '--exclude=.git' gnumach/kern/sched_prim.h
gnumach-dev/kern/sched_prim.h
--- gnumach/kern/sched_prim.h 2018-06-27 16:52:47.000000000 -0400
+++ gnumach-dev/kern/sched_prim.h 2018-06-27 15:36:46.000000000
-0400
+extern void cause_ast_check(processor); /*new*/
diff -Naur '--exclude=.git' gnumach/kern/thread.h
gnumach-dev/kern/thread.h
--- gnumach/kern/thread.h 2018-06-27 16:52:47.000000000 -0400
+++ gnumach-dev/kern/thread.h 2018-06-27 15:36:46.000000000 -0400
+extern void cause_ast_check(processor); /*new*/
There is no need to declare it twice. I have just declared it in a
proper place instead.
Samuel
Luca Dariz
2018-07-03 10:22:02 UTC
Permalink
Hello!
Post by Almudena Garcia
Now the compiler gets the gnumach.o, but It returns another linker error.
I attach logs also.
How can I solve this?
From the last lines of the log

...
ffs
intel_startCPU
local_bh_count
local_irq_count
...

these four functions are missing, see the code at lines 167-187 of
Makefile.am, probably they require a SMP-aware version.

Cheers
Luca
l***@gmail.com
2018-07-03 11:00:30 UTC
Permalink
Thanks, I'll try it
Post by Luca Dariz
Hello!
Post by Almudena Garcia
Now the compiler gets the gnumach.o, but It returns another linker error.
I attach logs also.
How can I solve this?
From the last lines of the log
...
ffs
intel_startCPU
local_bh_count
local_irq_count
...
these four functions are missing, see the code at lines 167-187 of
Makefile.am, probably they require a SMP-aware version.
Cheers
Luca
--
En
Almudena Garcia
2018-07-03 15:49:25 UTC
Permalink
I've just tried to add this functions in Makefile.am, in clib_routines, as
this form

clib_routines := htonl htons ntohl ntohs \
udivdi3 __udivdi3 __udivmoddi4 __umoddi3 \
__divdi3 \
__rel_iplt_start __rel_iplt_end \
__ffsdi2 \
ffs intel_startCPU local_bh_count local_irq_count \
_START _start etext _edata end _end # actually ld magic,
not li$


But now It shows this error (attached file)

Feels that It's necessary to define this functions but I don't know where
these functions are located.

How can I define this?
Post by l***@gmail.com
Thanks, I'll try it
Post by Luca Dariz
Hello!
Post by Almudena Garcia
Now the compiler gets the gnumach.o, but It returns another linker
error.
Post by Luca Dariz
Post by Almudena Garcia
I attach logs also.
How can I solve this?
From the last lines of the log
...
ffs
intel_startCPU
local_bh_count
local_irq_count
...
these four functions are missing, see the code at lines 167-187 of
Makefile.am, probably they require a SMP-aware version.
Cheers
Luca
--
Enviado desde mi Jolla
Luca Dariz
2018-07-03 16:24:20 UTC
Permalink
Post by Almudena Garcia
I've just tried to add this functions in Makefile.am, in clib_routines,
as this form
clib_routines := htonl htons ntohl ntohs                        \
                 udivdi3 __udivdi3 __udivmoddi4 __umoddi3       \
                 __divdi3                                       \
                 __rel_iplt_start __rel_iplt_end                \
                 __ffsdi2                                    \ 
                ffs intel_startCPU local_bh_count local_irq_count \
                _START _start etext _edata end _end # actually ld magic,
not li$     
This seems to be ok for the ffs function, the others are not part of the
standard C library.
Post by Almudena Garcia
But now It shows this error (attached file)
Feels that It's necessary to define this functions but I don't know
where these functions are located.
How can I define this?     
I'd look for for the non-SMP implementation and start from there, they
should be somewhere in gnumach sources.

Also it seems that local_bh_count and local_irq_count are used only in
the Linux-based drivers, so maybe you can look to the SMP-aware
implementation in Linux (or #define the functions as empty macros if
they are not strictly needed..)

Luca
Almudena Garcia
2018-07-03 16:33:18 UTC
Permalink
Post by Luca Dariz
Also it seems that local_bh_count and local_irq_count are used only in
the Linux-based drivers, so maybe you can look to the SMP-aware
implementation in Linux (or #define the functions as empty macros if
they are not strictly needed..)
Yes, I found their definitions in *linux/dev/arch/i386/kernel/irq.c , *hide
under a *#ifdef 0. *I commented on this macro, and now the linker founds
these.

But I don't find any definition of * intel_startCPU *function. I see many
calls to this function, but don't find Its declaration and definition.
Post by Luca Dariz
Post by Almudena Garcia
I've just tried to add this functions in Makefile.am, in clib_routines,
as this form
clib_routines := htonl htons ntohl ntohs \
udivdi3 __udivdi3 __udivmoddi4 __umoddi3 \
__divdi3 \
__rel_iplt_start __rel_iplt_end \
__ffsdi2 \
ffs intel_startCPU local_bh_count local_irq_count \
_START _start etext _edata end _end # actually ld magic,
not li$
This seems to be ok for the ffs function, the others are not part of the
standard C library.
Post by Almudena Garcia
But now It shows this error (attached file)
Feels that It's necessary to define this functions but I don't know
where these functions are located.
How can I define this?
I'd look for for the non-SMP implementation and start from there, they
should be somewhere in gnumach sources.
Also it seems that local_bh_count and local_irq_count are used only in
the Linux-based drivers, so maybe you can look to the SMP-aware
implementation in Linux (or #define the functions as empty macros if
they are not strictly needed..)
Luca
Almudena Garcia
2018-07-03 16:15:40 UTC
Permalink
Using grep, I've found *local_bh_count* and *local_irq_count. ffs *is
defined correctly.

But I don't find the *intel_startCPU* definition. In
*i386/i386/mp_desc.c *there
are many calls to this, but It doesn't appear to be in any file.

Do you know about this?
Post by Almudena Garcia
I've just tried to add this functions in Makefile.am, in clib_routines, as
this form
clib_routines := htonl htons ntohl ntohs \
udivdi3 __udivdi3 __udivmoddi4 __umoddi3 \
__divdi3 \
__rel_iplt_start __rel_iplt_end \
__ffsdi2 \
ffs intel_startCPU local_bh_count local_irq_count \
_START _start etext _edata end _end # actually ld magic,
not li$
But now It shows this error (attached file)
Feels that It's necessary to define this functions but I don't know where
these functions are located.
How can I define this?
Post by l***@gmail.com
Thanks, I'll try it
Post by Luca Dariz
Hello!
Post by Almudena Garcia
Now the compiler gets the gnumach.o, but It returns another linker
error.
Post by Luca Dariz
Post by Almudena Garcia
I attach logs also.
How can I solve this?
From the last lines of the log
...
ffs
intel_startCPU
local_bh_count
local_irq_count
...
these four functions are missing, see the code at lines 167-187 of
Makefile.am, probably they require a SMP-aware version.
Cheers
Luca
--
Enviado desde mi Jolla
Almudena Garcia
2018-07-04 19:14:59 UTC
Permalink
Hi, other time:

I'm trying to develop intel_startCPU function, using the function of this
file as base code
https://github.com/nneonneo/osx-10.9-opensource/blob/master/xnu-2422.1.72/osfmk/i386/mp.c

I've got to replace the *ml_set_interrupts_enabled() *calls, and now I need
to replace this call:* cpu_desc_init64(cpu_datap(slot_num));*

Reading the comments, this function do this:


*Initialize (or re-initialize) the descriptor tables for this cpu. *
Propagate processor mode to slave.*


But I won't be clear what is the Mach equivalent to this function.

I attach the current code

Can you help me?
Using grep, I've found /local_bh_count/ and /local_irq_count. ffs /is
defined correctly.
But I don't find the /intel_startCPU/ definition. In
/i386/i386/mp_desc.c /there are many calls to this, but It doesn't
appear to be in any file.
Do you know about this?
No. Note that the whole file results empty if NCPU == 1.. maybe it got
lost when SMP was disabled, you could try to look for some old Mach
version which supported SMP, or implement your own.
For example you can look at the XNU kernel and see how it is implemented
there.
Luca
Almudena Garcia
2018-07-04 19:36:11 UTC
Permalink
I've just fixed a little error in my code.

I attach the fixed file
Post by Almudena Garcia
I'm trying to develop intel_startCPU function, using the function of this
file as base code
https://github.com/nneonneo/osx-10.9-opensource/blob/
master/xnu-2422.1.72/osfmk/i386/mp.c
I've got to replace the *ml_set_interrupts_enabled() *calls, and now I
need to replace this call:* cpu_desc_init64(cpu_datap(slot_num));*
*Initialize (or re-initialize) the descriptor tables for this cpu. *
Propagate processor mode to slave.*
But I won't be clear what is the Mach equivalent to this function.
I attach the current code
Can you help me?
Using grep, I've found /local_bh_count/ and /local_irq_count. ffs /is
defined correctly.
But I don't find the /intel_startCPU/ definition. In
/i386/i386/mp_desc.c /there are many calls to this, but It doesn't
appear to be in any file.
Do you know about this?
No. Note that the whole file results empty if NCPU == 1.. maybe it got
lost when SMP was disabled, you could try to look for some old Mach
version which supported SMP, or implement your own.
For example you can look at the XNU kernel and see how it is implemented
there.
Luca
Joshua Branson
2018-07-05 15:29:00 UTC
Permalink
Post by Almudena Garcia
I've just fixed a little error in my code.
I attach the fixed file
hmmm. This is a little out of my league, but I appreciate you for trying!
Almudena Garcia
2018-07-09 15:32:26 UTC
Permalink
Finally, I got the equivalent call to
*cpu_desc_init64(cpu_datap(slot_num));*

Also, I've replaced many others variables in the code.
The current code is here:
https://github.com/AlmuHS/GNUMach_SMP/blob/smp/i386/i386/intel_startCPU.c

Now I'm searching the equivalency to this:

- IdlePTD in this line:


* DBG("IdlePTD(%p): 0x%x\n", &IdlePTD, (int) (uintptr_t)IdlePTD); *

- the next variables and struct





* start_info.starter_cpu = cpu_number(); start_info.target_cpu =
slot_num; start_info.target_lapic = lapic; tsc_entry_barrier = 2;
tsc_exit_barrier = 2;*
Post by Joshua Branson
Post by Almudena Garcia
I've just fixed a little error in my code.
I attach the fixed file
hmmm. This is a little out of my league, but I appreciate you for trying!
Almudena Garcia
2018-07-09 17:20:46 UTC
Permalink
I have commented this lines at moment.
Post by Almudena Garcia
Finally, I got the equivalent call to
*cpu_desc_init64(cpu_datap(slot_num));*
Also, I've replaced many others variables in the code.
The current code is here: https://github.com/AlmuHS/
GNUMach_SMP/blob/smp/i386/i386/intel_startCPU.c
* DBG("IdlePTD(%p): 0x%x\n", &IdlePTD, (int) (uintptr_t)IdlePTD); *
- the next variables and struct
* start_info.starter_cpu = cpu_number(); start_info.target_cpu =
slot_num; start_info.target_lapic = lapic; tsc_entry_barrier = 2;
tsc_exit_barrier = 2;*
Post by Joshua Branson
Post by Almudena Garcia
I've just fixed a little error in my code.
I attach the fixed file
hmmm. This is a little out of my league, but I appreciate you for trying!
Almudena Garcia
2018-07-09 23:34:17 UTC
Permalink
It compiles!! :-)

I've just got to finish the GNU Mach compilation, patched to add SMP
support.
You can see the code here: https://github.com/AlmuHS/GNUMach_SMP/tree/smp

I tried to boot Hurd using the new Mach image, but It crash.

Now I will need to debug my code.
In the compile log appears many interesting warning.

https://github.com/AlmuHS/GNUMach_SMP/blob/smp/build/build_log
Post by Almudena Garcia
I have commented this lines at moment.
Post by Almudena Garcia
Finally, I got the equivalent call to
*cpu_desc_init64(cpu_datap(slot_num));*
Also, I've replaced many others variables in the code.
The current code is here: https://github.com/AlmuHS/GNUM
ach_SMP/blob/smp/i386/i386/intel_startCPU.c
* DBG("IdlePTD(%p): 0x%x\n", &IdlePTD, (int) (uintptr_t)IdlePTD); *
- the next variables and struct
* start_info.starter_cpu = cpu_number(); start_info.target_cpu =
slot_num; start_info.target_lapic = lapic; tsc_entry_barrier = 2;
tsc_exit_barrier = 2;*
Post by Joshua Branson
Post by Almudena Garcia
I've just fixed a little error in my code.
I attach the fixed file
hmmm. This is a little out of my league, but I appreciate you for trying!
Almudena Garcia
2018-07-10 13:31:56 UTC
Permalink
This is the record of GNU/Hurd boot crash (with my SMP GNU Mach core)
https://drive.google.com/file/d/1imOWYUI6PQ5J7R8ScvnV-fIRs81sV769/view?usp=sharing

Feels an MMU problem in the Hurd servers start.
This is the record of GNU/Hurd boot crash with SMP
Feels that It crash when Hurd starts
Post by Almudena Garcia
It compiles!! :-)
I've just got to finish the GNU Mach compilation, patched to add SMP
support.
You can see the code here: https://github.com/AlmuHS/GNUMach_SMP/tree/smp
I tried to boot Hurd using the new Mach image, but It crash.
Now I will need to debug my code.
In the compile log appears many interesting warning.
https://github.com/AlmuHS/GNUMach_SMP/blob/smp/build/build_log
Post by Almudena Garcia
I have commented this lines at moment.
Post by Almudena Garcia
Finally, I got the equivalent call to
*cpu_desc_init64(cpu_datap(slot_num));*
Also, I've replaced many others variables in the code.
The current code is here: https://github.com/AlmuHS/GNUM
ach_SMP/blob/smp/i386/i386/intel_startCPU.c
* DBG("IdlePTD(%p): 0x%x\n", &IdlePTD, (int) (uintptr_t)IdlePTD); *
- the next variables and struct
* start_info.starter_cpu = cpu_number(); start_info.target_cpu =
slot_num; start_info.target_lapic = lapic; tsc_entry_barrier = 2;
tsc_exit_barrier = 2;*
Post by Joshua Branson
Post by Almudena Garcia
I've just fixed a little error in my code.
I attach the fixed file
2018-07-04 21:14 GMT+02:00 Almudena Garcia <
hmmm. This is a little out of my league, but I appreciate you for trying!
Almudena Garcia
2018-07-10 13:34:27 UTC
Permalink
A better link


Post by Almudena Garcia
This is the record of GNU/Hurd boot crash (with my SMP GNU Mach core)
https://drive.google.com/file/d/1imOWYUI6PQ5J7R8ScvnV-
fIRs81sV769/view?usp=sharing
Feels an MMU problem in the Hurd servers start.
This is the record of GNU/Hurd boot crash with SMP
Feels that It crash when Hurd starts
Post by Almudena Garcia
It compiles!! :-)
I've just got to finish the GNU Mach compilation, patched to add SMP
support.
You can see the code here: https://github.com/AlmuHS/GNUM
ach_SMP/tree/smp
I tried to boot Hurd using the new Mach image, but It crash.
Now I will need to debug my code.
In the compile log appears many interesting warning.
https://github.com/AlmuHS/GNUMach_SMP/blob/smp/build/build_log
Post by Almudena Garcia
I have commented this lines at moment.
Post by Almudena Garcia
Finally, I got the equivalent call to
*cpu_desc_init64(cpu_datap(slot_num));*
Also, I've replaced many others variables in the code.
The current code is here: https://github.com/AlmuHS/GNUM
ach_SMP/blob/smp/i386/i386/intel_startCPU.c
* DBG("IdlePTD(%p): 0x%x\n", &IdlePTD, (int) (uintptr_t)IdlePTD); *
- the next variables and struct
* start_info.starter_cpu = cpu_number(); start_info.target_cpu
= slot_num; start_info.target_lapic = lapic; tsc_entry_barrier = 2;
tsc_exit_barrier = 2;*
Post by Joshua Branson
Post by Almudena Garcia
I've just fixed a little error in my code.
I attach the fixed file
2018-07-04 21:14 GMT+02:00 Almudena Garcia <
hmmm. This is a little out of my league, but I appreciate you for trying!
Joshua Branson
2018-07-10 15:15:37 UTC
Permalink
Almudena Garcia <***@gmail.com> writes:

Nice work dude!
Post by Almudena Garcia
A better link
http://youtu.be/78JYeXMNeVM
This is the record of GNU/Hurd boot crash (with my SMP GNU Mach core)
https://drive.google.com/file/d/1imOWYUI6PQ5J7R8ScvnV-fIRs81sV769/view?usp=sharing
Feels an MMU problem in the Hurd servers start.
This is the record of GNU/Hurd boot crash with SMP
Feels that It crash when Hurd starts
It compiles!! :-)
I've just got to finish the GNU Mach compilation, patched to add SMP support.
You can see the code here: https://github.com/AlmuHS/GNUMach_SMP/tree/smp
I tried to boot Hurd using the new Mach image, but It crash.
Now I will need to debug my code.
In the compile log appears many interesting warning.
https://github.com/AlmuHS/GNUMach_SMP/blob/smp/build/build_log
I have commented this lines at moment.
Finally, I got the equivalent call to cpu_desc_init64(cpu_datap(slot_num));
Also, I've replaced many others variables in the code.
The current code is here: https://github.com/AlmuHS/GNUMach_SMP/blob/smp/i386/i386/intel_startCPU.c
DBG("IdlePTD(%p): 0x%x\n", &IdlePTD, (int) (uintptr_t)IdlePTD);
- the next variables and struct
start_info.starter_cpu = cpu_number();
start_info.target_cpu = slot_num;
start_info.target_lapic = lapic;
tsc_entry_barrier = 2;
tsc_exit_barrier = 2;
Post by Almudena Garcia
I've just fixed a little error in my code.
I attach the fixed file
hmmm. This is a little out of my league, but I appreciate you for trying!
l***@gmail.com
2018-11-17 17:30:55 UTC
Permalink
Ok. In any case, I've restarted the project two months ago.

You can read the docs from here:
https://gitlab.com/snippets/1756024
Hi!
Post by Almudena Garcia
I'm trying to develop intel_startCPU function, using the function of this
file as base code
https://github.com/nneonneo/osx-10.9-opensource/blob/master/xnu-2422.1.72/osfmk/i386/mp.c
Please check the license terms of XNU, because AFAIR they might be
problematic for merging code based on it into GNU Mach.
Thanks,
Guill
Joshua Branson
2018-11-23 15:12:53 UTC
Permalink
Post by l***@gmail.com
Ok. In any case, I've restarted the project two months ago.
https://gitlab.com/snippets/1756024
There's a lot of great detail there! Do you mind if I copy a lot of
your information from that page and add it to the Hurd wiki?
Post by l***@gmail.com
Hi!
Post by Almudena Garcia
I'm trying to develop intel_startCPU function, using the function of this
file as base code
https://github.com/nneonneo/osx-10.9-opensource/blob/master/xnu-2422.1.72/osfmk/i386/mp.c
Please check the license terms of XNU, because AFAIR they might be
problematic for merging code based on it into GNU Mach.
Thanks,
Guillem
Damien Zammit
2018-11-25 00:39:44 UTC
Permalink
Post by l***@gmail.com
Ok. In any case, I've restarted the project two months ago.
https://gitlab.com/snippets/1756024
Hi, don't forget you can read the coreboot source code which is a free
software bios that, among other things, sets up the cpus and exports the
ACPI tables. I believe it is GPLv2 only, but some files are licensed
under GPLv2 or later.

Just download the coreboot source and git grep cpus or IPI, theres
plenty of good info in there to study.

Cheers,
Damien

Richard Braun
2018-06-16 16:08:41 UTC
Permalink
Post by Almudena Garcia
Finally, we got to write a test function to get the apic_id, and It feels
to run correctly.
Now, we're trying to implement another function, to transform the apic_id
in the kernel cpuid.
I attach the current test function to get apic_id with its test file
One other thing.

No sane operating system uses the cpuid instruction each time they need
to identify the current processor, because of its cost (it's a fully
serializing instruction). Instead, they make the fs or gs segment
register refer to a per-processor area in memory, where the ID of the
current processor can be found, among other things. See the cpu_id()
function at [1] for a reasonably simple (but not naive) implementation.
--
Richard Braun

[1] https://git.sceen.net/rbraun/x15.git/tree/arch/x86/machine/cpu.h?id=7615ab33c6d9e0b858aa3f183095a83f7a1d0620#n471
Loading...