Re: Enable SMP support

2018-11-24 Thread Damien Zammit
On 18/11/18 04:30, liberamenso10...@gmail.com wrote:
> 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, 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



Re: Enable SMP support

2018-11-23 Thread Joshua Branson
liberamenso10...@gmail.com writes:

> Ok. In any case, I've restarted the project two months ago. 
>
> You can read the docs from here: 
> 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?

>
> El Sábado 17 de noviembre de 2018, Guillem Jover escribió:
>> Hi!
>> 
>> On Wed, 2018-07-04 at 21:14:59 +0200, Almudena Garcia wrote:
>> > 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
>>



Re: Enable SMP support

2018-11-17 Thread Guillem Jover
Hi!

On Wed, 2018-07-04 at 21:14:59 +0200, Almudena Garcia wrote:
> 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



Re: Enable SMP support

2018-11-17 Thread liberamenso10000
Ok. In any case, I've restarted the project two months ago. 

You can read the docs from here: 
https://gitlab.com/snippets/1756024

El Sábado 17 de noviembre de 2018, Guillem Jover escribió:
> Hi!
> 
> On Wed, 2018-07-04 at 21:14:59 +0200, Almudena Garcia wrote:
> > 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
>

-- 
Enviado desde mi Sailfish OS

Re: Enable SMP support

2018-07-10 Thread Joshua Branson
Almudena Garcia  writes:

Nice work dude!

> A better link
>
> https://www.youtube.com/watch?v=78JYeXMNeVM=youtu.be
>
> 2018-07-10 15:31 GMT+02:00 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.
>
>  2018-07-10 14:45 GMT+02:00 Almudena Garcia :
>
>  This is the record of GNU/Hurd boot crash with SMP
>
>  Feels that It crash when Hurd starts  
>
>  2018-07-10 1:34 GMT+02:00 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
>
>  2018-07-09 19:20 GMT+02:00 Almudena Garcia :
>
>  I have commented this lines at moment.
>
>  2018-07-09 17:32 GMT+02:00 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
>
>  Now I'm searching the equivalency to this:
>
>  - IdlePTD in this line:
>
>  DBG("IdlePTD(%p): 0x%x\n", , (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;
>
>  2018-07-05 17:29 GMT+02:00 Joshua Branson :
>
>  Almudena Garcia  writes:
>
>  > 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!



Re: Enable SMP support

2018-07-10 Thread Almudena Garcia
A better link

https://www.youtube.com/watch?v=78JYeXMNeVM=youtu.be

2018-07-10 15:31 GMT+02:00 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.
>
> 2018-07-10 14:45 GMT+02:00 Almudena Garcia :
>
>> This is the record of GNU/Hurd boot crash with SMP
>>
>> Feels that It crash when Hurd starts
>>
>> 2018-07-10 1:34 GMT+02:00 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
>>>
>>>
>>>
>>> 2018-07-09 19:20 GMT+02:00 Almudena Garcia :
>>>
 I have commented this lines at moment.



 2018-07-09 17:32 GMT+02:00 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
>
> Now I'm searching the equivalency to this:
>
> - IdlePTD in this line:
>
>
> *DBG("IdlePTD(%p): 0x%x\n", , (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;*
>
>
>
>
> 2018-07-05 17:29 GMT+02:00 Joshua Branson :
>
>> Almudena Garcia  writes:
>>
>> > 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 <
>> liberamenso10...@gmail.com>:
>> >
>>
>> hmmm.  This is a little out of my league, but I appreciate you for
>> trying!
>>
>>
>

>>>
>>
>


Re: Enable SMP support

2018-07-10 Thread 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.

2018-07-10 14:45 GMT+02:00 Almudena Garcia :

> This is the record of GNU/Hurd boot crash with SMP
>
> Feels that It crash when Hurd starts
>
> 2018-07-10 1:34 GMT+02:00 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
>>
>>
>>
>> 2018-07-09 19:20 GMT+02:00 Almudena Garcia :
>>
>>> I have commented this lines at moment.
>>>
>>>
>>>
>>> 2018-07-09 17:32 GMT+02:00 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

 Now I'm searching the equivalency to this:

 - IdlePTD in this line:


 *DBG("IdlePTD(%p): 0x%x\n", , (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;*




 2018-07-05 17:29 GMT+02:00 Joshua Branson :

> Almudena Garcia  writes:
>
> > 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 <
> liberamenso10...@gmail.com>:
> >
>
> hmmm.  This is a little out of my league, but I appreciate you for
> trying!
>
>

>>>
>>
>


Re: Enable SMP support

2018-07-09 Thread 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



2018-07-09 19:20 GMT+02:00 Almudena Garcia :

> I have commented this lines at moment.
>
>
>
> 2018-07-09 17:32 GMT+02:00 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
>>
>> Now I'm searching the equivalency to this:
>>
>> - IdlePTD in this line:
>>
>>
>> *DBG("IdlePTD(%p): 0x%x\n", , (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;*
>>
>>
>>
>>
>> 2018-07-05 17:29 GMT+02:00 Joshua Branson :
>>
>>> Almudena Garcia  writes:
>>>
>>> > 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!
>>>
>>>
>>
>


Re: Enable SMP support

2018-07-09 Thread Almudena Garcia
I have commented this lines at moment.



2018-07-09 17:32 GMT+02:00 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
>
> Now I'm searching the equivalency to this:
>
> - IdlePTD in this line:
>
>
> *DBG("IdlePTD(%p): 0x%x\n", , (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;*
>
>
>
>
> 2018-07-05 17:29 GMT+02:00 Joshua Branson :
>
>> Almudena Garcia  writes:
>>
>> > 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!
>>
>>
>


Re: Enable SMP support

2018-07-09 Thread 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

Now I'm searching the equivalency to this:

- IdlePTD in this line:


*DBG("IdlePTD(%p): 0x%x\n", , (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;*




2018-07-05 17:29 GMT+02:00 Joshua Branson :

> Almudena Garcia  writes:
>
> > 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!
>
>


Re: Enable SMP support

2018-07-05 Thread Joshua Branson
Almudena Garcia  writes:

> 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!



Re: Enable SMP support

2018-07-04 Thread 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 :

> 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?
>
>
> 2018-07-03 18:35 GMT+02:00 Luca Dariz :
>
>> Il 03/07/2018 18:15, Almudena Garcia ha scritto:
>> > 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
>>
>
>
#include 
#include 
#include 
#include 
#include 
#include 

kern_return_t intel_startCPU(
	int	slot_num)
{
	int	lapic = cpu_to_lapic[slot_num];
	int eFlagsRegister;

	assert(lapic != -1);

	DBGLOG_CPU_INIT(slot_num);

	DBG("intel_startCPU(%d) lapic_id=%d\n", slot_num, lapic);
	DBG("IdlePTD(%p): 0x%x\n", , (int) (uintptr_t)IdlePTD);

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

	/* Serialize use of the slave boot stack, etc. */
	kmutex_lock(_cpu_boot_lock);

	/*istate = ml_set_interrupts_enabled(FALSE);*/
	cpu_intr_save();
	if (slot_num == cpu_number()) {
		/*ml_set_interrupts_enabled(istate);*/
		cpu_intr_restore(eFlagsRegister);
		lck_mtx_unlock(_cpu_boot_lock);
		return KERN_SUCCESS;
	}

	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;

	/*
	 * Perform the processor startup sequence with all running
	 * processors rendezvous'ed. This is required during periods when
	 * the cache-disable bit is set for MTRR/PAT initialization.
	 */
	mp_rendezvous_no_intrs(start_cpu, (void *) _info);

	start_info.target_cpu = 0;

	/*ml_set_interrupts_enabled(istate);*/
	cpu_intr_restore(eFlagsRegister);
	lck_mtx_unlock(_cpu_boot_lock);

	if (!cpu_datap(slot_num)->cpu_running) {
		kprintf("Failed to start CPU %02d\n", slot_num);
		printf("Failed to start CPU %02d, rebooting...\n", slot_num);
		delay(100);
		halt_cpu();
		return KERN_SUCCESS;
	} else {
		kprintf("Started cpu %d (lapic id %08x)\n", slot_num, lapic);
		return KERN_SUCCESS;
	}
}


Re: Enable SMP support

2018-07-04 Thread Almudena Garcia
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?


2018-07-03 18:35 GMT+02:00 Luca Dariz :

> Il 03/07/2018 18:15, Almudena Garcia ha scritto:
> > 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
>
#include 
#include 
#include 
#include 
#include 
#include 

kern_return_t intel_startCPU(
	int	slot_num)
{
	int	lapic = cpu_to_lapic[slot_num];
	int eFlagsRegister;

	assert(lapic != -1);

	DBGLOG_CPU_INIT(slot_num);

	DBG("intel_startCPU(%d) lapic_id=%d\n", slot_num, lapic);
	DBG("IdlePTD(%p): 0x%x\n", , (int) (uintptr_t)IdlePTD);

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

	/* Serialize use of the slave boot stack, etc. */
	kmutex_lock(_cpu_boot_lock);

	/*istate = ml_set_interrupts_enabled(FALSE);*/
	cpu_intr_save();
	if (slot_num == cpu_number()) {
		/*ml_set_interrupts_enabled(istate);*/
		cpu_intr_save();
		lck_mtx_unlock(_cpu_boot_lock);
		return KERN_SUCCESS;
	}

	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;

	/*
	 * Perform the processor startup sequence with all running
	 * processors rendezvous'ed. This is required during periods when
	 * the cache-disable bit is set for MTRR/PAT initialization.
	 */
	mp_rendezvous_no_intrs(start_cpu, (void *) _info);

	start_info.target_cpu = 0;

	/*ml_set_interrupts_enabled(istate);*/
	cpu_intr_restore(eFlagsRegister);
	lck_mtx_unlock(_cpu_boot_lock);

	if (!cpu_datap(slot_num)->cpu_running) {
		kprintf("Failed to start CPU %02d\n", slot_num);
		printf("Failed to start CPU %02d, rebooting...\n", slot_num);
		delay(100);
		halt_cpu();
		return KERN_SUCCESS;
	} else {
		kprintf("Started cpu %d (lapic id %08x)\n", slot_num, lapic);
		return KERN_SUCCESS;
	}
}


Re: Enable SMP support

2018-07-03 Thread Almudena Garcia
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?

2018-07-03 17:49 GMT+02:00 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?
>
>
> 2018-07-03 13:00 GMT+02:00 :
>
>> Thanks, I'll try it
>>
>> El Martes 3 de julio de 2018, Luca Dariz escribió:
>> > Hello!
>> >
>> > Il 28/06/2018 20:31, Almudena Garcia ha scritto:
>> > > 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
>> >
>>
>> --
>> Enviado desde mi Jolla
>>
>
>


Re: Enable SMP support

2018-07-03 Thread Luca Dariz
Il 03/07/2018 17:49, Almudena Garcia ha scritto:
> 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.

> 
> 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



Re: Enable SMP support

2018-07-03 Thread 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?


2018-07-03 13:00 GMT+02:00 :

> Thanks, I'll try it
>
> El Martes 3 de julio de 2018, Luca Dariz escribió:
> > Hello!
> >
> > Il 28/06/2018 20:31, Almudena Garcia ha scritto:
> > > 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
> >
>
> --
> Enviado desde mi Jolla
>
ld   --defsym _START_MAP=0x100 --defsym _START=_START_MAP+0xC000 -T '..'/i386/ldscript  -o gnumach  gnumach.o clib-routines.o 
gnumach.o: In function `cpu_start':
/home/pruebas/GNUMach_SMP/build/../i386/i386/mp_desc.c:259: undefined reference to `intel_startCPU'
/home/pruebas/GNUMach_SMP/build/../i386/i386/mp_desc.c:259: undefined reference to `intel_startCPU'
/home/pruebas/GNUMach_SMP/build/../i386/i386/mp_desc.c:259: undefined reference to `intel_startCPU'
gnumach.o: In function `show':
/home/pruebas/GNUMach_SMP/build/../linux/dev/arch/i386/kernel/irq.c:457: undefined reference to `local_irq_count'
/home/pruebas/GNUMach_SMP/build/../linux/dev/arch/i386/kernel/irq.c:457: undefined reference to `local_irq_count'
/home/pruebas/GNUMach_SMP/build/../linux/dev/arch/i386/kernel/irq.c:459: undefined reference to `local_bh_count'
/home/pruebas/GNUMach_SMP/build/../linux/dev/arch/i386/kernel/irq.c:459: undefined reference to `local_bh_count'
gnumach.o: In function `__global_cli':
/home/pruebas/GNUMach_SMP/build/../linux/dev/arch/i386/kernel/irq.c:628: undefined reference to `local_irq_count'
gnumach.o: In function `wait_on_irq':
/home/pruebas/GNUMach_SMP/build/../linux/dev/arch/i386/kernel/irq.c:523: undefined reference to `local_bh_count'
/home/pruebas/GNUMach_SMP/build/../linux/dev/arch/i386/kernel/irq.c:543: undefined reference to `local_bh_count'
gnumach.o: In function `synchronize_bh':
/home/pruebas/GNUMach_SMP/build/../linux/dev/arch/i386/kernel/irq.c:561: undefined reference to `local_bh_count'
/home/pruebas/GNUMach_SMP/build/../linux/dev/arch/i386/kernel/irq.c:561: undefined reference to `local_irq_count'
gnumach.o: In function `__global_sti':
/home/pruebas/GNUMach_SMP/build/../linux/dev/arch/i386/kernel/irq.c:637: undefined reference to `local_irq_count'
gnumach.o: In function `__global_save_flags':
/home/pruebas/GNUMach_SMP/build/../linux/dev/arch/i386/kernel/irq.c:661: undefined reference to `local_irq_count'
Makefile:4113: recipe for target 'gnumach' failed
make: *** [gnumach] Error 1

Re: Enable SMP support

2018-07-03 Thread liberamenso10000
Thanks, I'll try it

El Martes 3 de julio de 2018, Luca Dariz escribió:
> Hello!
> 
> Il 28/06/2018 20:31, Almudena Garcia ha scritto:
> > 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
>

-- 
Enviado desde mi Jolla

Re: Enable SMP support

2018-07-03 Thread Luca Dariz
Hello!

Il 28/06/2018 20:31, Almudena Garcia ha scritto:
> 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



Re: Enable SMP support

2018-06-27 Thread Almudena Garcia
>
> *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.  */>
> #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.*
>

Now we have to add the cpu_number() function in this file.


2018-06-27 23:42 GMT+02:00 Samuel Thibault :

> Hello,
>
> Almudena Garcia, le mer. 27 juin 2018 22:37:55 +0200, a ecrit:
> > ../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.0 -0400
> > +++ gnumach-dev/kern/sched_prim.h 2018-06-27 15:36:46.0 -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.0 -0400
> > +++ gnumach-dev/kern/thread.h 2018-06-27 15:36:46.0 -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
>


Re: Enable SMP support

2018-06-27 Thread Samuel Thibault
Hello,

Almudena Garcia, le mer. 27 juin 2018 22:37:55 +0200, a ecrit:
> ../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.0 -0400
> +++ gnumach-dev/kern/sched_prim.h 2018-06-27 15:36:46.0 -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.0 -0400
> +++ gnumach-dev/kern/thread.h 2018-06-27 15:36:46.0 -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



Re: Enable SMP support

2018-06-27 Thread Almudena Garcia
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?

2018-06-19 17:22 GMT+02:00 Joshua Branson :

> Almudena Garcia  writes:
>
> > 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
> >
> > 2018-06-19 2:26 GMT+02:00 Samuel Thibault :
> >
> >  Hello,
> >
> >  Almudena Garcia, le lun. 18 juin 2018 21:16:28 +0200, a ecrit:
> >  > [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
>
>
make  all-recursive
make[1]: Entering directory '/home/diwou/gnumach/build'
make[2]: Entering directory '/home/diwou/gnumach/build'
depbase=`echo i386/intel/pmap.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DHAVE_CONFIG_H -I. -I..  -ffreestanding -nostdinc -imacros config.h -Ii386 -I. -I../i386 -I../i386/include/mach/sa -I../include  -fno-builtin-log --no-pie --no-pic -Wall -fgnu89-inline -fno-strict-aliasing -fno-stack-protector  -mno-3dnow -mno-mmx -mno-sse -mno-sse2 -g -O2 -MT i386/intel/pmap.o -MD -MP -MF $depbase.Tpo -c -o i386/intel/pmap.o ../i386/intel/pmap.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from ../kern/thread.h:50:0,
 from ../i386/intel/pmap.c:65:
../kern/sched_prim.h:188:1: warning: parameter names (without types) in function declaration
 extern void cause_ast_check(processor); /*new*/
 ^~
In file included from ../i386/intel/pmap.c:65:0:
../kern/thread.h:348:1: warning: parameter names (without types) in function declaration
 extern void cause_ast_check(processor); /*new*/
 ^~
../i386/intel/pmap.c: In function ‘pmap_map_bd’:
../i386/intel/pmap.c:238:8: warning: implicit declaration of function ‘splvm’ [-Wimplicit-function-declaration]
  spl = splvm(); \
^
../i386/intel/pmap.c:253:2: note: in expansion of macro ‘SPLVM’
  SPLVM(spl); \
  ^
../i386/intel/pmap.c:546:2: note: in expansion of macro ‘PMAP_READ_LOCK’
  PMAP_READ_LOCK(pmap, spl);
  ^~
In file included from ../kern/lock.h:41:0,
 from ../kern/queue.h:38,
 from ../kern/mach_clock.h:31,
 from ../kern/thread.h:46,
 from ../i386/intel/pmap.c:65:
../i386/intel/pmap.c:546:17: error: ‘pmap’ undeclared (first use in this function)
  PMAP_READ_LOCK(pmap, spl);
 ^
./machine/lock.h:50:31: note: in definition of macro ‘_simple_lock_xchg_’
   : "0" (new_val), "m" (*(lock)) : "memory" \
   ^~~~
../i386/intel/pmap.c:255:2: note: in expansion of macro ‘simple_lock’
  simple_lock(&(pmap)->lock); \
  ^~~
../i386/intel/pmap.c:546:2: note: in expansion of macro ‘PMAP_READ_LOCK’
  PMAP_READ_LOCK(pmap, spl);
  ^~
../i386/intel/pmap.c:546:17: note: each undeclared identifier is reported only once for each function it appears in
  PMAP_READ_LOCK(pmap, spl);
 ^
./machine/lock.h:50:31: note: in definition of macro ‘_simple_lock_xchg_’
   : "0" (new_val), "m" (*(lock)) : "memory" \
   ^~~~
../i386/intel/pmap.c:255:2: note: in expansion of macro ‘simple_lock’
  simple_lock(&(pmap)->lock); \
  ^~~
../i386/intel/pmap.c:546:2: note: in expansion of macro ‘PMAP_READ_LOCK’
  PMAP_READ_LOCK(pmap, spl);
  ^~
../i386/intel/pmap.c:244:2: warning: implicit declaration of function ‘splx’ [-Wimplicit-function-declaration]
  splx(spl); \
  ^
../i386/intel/pmap.c:266:2: note: in expansion of macro ‘SPLX’
  SPLX(spl); \
  ^~~~
../i386/intel/pmap.c:575:2: note: in expansion of macro ‘PMAP_READ_UNLOCK’
  PMAP_READ_UNLOCK(pmap, spl);
  ^~~~
In file included from ../i386/intel/pmap.c:63:0:
../i386/intel/pmap.c: In function ‘pmap_enter’:
../i386/intel/pmap.c:1866:13: warning: format ‘%p’ expects argument of type ‘void *’, but argument 5 has type ‘vm_offset_t {aka long unsigned int}’ [-Wformat=]
   panic("pmap_enter(%p, %p) falls in physical memory area!\n", v, pa);
 ^
../kern/debug.h:67:43: note: in definition of macro ‘panic’
  Panic (__FILE__, __LINE__, __FUNCTION__, s, ##__VA_ARGS__)
   ^
../i386/intel/pmap.c:1866:13: 

Re: Enable SMP support

2018-06-19 Thread Joshua Branson
Almudena Garcia  writes:

> 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
>
> 2018-06-19 2:26 GMT+02:00 Samuel Thibault :
>
>  Hello,
>
>  Almudena Garcia, le lun. 18 juin 2018 21:16:28 +0200, a ecrit:
>  > [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



Re: Enable SMP support

2018-06-19 Thread 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?

2018-06-19 2:26 GMT+02:00 Samuel Thibault :

> Hello,
>
> Almudena Garcia, le lun. 18 juin 2018 21:16:28 +0200, a ecrit:
> > [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
>
diff -ruN gnumach-1.8+git20180218/i386/i386/cpu_number.h gnumach-1.8+git20180218~/i386/i386/cpu_number.h
--- gnumach-1.8+git20180218/i386/i386/cpu_number.h	2015-09-12 11:19:34.0 +0200
+++ gnumach-1.8+git20180218~/i386/i386/cpu_number.h	2018-06-17 02:36:41.0 +0200
@@ -33,7 +33,8 @@
 #if	NCPUS > 1
 
 /* More-specific code must define cpu_number() and CPU_NUMBER.  */
-#define	CX(addr, reg)	addr(,reg,4)
+#define	CX(addr,reg)	addr(,reg,4)
+#define CPU_NUMBER(reg)
 
 #else	/* NCPUS == 1 */
 
diff -ruN gnumach-1.8+git20180218/i386/i386/lock.h gnumach-1.8+git20180218~/i386/i386/lock.h
--- gnumach-1.8+git20180218/i386/i386/lock.h	2016-10-02 19:45:20.0 +0200
+++ gnumach-1.8+git20180218~/i386/i386/lock.h	2018-06-17 03:15:34.0 +0200
@@ -43,15 +43,15 @@
  *	The code here depends on the GNU C compiler.
  */
 
-#define	_simple_lock_xchg_(lock, new_val) \
-({	int _old_val_; \
-	asm volatile("xchgl %0, %2" \
-		: "=r" (_old_val_) \
-		: "0" (new_val), "m" (*(lock) : "memory") \
-		); \
-	_old_val_; \
-})
-
+/*#define  _simple_lock_xchg_(lock, new_val) \
+ *({  int _old_val_; \
+ * asm volatile("xchgl %0, %2" \
+ *   : "=r" (_old_val_) \
+ *   : "0" (new_val), "m" (*lock) : "memory" \
+ *   ); \
+ * _old_val_; \
+ *   })
+ */
 #define	simple_lock_init(l) \
 	((l)->lock_data = 0)
 
diff -ruN gnumach-1.8+git20180218/i386/intel/pmap.c gnumach-1.8+git20180218~/i386/intel/pmap.c
--- gnumach-1.8+git20180218/i386/intel/pmap.c	2018-01-28 15:35:43.0 +0100
+++ gnumach-1.8+git20180218~/i386/intel/pmap.c	2018-06-17 15:51:08.0 +0200
@@ -543,7 +543,7 @@
 	if (prot & VM_PROT_WRITE)
 	template |= INTEL_PTE_WRITE;
 
-	PMAP_READ_LOCK(pmap, spl);
+	PMAP_READ_LOCK(pv_head_table->pmap, spl);
 	while (start < end) {
 		pte = pmap_pte(kernel_pmap, virt);
 		if (pte == PT_ENTRY_NULL)
@@ -572,7 +572,7 @@
 	if (n != i)
 		panic("couldn't pmap_map_bd\n");
 #endif	/* MACH_PV_PAGETABLES */
-	PMAP_READ_UNLOCK(pmap, spl);
+	PMAP_READ_UNLOCK(pv_head_table->pmap, spl);
 	return(virt);
 }
 diff -ruN gnumach-1.8+git20180218/kern/cpu_number.h gnumach-1.8+git20180218~/kern/cpu_number.h
--- gnumach-1.8+git20180218/kern/cpu_number.h	2016-10-02 19:45:20.0 +0200
+++ gnumach-1.8+git20180218~/kern/cpu_number.h	2018-06-17 02:13:48.0 +0200
@@ -35,9 +35,41 @@
 
 #if	(NCPUS == 1)
 	/* cpu number is always 0 on a single processor system */
-#define	cpu_number()	(0)
+	#define	cpu_number()	(0)
+	#define CPU_L1_SIZE (1 << CPU_L1_SHIFT)
+
+#else
 
 #define CPU_L1_SIZE (1 << CPU_L1_SHIFT)
 
+int apic2kernel[255];
+int cpu_number_start = 0, cpu_number_counter = 0;
+
+static int cpu_number(void) {
+  int eax = 1, ebx = 0, ecx = 0, edx = 0;
+  unsigned int i = 0;
+  int apic_id = 0;
+ 
+  if (!cpu_number_start) {
+for (i = 0; i < 255; i++) {
+  apic2kernel[i] = -1;
+}
+cpu_number_start = 1;
+  }
+ 
+  asm("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (eax));
+  apic_id = (char) (ebx >> 24) & 0xff;
+  //printf("apic_id = %d\n", apic_id);
+ 
+  if (apic2kernel[apic_id] != -1) {
+return apic2kernel[apic_id];
+  } else {
+apic2kernel[apic_id] = cpu_number_counter;
+cpu_number_counter++;
+  }
+ 
+  return apic2kernel[apic_id];
+}
+
 #endif	/* NCPUS == 1 */
 #endif /* _KERN_CPU_NUMBER_H_ */
diff -ruN gnumach-1.8+git20180218/kern/machine.h gnumach-1.8+git20180218~/kern/machine.h
--- gnumach-1.8+git20180218/kern/machine.h	2016-10-02 19:45:20.0 +0200
+++ gnumach-1.8+git20180218~/kern/machine.h	2018-06-17 02:11:40.0 +0200
@@ -54,5 +54,6 @@
  *  action_thread() shuts down processors or changes their assignment.
  */
 extern void action_thread_continue (void) __attribute__((noreturn));
+extern void action_thread (void)__attribute__((noreturn));
 
 #endif /* _MACHINE_H_ */
diff -ruN gnumach-1.8+git20180218/kern/sched_prim.h gnumach-1.8+git20180218~/kern/sched_prim.h
--- gnumach-1.8+git20180218/kern/sched_prim.h	2017-06-10 01:26:02.0 +0200
+++ gnumach-1.8+git20180218~/kern/sched_prim.h	2018-06-17 02:22:27.0 +0200
@@ -185,4 +185,6 @@
 extern void idle_thread(void) __attribute__((noreturn));
 extern void sched_thread(void);
 
+extern void cause_ast_check(processor); /*new*/
+
 #endif	/* _KERN_SCHED_PRIM_H_ */
diff -ruN gnumach-1.8+git20180218/kern/thread.h gnumach-1.8+git20180218~/kern/thread.h
--- gnumach-1.8+git20180218/kern/thread.h	

Re: Enable SMP support

2018-06-18 Thread Samuel Thibault
Hello,

Almudena Garcia, le lun. 18 juin 2018 21:16:28 +0200, a ecrit:
> [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



Re: Enable SMP support

2018-06-18 Thread Almudena Garcia
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




2018-06-17 14:01 GMT+02:00 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.
>
>
>
>
> 2018-06-17 10:00 GMT+02:00 Samuel Thibault :
>
>> Almudena Garcia, le dim. 17 juin 2018 01:44:11 +0200, a ecrit:
>> > and shows another error in kern/startup.c
>> >
>> > [2]http://dpaste.com/1QR0XSK
>>
>> It was just a missing declaration, now fixed.
>>
>> Samuel
>>
>
>


Re: Enable SMP support

2018-06-17 Thread 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.




2018-06-17 10:00 GMT+02:00 Samuel Thibault :

> Almudena Garcia, le dim. 17 juin 2018 01:44:11 +0200, a ecrit:
> > and shows another error in kern/startup.c
> >
> > [2]http://dpaste.com/1QR0XSK
>
> It was just a missing declaration, now fixed.
>
> Samuel
>


Re: Enable SMP support

2018-06-17 Thread Samuel Thibault
Almudena Garcia, le dim. 17 juin 2018 01:44:11 +0200, a ecrit:
> and shows another error in kern/startup.c
> 
> [2]http://dpaste.com/1QR0XSK

It was just a missing declaration, now fixed.

Samuel



Re: Enable SMP support

2018-06-16 Thread Almudena Garcia
Ok. I fixed my undefined behavior in cpu_number(). But It show many errors
http://dpaste.com/2ACQ7VZ

2018-06-17 1:44 GMT+02:00 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
>
>
>
>
> 2018-06-17 1:21 GMT+02:00 Almudena Garcia :
>
>> 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
>>
>> 2018-06-17 1:03 GMT+02:00 Samuel Thibault :
>>
>>> Almudena Garcia, le sam. 16 juin 2018 17:34:13 +0200, a ecrit:
>>> > The compilation continues failing, anymore
>>> >
>>> > [2]http://dpaste.com/26VWZ6G
>>>
>>> I have now fixed the dumb typo there.
>>>
>>> Samuel
>>>
>>
>>
>


Re: Enable SMP support

2018-06-16 Thread 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




2018-06-17 1:21 GMT+02:00 Almudena Garcia :

> 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
>
> 2018-06-17 1:03 GMT+02:00 Samuel Thibault :
>
>> Almudena Garcia, le sam. 16 juin 2018 17:34:13 +0200, a ecrit:
>> > The compilation continues failing, anymore
>> >
>> > [2]http://dpaste.com/26VWZ6G
>>
>> I have now fixed the dumb typo there.
>>
>> Samuel
>>
>
>


Re: Enable SMP support

2018-06-16 Thread Almudena Garcia
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

2018-06-17 1:03 GMT+02:00 Samuel Thibault :

> Almudena Garcia, le sam. 16 juin 2018 17:34:13 +0200, a ecrit:
> > The compilation continues failing, anymore
> >
> > [2]http://dpaste.com/26VWZ6G
>
> I have now fixed the dumb typo there.
>
> Samuel
>


Re: Enable SMP support

2018-06-16 Thread Samuel Thibault
Almudena Garcia, le sam. 16 juin 2018 17:34:13 +0200, a ecrit:
> The compilation continues failing, anymore
> 
> [2]http://dpaste.com/26VWZ6G

I have now fixed the dumb typo there.

Samuel



Re: Enable SMP support

2018-06-16 Thread Richard Braun
On Sat, Jun 16, 2018 at 01:17:57PM +0200, Almudena Garcia wrote:
> 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



Re: Enable SMP support

2018-06-16 Thread Almudena Garcia
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

2018-06-16 13:17 GMT+02:00 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
>
> 2018-06-15 19:36 GMT+02:00 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 ;)
>>
>> 2018-06-15 19:25 GMT+02:00 Richard Braun :
>>
>>> On Fri, Jun 15, 2018 at 07:18:55PM +0200, Richard Braun wrote:
>>> > On Fri, Jun 15, 2018 at 06:27:21PM +0200, Almudena Garcia wrote:
>>> > > 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?
>>>
>>> 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
>>>
>>
>>
>


Re: Enable SMP support

2018-06-16 Thread 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

2018-06-15 19:36 GMT+02:00 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 ;)
>
> 2018-06-15 19:25 GMT+02:00 Richard Braun :
>
>> On Fri, Jun 15, 2018 at 07:18:55PM +0200, Richard Braun wrote:
>> > On Fri, Jun 15, 2018 at 06:27:21PM +0200, Almudena Garcia wrote:
>> > > 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?
>>
>> 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
>>
>
>
#include 

static inline int cpu_number(void) {
  long eax = 1, ebx = 0, ecx = 0, edx = 0;
  char apic_id = 0;
  int cpun = -1;

  asm("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (eax));

  apic_id = (char) (ebx >> 24) & 0xff;

  printf("eax = %lx, ebx = %lx, ecx = %lx, edx = %lx\n", eax, ebx, ecx, edx);
  printf("apic_id = %lx\n", apic_id);

  return cpun;
}

int main (void) {
  printf("%d\n", cpu_number());

  return 0;
}


Re: Enable SMP support

2018-06-15 Thread 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 ;)

2018-06-15 19:25 GMT+02:00 Richard Braun :

> On Fri, Jun 15, 2018 at 07:18:55PM +0200, Richard Braun wrote:
> > On Fri, Jun 15, 2018 at 06:27:21PM +0200, Almudena Garcia wrote:
> > > 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?
>
> 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
>


Re: Enable SMP support

2018-06-15 Thread Richard Braun
On Fri, Jun 15, 2018 at 07:18:55PM +0200, Richard Braun wrote:
> On Fri, Jun 15, 2018 at 06:27:21PM +0200, Almudena Garcia wrote:
> > 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?

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



Re: Enable SMP support

2018-06-15 Thread Richard Braun
On Fri, Jun 15, 2018 at 06:27:21PM +0200, Almudena Garcia wrote:
> 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?

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



Re: Enable SMP support

2018-06-15 Thread 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.
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?


2018-06-15 1:52 GMT+02:00 Almudena Garcia :

> Ok. I understand you. But then... how can I to define cpu_number()
> function in multiprocessor? It isn't clear
>
> 2018-06-15 1:30 GMT+02:00 Amos Jeffries :
>
>> On 15/06/18 10:31, Almudena Garcia wrote:
>> > 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
>>
>>
>
#include 

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;
}

int main (void) {
  printf("%d\n", smp_processor_id());

  return 0;
}


Re: Enable SMP support

2018-06-14 Thread Almudena Garcia
Ok. I understand you. But then... how can I to define cpu_number() function
in multiprocessor? It isn't clear

2018-06-15 1:30 GMT+02:00 Amos Jeffries :

> On 15/06/18 10:31, Almudena Garcia wrote:
> > 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
>
>


Re: Enable SMP support

2018-06-14 Thread liberamenso10000
Ok, I agree. I didn't read this docs. I'll try to change it

El Viernes 15 de junio de 2018, Amos Jeffries escribió:
> On 15/06/18 10:31, Almudena Garcia wrote:
> > 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 desde mi Jolla

Re: Enable SMP support

2018-06-14 Thread Amos Jeffries
On 15/06/18 10:31, Almudena Garcia wrote:
> 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



Re: Enable SMP support

2018-06-14 Thread 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)

#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)

2018-06-15 0:14 GMT+02:00 Svante Signell :

> On Thu, 2018-06-14 at 20:21 +0200, Almudena Garcia wrote:
> > 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
> :(
>


Re: Enable SMP support

2018-06-14 Thread Svante Signell
On Thu, 2018-06-14 at 20:21 +0200, Almudena Garcia wrote:
> 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
:(



Re: Enable SMP support

2018-06-14 Thread 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.

2018-06-14 18:36 GMT+02:00 Samuel Thibault :

> Almudena Garcia, le jeu. 14 juin 2018 17:58:42 +0200, a ecrit:
> > 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
>


Re: Enable SMP support

2018-06-14 Thread Samuel Thibault
Almudena Garcia, le jeu. 14 juin 2018 17:58:42 +0200, a ecrit:
> 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



Re: Enable SMP support

2018-06-14 Thread Almudena Garcia
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


2018-06-08 23:04 GMT+02:00 Almudena Garcia :

> But... where is this configuration file?
>
> Do I need to recompile mach after enable the SMP option?
>
> 2018-06-08 21:27 GMT+02:00 James Clarke :
>
>> On 8 Jun 2018, at 18:06, Joshua Branson  wrote:
>> >
>> > Almudena Garcia  writes:
>> >
>> >> 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
>> >
>> > 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.
>>
>> From gnumach's configfrag.ac:
>>
>> > # 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
>>
>>
>>
>


Re: Enable SMP support

2018-06-08 Thread Almudena Garcia
But... where is this configuration file?

Do I need to recompile mach after enable the SMP option?

2018-06-08 21:27 GMT+02:00 James Clarke :

> On 8 Jun 2018, at 18:06, Joshua Branson  wrote:
> >
> > Almudena Garcia  writes:
> >
> >> 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
> >
> > 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.
>
> From gnumach's configfrag.ac:
>
> > # 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
>
>
>


Re: Enable SMP support

2018-06-08 Thread James Clarke
On 8 Jun 2018, at 18:06, Joshua Branson  wrote:
> 
> Almudena Garcia  writes:
> 
>> 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
> 
> 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.

From gnumach's configfrag.ac:

> # 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




Re: Enable SMP support

2018-06-08 Thread Joshua Branson
Almudena Garcia  writes:

> 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

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.



Enable SMP support

2018-06-07 Thread Almudena Garcia
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