LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/1] x86_64: x86_64_cleanup_pda() should use nr_cpu_ids instead of NR_CPUS
@ 2008-02-25 18:33 Mike Travis
2008-02-25 18:33 ` [PATCH 1/1] " Mike Travis
0 siblings, 1 reply; 2+ messages in thread
From: Mike Travis @ 2008-02-25 18:33 UTC (permalink / raw)
To: Andrew Morton, Eric Dumazet, Ingo Molnar, Thomas Gleixner, Andi Kleen
Cc: Christoph Lameter, Jack Steiner, linux-kernel, linux-mm
Hi Andrew - would you add this to your -mm patchset? It fixes a
possible panic.
(I based it on 2.6.25-rc2 + 2.6.25-rc2-mm1 + my patches from broken-out-0223
as I could not get 2.6.25-rc2 + all of broken-out-0223 to apply.)
Thanks, Mike
..from Eric Dumazet:
> You might want to apply this patch.
>
> I also wonder if _cpu_pda should be set only at the very end of
> x86_64_cleanup_pda(), after array initialization, or maybe other
> cpus are not yet running ? (Sorry I cannot boot test this patch at this
> moment)
>
> [PATCH] x86_64: x86_64_cleanup_pda() should use nr_cpu_ids instead of NR_CPUS
>
> We allocate an array of nr_cpu_ids pointers, so we should respect its bonds.
>
> Delay change of _cpu_pda after array initialization.
>
> Also take into account that alloc_bootmem_low() :
> - calls panic() if not enough memory
> - already clears allocated memory
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: Mike Travis <travis@sgi.com>
---
Built and tested: (x86_64) defconfig, nonum, nosmp (*).
Built: (x86_64) all{yes,mod}config,
(i386) defconfig, all{yes,mod}config, nonum, nosmp.
* - I add to disable ACPI to build the non-smp version of x86_64.
---
--
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/1] x86_64: x86_64_cleanup_pda() should use nr_cpu_ids instead of NR_CPUS
2008-02-25 18:33 [PATCH 0/1] x86_64: x86_64_cleanup_pda() should use nr_cpu_ids instead of NR_CPUS Mike Travis
@ 2008-02-25 18:33 ` Mike Travis
0 siblings, 0 replies; 2+ messages in thread
From: Mike Travis @ 2008-02-25 18:33 UTC (permalink / raw)
To: Andrew Morton, Eric Dumazet, Ingo Molnar, Thomas Gleixner, Andi Kleen
Cc: Christoph Lameter, Jack Steiner, linux-kernel, linux-mm
[-- Attachment #1: fold-pda-fix --]
[-- Type: text/plain, Size: 1225 bytes --]
We allocate an array of nr_cpu_ids pointers, so we should respect its bonds.
Delay change of _cpu_pda after array initialization.
Also take into account that alloc_bootmem_low() :
- calls panic() if not enough memory
- already clears allocated memory
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: Mike Travis <travis@sgi.com>
---
arch/x86/kernel/head64.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -151,18 +151,16 @@ void __init x86_64_start_kernel(char * r
void __init x86_64_cleanup_pda(void)
{
int i;
+ struct x8664_pda **new_cpu_pda;
- _cpu_pda = alloc_bootmem_low(nr_cpu_ids * sizeof(void *));
+ new_cpu_pda = alloc_bootmem_low(nr_cpu_ids * sizeof(void *));
- if (!_cpu_pda)
- panic("Cannot allocate cpu pda table\n");
+ for (i = 0; i < nr_cpu_ids; i++)
+ if (_cpu_pda_init[i] != &boot_cpu_pda[i])
+ new_cpu_pda[i] = _cpu_pda_init[i];
+ mb();
+ _cpu_pda = new_cpu_pda;
/* cpu_pda() now points to allocated cpu_pda_table */
-
- for (i = 0; i < NR_CPUS; i++)
- if (_cpu_pda_init[i] == &boot_cpu_pda[i])
- cpu_pda(i) = NULL;
- else
- cpu_pda(i) = _cpu_pda_init[i];
}
#endif
--
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-02-25 18:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-25 18:33 [PATCH 0/1] x86_64: x86_64_cleanup_pda() should use nr_cpu_ids instead of NR_CPUS Mike Travis
2008-02-25 18:33 ` [PATCH 1/1] " Mike Travis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).