All of lore.kernel.org
 help / color / mirror / Atom feed
* NR_CPUS and kernel 2.4.30 for sparc64
@ 2005-05-25 20:46 Krzysztof Helt
  2005-05-25 22:44 ` Krzysztof Helt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Krzysztof Helt @ 2005-05-25 20:46 UTC (permalink / raw)
  To: sparclinux

I built a kernel 2.4.30 with SMP and number of cpus set to 2, but This 
kernel actevated only one cpu. A quick look at the smp.c file 
(arch/sparc64/kernel/smp.c) revealed a root of this:

In the smp_boot_cpus() function there are lines:

	for (i = 0; i < NR_CPUS; i++) {
		if (i = boot_cpu_id)
			continue;

		if ((cpucount + 1) = max_cpus)
			goto ignorecpu;
            ...

The first condition eliminates the first cpu from the list of found ones 
(I assume the first is a boot cpu). The second condition eliminates the 
last cpu. So on dual smp machine if the first cpu (number 0) is the boot 
cpu and NR_CPUS is set to 2 no other cpu is found.

I think the second condition and goto should be removed, but please 
advice in case I do not understand something with SMP initialization.

Regards,
Krzysztof Helt


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: NR_CPUS and kernel 2.4.30 for sparc64
  2005-05-25 20:46 NR_CPUS and kernel 2.4.30 for sparc64 Krzysztof Helt
@ 2005-05-25 22:44 ` Krzysztof Helt
  2005-05-25 23:37 ` Chris Newport
  2005-05-25 23:37 ` Ben Collins
  2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Helt @ 2005-05-25 22:44 UTC (permalink / raw)
  To: sparclinux

David S. Miller wrote:
> You must set CONFIG_NR_CPUS to one plus the largest "physical cpu"
> number in your machine if you want all processors to be detected
> properly.  In your case, the correct setting would be 3.
> 
> 
> 

This works differnetly than on sparc32 kernel (it works there).

I thought about the second condition from my previous post (elimnation 
of last cpu from the list of cpus). As far as I can see,  the max_cpus 
is always equal to NR_CPUS (is it true?). If so, the second condition is 
redudant (cpucount is always < NR_CPUS).



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: NR_CPUS and kernel 2.4.30 for sparc64
  2005-05-25 20:46 NR_CPUS and kernel 2.4.30 for sparc64 Krzysztof Helt
  2005-05-25 22:44 ` Krzysztof Helt
@ 2005-05-25 23:37 ` Chris Newport
  2005-05-25 23:37 ` Ben Collins
  2 siblings, 0 replies; 4+ messages in thread
From: Chris Newport @ 2005-05-25 23:37 UTC (permalink / raw)
  To: sparclinux

Krzysztof Helt wrote:

> You must set CONFIG_NR_CPUS to one plus the largest "physical cpu"
>
>> number in your machine if you want all processors to be detected
>> properly.  In your case, the correct setting would be 3.
>
>
> This works differnetly than on sparc32 kernel (it works there).
>
It works on Sun4m because all of the processors are confined to a single 
system board.
On Sun4d and Sun4u you can have multiple system boards.
CPU0 is the first CPU slot in the first system board slot. There is no 
universal requirement that any slot is filled [1], so if the only system 
board on an E10k is in slot 15 the 4 possible processors will be numbers 
60 to 63.

Think of it as "how many places do I look to find a possible CPU before 
giving up".
32 is a safe choice on all except the biggest machines and it is wise to 
not change this default unless you have some big iron.

[1] Not strictly true - some versions of the OBP require a CPU to exist 
on board 0 cpu 0.  Some other versions require a CPU to exist in the 
first CPU slot of the first occupied board slot. YMMV. Here be dragons.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: NR_CPUS and kernel 2.4.30 for sparc64
  2005-05-25 20:46 NR_CPUS and kernel 2.4.30 for sparc64 Krzysztof Helt
  2005-05-25 22:44 ` Krzysztof Helt
  2005-05-25 23:37 ` Chris Newport
@ 2005-05-25 23:37 ` Ben Collins
  2 siblings, 0 replies; 4+ messages in thread
From: Ben Collins @ 2005-05-25 23:37 UTC (permalink / raw)
  To: sparclinux

That's not the issue. You have to remember that this cpu count is not "the
number of cpu's supported", it's the range of cpu id's supported.

For example, in my e3000, the cpu's are numbers 0,1,6,7,8,9

So I have to set the number of cpu's to atleast 10 so that all six my of
cpu's work.

My suggestion is to set the number of cpu's to 32, always. Changing it
really doesn't give any sort of performance increase or make anything any
simpler. Might use a bit more memory, but the length of the arrays
searched for cpu's will always be just the length of the number of cpu's
you have active (and the extra memory used is negligible anyway).

On Wed, May 25, 2005 at 10:46:12PM +0200, Krzysztof Helt wrote:
> I built a kernel 2.4.30 with SMP and number of cpus set to 2, but This 
> kernel actevated only one cpu. A quick look at the smp.c file 
> (arch/sparc64/kernel/smp.c) revealed a root of this:
> 
> In the smp_boot_cpus() function there are lines:
> 
> 	for (i = 0; i < NR_CPUS; i++) {
> 		if (i = boot_cpu_id)
> 			continue;
> 
> 		if ((cpucount + 1) = max_cpus)
> 			goto ignorecpu;
>            ...
> 
> The first condition eliminates the first cpu from the list of found ones 
> (I assume the first is a boot cpu). The second condition eliminates the 
> last cpu. So on dual smp machine if the first cpu (number 0) is the boot 
> cpu and NR_CPUS is set to 2 no other cpu is found.
> 
> I think the second condition and goto should be removed, but please 
> advice in case I do not understand something with SMP initialization.
> 
> Regards,
> Krzysztof Helt
> 
> -
> To unsubscribe from this list: send the line "unsubscribe sparclinux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
Subversion - http://subversion.tigris.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-05-25 23:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-25 20:46 NR_CPUS and kernel 2.4.30 for sparc64 Krzysztof Helt
2005-05-25 22:44 ` Krzysztof Helt
2005-05-25 23:37 ` Chris Newport
2005-05-25 23:37 ` Ben Collins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.