public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: fix pte allocation in "x86: introduce init_memory_mapping for 32bit"
@ 2008-06-24 21:32 Jeremy Fitzhardinge
  2008-06-24 21:41 ` Yinghai Lu
  2008-06-26 13:13 ` Ingo Molnar
  0 siblings, 2 replies; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2008-06-24 21:32 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Ingo Molnar, Linux Kernel Mailing List

The patch "x86: introduce init_memory_mapping for 32bit" does not allocate 
enough space for PTEs if the CPU does not implement PSE.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Yinghai Lu <yhlu.kernel@gmail.com>
---
 arch/x86/mm/init_32.c |    5 +++++
 1 file changed, 5 insertions(+)

===================================================================
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -733,6 +733,11 @@
 	pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
 	tables += PAGE_ALIGN(pmds * sizeof(pmd_t));
 
+	if (!cpu_has_pse) {
+		int ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
+		tables += PAGE_ALIGN(ptes * sizeof(pte_t));
+	}
+
 	/*
 	 * RED-PEN putting page tables only on node 0 could
 	 * cause a hotspot and fill up ZONE_DMA. The page tables



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

* Re: [PATCH] x86: fix pte allocation in "x86: introduce init_memory_mapping for 32bit"
  2008-06-24 21:32 [PATCH] x86: fix pte allocation in "x86: introduce init_memory_mapping for 32bit" Jeremy Fitzhardinge
@ 2008-06-24 21:41 ` Yinghai Lu
  2008-06-25  3:49   ` Jeremy Fitzhardinge
  2008-06-26 13:13 ` Ingo Molnar
  1 sibling, 1 reply; 4+ messages in thread
From: Yinghai Lu @ 2008-06-24 21:41 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: Ingo Molnar, Linux Kernel Mailing List

On Tue, Jun 24, 2008 at 2:32 PM, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
> The patch "x86: introduce init_memory_mapping for 32bit" does not allocate
> enough space for PTEs if the CPU does not implement PSE.
>
> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
> Cc: Yinghai Lu <yhlu.kernel@gmail.com>
> ---
> arch/x86/mm/init_32.c |    5 +++++
> 1 file changed, 5 insertions(+)
>
> ===================================================================
> --- a/arch/x86/mm/init_32.c
> +++ b/arch/x86/mm/init_32.c
> @@ -733,6 +733,11 @@
>        pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
>        tables += PAGE_ALIGN(pmds * sizeof(pmd_t));
>
> +       if (!cpu_has_pse) {
> +               int ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
> +               tables += PAGE_ALIGN(ptes * sizeof(pte_t));
> +       }
> +
>        /*
>         * RED-PEN putting page tables only on node 0 could
>         * cause a hotspot and fill up ZONE_DMA. The page tables
>
thanks.

my test system never use the area from table_start to table_end. and I
wonder why init_pgtable is that big..

YH

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

* Re: [PATCH] x86: fix pte allocation in "x86: introduce init_memory_mapping for 32bit"
  2008-06-24 21:41 ` Yinghai Lu
@ 2008-06-25  3:49   ` Jeremy Fitzhardinge
  0 siblings, 0 replies; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2008-06-25  3:49 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Ingo Molnar, Linux Kernel Mailing List

Yinghai Lu wrote:
> thanks.
>
> my test system never use the area from table_start to table_end. and I
> wonder why init_pgtable is that big..

This code looks just like the 64-bit code (I guess it's becoming prime 
for unification), and I'd just spent some time debugging a bug in Xen64 
caused by an overrun of the allocated area when creating non-PSE 
mappings of physical memory.  I didn't observe a specific problem with 
this code, but consistency and pattern matching made it seem like a 
necessary addition.  It only ends up reserving the amount of space 
actually used, so there's no wasted memory.

If you use PSE to create the mapping and have enough mapped pages anyway 
(small kernel), then you may not end up using any of this space.

    J

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

* Re: [PATCH] x86: fix pte allocation in "x86: introduce init_memory_mapping for 32bit"
  2008-06-24 21:32 [PATCH] x86: fix pte allocation in "x86: introduce init_memory_mapping for 32bit" Jeremy Fitzhardinge
  2008-06-24 21:41 ` Yinghai Lu
@ 2008-06-26 13:13 ` Ingo Molnar
  1 sibling, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2008-06-26 13:13 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: Yinghai Lu, Linux Kernel Mailing List


* Jeremy Fitzhardinge <jeremy@goop.org> wrote:

> The patch "x86: introduce init_memory_mapping for 32bit" does not 
> allocate enough space for PTEs if the CPU does not implement PSE.

applied to tip/x86/unify-setup - thanks Jeremy!

	Ingo

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

end of thread, other threads:[~2008-06-26 13:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-24 21:32 [PATCH] x86: fix pte allocation in "x86: introduce init_memory_mapping for 32bit" Jeremy Fitzhardinge
2008-06-24 21:41 ` Yinghai Lu
2008-06-25  3:49   ` Jeremy Fitzhardinge
2008-06-26 13:13 ` Ingo Molnar

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