mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* 2.5.61: x86_64 num_online_cpus() buglet?
@ 2003-02-17 17:51 Mikael Pettersson
  2003-02-18  6:31 ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Pettersson @ 2003-02-17 17:51 UTC (permalink / raw)
  To: ak; +Cc: linux-kernel

Andi,

Kernel 2.5.61's include/asm-x86_64/smp.h contains:

extern unsigned long cpu_online_map;
...
extern inline unsigned int num_online_cpus(void)
{ 
	return hweight32(cpu_online_map);
} 

and similarly for cpu_callout_map.

hweight32() truncates a 64-bit operand to 32-bits, so either
- the maps should be int rather than long, or
- x86_64 needs to define and use a new hweight64(), or
- CONFIG_NR_CPUS must not exceed 32 on x86_64.

Comments?

/Mikael

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

* Re: 2.5.61: x86_64 num_online_cpus() buglet?
  2003-02-17 17:51 2.5.61: x86_64 num_online_cpus() buglet? Mikael Pettersson
@ 2003-02-18  6:31 ` Andi Kleen
  2003-02-18  7:27   ` David S. Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2003-02-18  6:31 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: ak, linux-kernel

On Mon, Feb 17, 2003 at 06:51:12PM +0100, Mikael Pettersson wrote:
> Andi,
> 
> Kernel 2.5.61's include/asm-x86_64/smp.h contains:
> 
> extern unsigned long cpu_online_map;
> ...
> extern inline unsigned int num_online_cpus(void)
> { 
> 	return hweight32(cpu_online_map);
> } 
> 
> and similarly for cpu_callout_map.
> 
> hweight32() truncates a 64-bit operand to 32-bits, so either
> - the maps should be int rather than long, or
> - x86_64 needs to define and use a new hweight64(), or
> - CONFIG_NR_CPUS must not exceed 32 on x86_64.
> 
> Comments?

You're right - it should use hweight64. Thanks for the headup.
I'll fix it.

Currently the x86-64 port is limited to 8 CPUs because the APIC
drivers don't support cluster mode (yet) and can only talk to 8 
local apics, so it isn't that harmful.

-Andi

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

* Re: 2.5.61: x86_64 num_online_cpus() buglet?
  2003-02-18  6:31 ` Andi Kleen
@ 2003-02-18  7:27   ` David S. Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David S. Miller @ 2003-02-18  7:27 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Mikael Pettersson, linux-kernel

On Mon, 2003-02-17 at 22:31, Andi Kleen wrote:
> You're right - it should use hweight64. Thanks for the headup.
> I'll fix it.

Can someone finally add a hweight64() to the generic code?
I've been avoiding usage of hweight64() anywhere for this
very reason.


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

end of thread, other threads:[~2003-02-18  6:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-17 17:51 2.5.61: x86_64 num_online_cpus() buglet? Mikael Pettersson
2003-02-18  6:31 ` Andi Kleen
2003-02-18  7:27   ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®