bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enable SMP support


From: Amos Jeffries
Subject: Re: Enable SMP support
Date: Fri, 15 Jun 2018 11:30:54 +1200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]