2006-09-22 02:54:49

by Keith Mannthey

[permalink] [raw]
Subject: [Patch] i386 bootioremap / kexec fix


With CONFIG_PHYSICAL_START set to a non default values the i386
boot_ioremap code calculated its pte index wrong and users of
boot_ioremap have their areas incorrectly mapped (for me SRAT table not
mapped during early boot). This patch removes the addr < BOOT_PTE_PTRS
constraint.

Signed-off-by: Keith Mannthey<[email protected]>
---
boot_ioremap.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff -urN linux-2.6.18-rc6-mm2-orig/arch/i386/mm/boot_ioremap.c
linux-2.6.17/arch/i386/mm/boot_ioremap.c
--- linux-2.6.18-rc6-mm2-orig/arch/i386/mm/boot_ioremap.c 2006-09-18
01:19:22.000000000 -0700
+++ linux-2.6.17/arch/i386/mm/boot_ioremap.c 2006-09-18
01:23:33.000000000 -0700
@@ -29,8 +29,11 @@
*/

#define BOOT_PTE_PTRS (PTRS_PER_PTE*2)
-#define boot_pte_index(address) \
- (((address) >> PAGE_SHIFT) & (BOOT_PTE_PTRS - 1))
+
+static unsigned long boot_pte_index(unsigned long vaddr)
+{
+ return __pa(vaddr) >> PAGE_SHIFT;
+}

static inline boot_pte_t* boot_vaddr_to_pte(void *address)
{



2006-09-22 03:16:16

by Andrew Morton

[permalink] [raw]
Subject: Re: [Patch] i386 bootioremap / kexec fix

On Thu, 21 Sep 2006 19:54:45 -0700
keith mannthey <[email protected]> wrote:

>
> With CONFIG_PHYSICAL_START set to a non default values the i386
> boot_ioremap code calculated its pte index wrong and users of
> boot_ioremap have their areas incorrectly mapped (for me SRAT table not
> mapped during early boot). This patch removes the addr < BOOT_PTE_PTRS
> constraint.
>
> Signed-off-by: Keith Mannthey<[email protected]>
> ---
> boot_ioremap.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff -urN linux-2.6.18-rc6-mm2-orig/arch/i386/mm/boot_ioremap.c
> linux-2.6.17/arch/i386/mm/boot_ioremap.c
> --- linux-2.6.18-rc6-mm2-orig/arch/i386/mm/boot_ioremap.c 2006-09-18
> 01:19:22.000000000 -0700
> +++ linux-2.6.17/arch/i386/mm/boot_ioremap.c 2006-09-18
> 01:23:33.000000000 -0700
> @@ -29,8 +29,11 @@
> */
>
> #define BOOT_PTE_PTRS (PTRS_PER_PTE*2)
> -#define boot_pte_index(address) \
> - (((address) >> PAGE_SHIFT) & (BOOT_PTE_PTRS - 1))
> +
> +static unsigned long boot_pte_index(unsigned long vaddr)
> +{
> + return __pa(vaddr) >> PAGE_SHIFT;
> +}
>
> static inline boot_pte_t* boot_vaddr_to_pte(void *address)
> {

Thanks. This patch is against 2.6.18-rc6-mm2, yes? Does it fix a bug which
is only in -mm? If so, do you know which patch introduced it? Seems to me
that this is a 2.6.18 fix?

Is this the thing which was causing your NUMA machine to fail? If so, does
2.6.18 boot OK now?

You have a bit of wordwrapping happening there btw.

2006-09-22 17:11:09

by Keith Mannthey

[permalink] [raw]
Subject: Re: [Patch] i386 bootioremap / kexec fix

On Thu, 2006-09-21 at 20:16 -0700, Andrew Morton wrote:
> On Thu, 21 Sep 2006 19:54:45 -0700
> keith mannthey <[email protected]> wrote:
>
> >
> > With CONFIG_PHYSICAL_START set to a non default values the i386
> > boot_ioremap code calculated its pte index wrong and users of
> > boot_ioremap have their areas incorrectly mapped (for me SRAT table not
> > mapped during early boot). This patch removes the addr < BOOT_PTE_PTRS
> > constraint.
> >
> > Signed-off-by: Keith Mannthey<[email protected]>
> > ---
> > boot_ioremap.c | 7 +++++--
> > 1 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff -urN linux-2.6.18-rc6-mm2-orig/arch/i386/mm/boot_ioremap.c
> > linux-2.6.17/arch/i386/mm/boot_ioremap.c
> > --- linux-2.6.18-rc6-mm2-orig/arch/i386/mm/boot_ioremap.c 2006-09-18
> > 01:19:22.000000000 -0700
> > +++ linux-2.6.17/arch/i386/mm/boot_ioremap.c 2006-09-18
> > 01:23:33.000000000 -0700
> > @@ -29,8 +29,11 @@
> > */
> >
> > #define BOOT_PTE_PTRS (PTRS_PER_PTE*2)
> > -#define boot_pte_index(address) \
> > - (((address) >> PAGE_SHIFT) & (BOOT_PTE_PTRS - 1))
> > +
> > +static unsigned long boot_pte_index(unsigned long vaddr)
> > +{
> > + return __pa(vaddr) >> PAGE_SHIFT;
> > +}
> >
> > static inline boot_pte_t* boot_vaddr_to_pte(void *address)
> > {
>
> Thanks. This patch is against 2.6.18-rc6-mm2, yes? Does it fix a bug which
> is only in -mm? If so, do you know which patch introduced it? Seems to me
> that this is a 2.6.18 fix?

The patch was against 2.6.18-rc6-mm2 but the problem is a 2.6.1[678]
issue. The problem has always been present but my great new config
(KDUMP Kernel starts 16mb) brought it to the surface.

For a little more context about how the fix came to be see
http://lkml.org/lkml/2006/9/12/357

>
> Is this the thing which was causing your NUMA machine to fail? If so, does
> 2.6.18 boot OK now?
Yes boots better now. With the SRAT discovered it can setup 2 nodes in the VM.

> You have a bit of wordwrapping happening there btw.
Sorry about I will work to be more careful.

Thanks,
Keith