public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* RE: [PATCH] Fix hotplug cpu on x86_64
@ 2005-10-07 16:42 Protasevich, Natalie
  2005-10-07 17:25 ` Andi Kleen
  0 siblings, 1 reply; 10+ messages in thread
From: Protasevich, Natalie @ 2005-10-07 16:42 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Brian Gerst, lkml, Andrew Morton

> > sure convenient. I though at the time it would be great if
> > alloc_percpu() mechanism was able to dynamically re-create all the 
> > per_cpu's for new processors, that way cpu_possible_map woun't 
> > probably even be needed. Or is it too much trouble for too 
> little gain...
> 
> The problem is to tell all subsystems to reinitialize the 
> data for possible CPUs (essentially the concept of "possible" 
> CPUs would need to go)  It would need an reaudit of a lot of 
> code. Probably quite some work.

You know Andi, I was imagining something like bitmap or linked list of
all per_cpu vars (dynamically updated) and just going through this
list... Or something like that (maybe some registration mechanism).
There are not too many of them - about two dozens, mostly all sorts of
accounting.

> I think it is better to try to figure out how many hotplug 
> CPUs are supported, otherwise use a small default.

Exactly - such as on ES7000, it can support 32, 64, 128 etc. processors
depending on what configuration the customer actually ordered :)... it
should be something for that, then NR_CPUS could be either defined as
boot parameter or belong to subarchs.
Thanks,
--Natalie
  
> My 
> current code uses disabled CPUs as a heuristic, otherwise 
> half of available CPUs and it can be overwritten by the user.
> 
> -Andi
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread
* RE: [PATCH] Fix hotplug cpu on x86_64
@ 2005-10-07 16:00 Protasevich, Natalie
  0 siblings, 0 replies; 10+ messages in thread
From: Protasevich, Natalie @ 2005-10-07 16:00 UTC (permalink / raw)
  To: Brian Gerst; +Cc: lkml, Andi Kleen

> > I had to do the same in i386, but initially I was trying to 
> avoid the 
> > whole situation - allocating per_cpu data for all possible 
> processors.
> > It seemed wasteful that on the system with NR_CPU=256 or 512 and 
> > brought up as 4x everything per_cpu is (pre)allocated for all, 
> > although it's sure convenient. I though at the time it 
> would be great 
> > if
> > alloc_percpu() mechanism was able to dynamically re-create all the 
> > per_cpu's for new processors, that way cpu_possible_map woun't 
> > probably even be needed. Or is it too much trouble for too 
> little gain...
> > 
> > Thanks,
> > --Natalie
> > 
> 
> It certainly is possible.  In the hotplug cpu case, don't put 
> the .data.percpu section in __initmem.  It will then be 
> preserved for any cpus that come online after boot.
> 

I don't want to confuse Andrew, the patch is definitely correct and
needed...
 
It is more about "cold plug" case, when processors are not present
initially, but physically added to the systen during runtime. The
problem was not to preserve, but not to even allocate per_cpu for all
NR_CPUS, only for physically present processors. Then create per_cpu
with all the allocated data for the newly added processors. But as I
said it is probably too much to ask after all... :)
Thanks,
--Natalie

^ permalink raw reply	[flat|nested] 10+ messages in thread
* RE: [PATCH] Fix hotplug cpu on x86_64
@ 2005-10-07 15:07 Protasevich, Natalie
  2005-10-07 15:27 ` Brian Gerst
  2005-10-07 16:24 ` Andi Kleen
  0 siblings, 2 replies; 10+ messages in thread
From: Protasevich, Natalie @ 2005-10-07 15:07 UTC (permalink / raw)
  To: Brian Gerst, lkml; +Cc: Andrew Morton, Andi Kleen

> Brian Gerst wrote:
> > Brian Gerst wrote:
> >> I've been seeing bogus values from /proc/loadavg on an x86-64 SMP 
> >> kernel (but not UP).
> >>
> >> $ cat /proc/loadavg
> >> -1012098.26 922203.26 -982431.60 1/112 2688
> >>
> >> This is in the current git tree.  I'm also seeing strange values in
> >> /proc/stat:
> >>
> >> cpu  2489 40 920 60530 9398 171 288 1844674407350 cpu0 2509 60 940 
> >> 60550 9418 191 308 0
> >>
> >> The first line is the sum of all cpus (I only have one), so it's 
> >> picking up up bad data from the non-present cpus.  The last value, 
> >> stolen time, is completely bogus since that value is only 
> ever used 
> >> on s390.
> >>
> >> It looks to me like there is some problem with how the per-cpu 
> >> structures are being initialized, or are getting 
> corrupted.  I have 
> >> not been able to test i386 SMP yet to see if the problem is x86_64 
> >> specific.
> > 
> > I found the culprit: CPU hotplug.  The problem is that
> > prefill_possible_map() is called after setup_per_cpu_areas().  This 
> > leaves the per-cpu data sections for the future cpus uninitialized 
> > (still pointing to the original per-cpu data, which is initmem).  
> > Since the cpus exists in cpu_possible_map, for_each_cpu 
> will iterate 
> > over them even though the per-cpu data is invalid.
> 

I had to do the same in i386, but initially I was trying to avoid the
whole situation - allocating per_cpu data for all possible processors.
It seemed wasteful that on the system with NR_CPU=256 or 512 and brought
up as 4x everything per_cpu is (pre)allocated for all, although it's
sure convenient. I though at the time it would be great if
alloc_percpu() mechanism was able to dynamically re-create all the
per_cpu's for new processors, that way cpu_possible_map woun't probably
even be needed. Or is it too much trouble for too little gain...

Thanks,
--Natalie


> Initialize cpu_possible_map properly in the hotplug cpu case. 
>  Before this, the map was filled in after the per-cpu areas 
> were set up.  This left those cpus pointing to initmem and 
> causing invalid data in /proc/stat and elsewhere.
> 
> Signed-off-by: Brian Gerst <bgerst@didntduck.org>
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Bogus load average and cpu times on x86_64 SMP kernels
@ 2005-10-05  7:16 Brian Gerst
  2005-10-05 18:00 ` Brian Gerst
  0 siblings, 1 reply; 10+ messages in thread
From: Brian Gerst @ 2005-10-05  7:16 UTC (permalink / raw)
  To: lkml; +Cc: Andi Kleen

I've been seeing bogus values from /proc/loadavg on an x86-64 SMP kernel 
(but not UP).

$ cat /proc/loadavg
-1012098.26 922203.26 -982431.60 1/112 2688

This is in the current git tree.  I'm also seeing strange values in 
/proc/stat:

cpu  2489 40 920 60530 9398 171 288 1844674407350
cpu0 2509 60 940 60550 9418 191 308 0

The first line is the sum of all cpus (I only have one), so it's picking 
up up bad data from the non-present cpus.  The last value, stolen time, 
is completely bogus since that value is only ever used on s390.

It looks to me like there is some problem with how the per-cpu 
structures are being initialized, or are getting corrupted.  I have not 
been able to test i386 SMP yet to see if the problem is x86_64 specific.

--
				Brian Gerst

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

end of thread, other threads:[~2005-10-08 10:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-07 16:42 [PATCH] Fix hotplug cpu on x86_64 Protasevich, Natalie
2005-10-07 17:25 ` Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2005-10-07 16:00 Protasevich, Natalie
2005-10-07 15:07 Protasevich, Natalie
2005-10-07 15:27 ` Brian Gerst
2005-10-07 16:24 ` Andi Kleen
2005-10-05  7:16 Bogus load average and cpu times on x86_64 SMP kernels Brian Gerst
2005-10-05 18:00 ` Brian Gerst
2005-10-07  4:15   ` [PATCH] Fix hotplug cpu on x86_64 Brian Gerst
2005-10-07  9:50     ` Andi Kleen
2005-10-08  0:50       ` Anton Blanchard
2005-10-08 10:33         ` Andi Kleen

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