* [PATCH] x86_64: do not assume head_64.S used 4KB pages when !use_pse
@ 2011-06-23 11:14 stefano.stabellini
2011-06-23 23:46 ` [tip:x86/mm] x86-64, mm: Do " tip-bot for Stefano Stabellini
0 siblings, 1 reply; 7+ messages in thread
From: stefano.stabellini @ 2011-06-23 11:14 UTC (permalink / raw)
To: hpa
Cc: hpa, konrad.wilk, mingo, linux-kernel, xen-devel,
Stefano.Stabellini, yinghai, Stefano Stabellini
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
head_64.S, which sets up the initial page table on x86_64, is not aware
of PSE being enabled or disabled and it always allocates the initial
mapping using 2MB pages.
Therefore on x86_64 find_early_table_space shouldn't update the amount
of pages needed for pte pages depending on the size of the initial
mapping, because we know for sure that no pte pages have been allocated
yet.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reported-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/mm/init.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 36bacfe..1e3098b 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -42,12 +42,19 @@ static void __init find_early_table_space(unsigned long start,
(PMD_SIZE * PTRS_PER_PMD));
pmd_mapped *= (PMD_SIZE * PTRS_PER_PMD);
+ /*
+ * On x86_64 do not limit the size we need to cover with 4KB pages
+ * depending on the initial allocation because head_64.S always uses
+ * 2MB pages.
+ */
+#ifdef CONFIG_X86_32
if (start < PFN_PHYS(max_pfn_mapped)) {
if (PFN_PHYS(max_pfn_mapped) < end)
size -= PFN_PHYS(max_pfn_mapped) - start;
else
size = 0;
}
+#endif
#ifndef __PAGETABLE_PUD_FOLDED
if (end > pud_mapped) {
--
1.7.2.3
^ permalink raw reply [flat|nested] 7+ messages in thread* [tip:x86/mm] x86-64, mm: Do not assume head_64.S used 4KB pages when !use_pse
2011-06-23 11:14 [PATCH] x86_64: do not assume head_64.S used 4KB pages when !use_pse stefano.stabellini
@ 2011-06-23 23:46 ` tip-bot for Stefano Stabellini
0 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Stefano Stabellini @ 2011-06-23 23:46 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, tglx, hpa, mingo, stefano.stabellini
Commit-ID: 2e9fbad5955f34bf1934bd6a8165c1f49ac8cc46
Gitweb: http://git.kernel.org/tip/2e9fbad5955f34bf1934bd6a8165c1f49ac8cc46
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
AuthorDate: Thu, 23 Jun 2011 12:14:25 +0100
Committer: H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 23 Jun 2011 16:14:02 -0700
x86-64, mm: Do not assume head_64.S used 4KB pages when !use_pse
head_64.S, which sets up the initial page table on x86_64, is not aware
of PSE being enabled or disabled and it always allocates the initial
mapping using 2MB pages.
Therefore on x86_64 find_early_table_space shouldn't update the amount
of pages needed for pte pages depending on the size of the initial
mapping, because we know for sure that no pte pages have been allocated
yet.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Link: http://lkml.kernel.org/r/1308827665-28890-1-git-send-email-stefano.stabellini@eu.citrix.com
Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
arch/x86/mm/init.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 36bacfe..e72c9f8 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -42,12 +42,19 @@ static void __init find_early_table_space(unsigned long start,
(PMD_SIZE * PTRS_PER_PMD));
pmd_mapped *= (PMD_SIZE * PTRS_PER_PMD);
+ /*
+ * On x86_64 do not limit the size we need to cover with 4KB pages
+ * depending on the initial allocation because head_64.S always uses
+ * 2MB pages.
+ */
+#ifdef CONFIG_X86_32
if (start < PFN_PHYS(max_pfn_mapped)) {
if (PFN_PHYS(max_pfn_mapped) < end)
size -= PFN_PHYS(max_pfn_mapped) - start;
else
size = 0;
}
+#endif
#ifndef __PAGETABLE_PUD_FOLDED
if (end > pud_mapped) {
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] x86_64: do not assume head_64.S used 4KB pages when !use_pse
@ 2011-06-23 12:38 Penttilä Mika
2011-06-23 12:56 ` Stefano Stabellini
0 siblings, 1 reply; 7+ messages in thread
From: Penttilä Mika @ 2011-06-23 12:38 UTC (permalink / raw)
To: stefano.stabellini, linux-kernel
> From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> head_64.S, which sets up the initial page table on x86_64, is not aware
> of PSE being enabled or disabled and it always allocates the initial
> mapping using 2MB pages.
> Therefore on x86_64 find_early_table_space shouldn't update the amount
> of pages needed for pte pages depending on the size of the initial
> mapping, because we know for sure that no pte pages have been allocated
> yet.
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Reported-by: Ingo Molnar <mingo@elte.hu>
> ---
> arch/x86/mm/init.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> index 36bacfe..1e3098b 100644
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -42,12 +42,19 @@ static void __init find_early_table_space(unsigned long start,
> (PMD_SIZE * PTRS_PER_PMD));
> pmd_mapped *= (PMD_SIZE * PTRS_PER_PMD);
>
> + /*
> + * On x86_64 do not limit the size we need to cover with 4KB pages
> + * depending on the initial allocation because head_64.S always uses
> + * 2MB pages.
> + */
> +#ifdef CONFIG_X86_32
> if (start < PFN_PHYS(max_pfn_mapped)) {
> if (PFN_PHYS(max_pfn_mapped) < end)
> size -= PFN_PHYS(max_pfn_mapped) - start;
> else
> size = 0;
> }
> +#endif
And arch/x86/mm/init.c also has:
#if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK)
/*
* For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
* This will simplify cpa(), which otherwise needs to support splitting
* large pages into small in interrupt context, etc.
*/
use_pse = use_gbpages = 0;
#else
use_pse = cpu_has_pse;
use_gbpages = direct_gbpages;
#endif
So big pages are also not used for DEBUG_PAGEALLOC and KMEMCHECK configs even if head_32.S did.
--Mika
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] x86_64: do not assume head_64.S used 4KB pages when !use_pse
2011-06-23 12:38 [PATCH] x86_64: do " Penttilä Mika
@ 2011-06-23 12:56 ` Stefano Stabellini
2011-06-23 14:50 ` Penttilä Mika
0 siblings, 1 reply; 7+ messages in thread
From: Stefano Stabellini @ 2011-06-23 12:56 UTC (permalink / raw)
To: Penttilä Mika; +Cc: Stefano Stabellini, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2141 bytes --]
On Thu, 23 Jun 2011, Penttilä Mika wrote:
> > From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
> > head_64.S, which sets up the initial page table on x86_64, is not aware
> > of PSE being enabled or disabled and it always allocates the initial
> > mapping using 2MB pages.
>
> > Therefore on x86_64 find_early_table_space shouldn't update the amount
> > of pages needed for pte pages depending on the size of the initial
> > mapping, because we know for sure that no pte pages have been allocated
> > yet.
>
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > Reported-by: Ingo Molnar <mingo@elte.hu>
> > ---
> > arch/x86/mm/init.c | 7 +++++++
> > 1 files changed, 7 insertions(+), 0 deletions(-)
>
> > diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> > index 36bacfe..1e3098b 100644
> > --- a/arch/x86/mm/init.c
> > +++ b/arch/x86/mm/init.c
> > @@ -42,12 +42,19 @@ static void __init find_early_table_space(unsigned long start,
> > (PMD_SIZE * PTRS_PER_PMD));
> > pmd_mapped *= (PMD_SIZE * PTRS_PER_PMD);
> >
> > + /*
> > + * On x86_64 do not limit the size we need to cover with 4KB pages
> > + * depending on the initial allocation because head_64.S always uses
> > + * 2MB pages.
> > + */
> > +#ifdef CONFIG_X86_32
> > if (start < PFN_PHYS(max_pfn_mapped)) {
> > if (PFN_PHYS(max_pfn_mapped) < end)
> > size -= PFN_PHYS(max_pfn_mapped) - start;
> > else
> > size = 0;
> > }
> > +#endif
>
> And arch/x86/mm/init.c also has:
>
> #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK)
> /*
> * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
> * This will simplify cpa(), which otherwise needs to support splitting
> * large pages into small in interrupt context, etc.
> */
> use_pse = use_gbpages = 0;
> #else
> use_pse = cpu_has_pse;
> use_gbpages = direct_gbpages;
> #endif
>
>
> So big pages are also not used for DEBUG_PAGEALLOC and KMEMCHECK configs even if head_32.S did.
Right, but that is not a problem because head_32.S always uses 4KB
pages.
^ permalink raw reply [flat|nested] 7+ messages in thread* RE: [PATCH] x86_64: do not assume head_64.S used 4KB pages when !use_pse
2011-06-23 12:56 ` Stefano Stabellini
@ 2011-06-23 14:50 ` Penttilä Mika
2011-06-23 15:19 ` Stefano Stabellini
0 siblings, 1 reply; 7+ messages in thread
From: Penttilä Mika @ 2011-06-23 14:50 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: linux-kernel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2759 bytes --]
> From: Stefano Stabellini [mailto:stefano.stabellini@eu.citrix.com]
> Sent: 23. kesäkuuta 2011 15:57
> To: Penttilä Mika
> Cc: Stefano Stabellini; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] x86_64: do not assume head_64.S used 4KB pages
> when !use_pse
>
> On Thu, 23 Jun 2011, Penttilä Mika wrote:
> > > From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> >
> > > head_64.S, which sets up the initial page table on x86_64, is not
> aware
> > > of PSE being enabled or disabled and it always allocates the
> initial
> > > mapping using 2MB pages.
> >
> > > Therefore on x86_64 find_early_table_space shouldn't update the
> amount
> > > of pages needed for pte pages depending on the size of the initial
> > > mapping, because we know for sure that no pte pages have been
> allocated
> > > yet.
> >
> > > Signed-off-by: Stefano Stabellini
> <stefano.stabellini@eu.citrix.com>
> > > Reported-by: Ingo Molnar <mingo@elte.hu>
> > > ---
> > > arch/x86/mm/init.c | 7 +++++++
> > > 1 files changed, 7 insertions(+), 0 deletions(-)
> >
> > > diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> > > index 36bacfe..1e3098b 100644
> > > --- a/arch/x86/mm/init.c
> > > +++ b/arch/x86/mm/init.c
> > > @@ -42,12 +42,19 @@ static void __init
> find_early_table_space(unsigned long start,
> > > (PMD_SIZE * PTRS_PER_PMD));
> > > pmd_mapped *= (PMD_SIZE * PTRS_PER_PMD);
> > >
> > > + /*
> > > + * On x86_64 do not limit the size we need to cover with 4KB
> pages
> > > + * depending on the initial allocation because head_64.S always
> uses
> > > + * 2MB pages.
> > > + */
> > > +#ifdef CONFIG_X86_32
> > > if (start < PFN_PHYS(max_pfn_mapped)) {
> > > if (PFN_PHYS(max_pfn_mapped) < end)
> > > size -= PFN_PHYS(max_pfn_mapped) - start;
> > > else
> > > size = 0;
> > > }
> > > +#endif
> >
> > And arch/x86/mm/init.c also has:
> >
> > #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK)
> > /*
> > * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use
> small pages.
> > * This will simplify cpa(), which otherwise needs to support
> splitting
> > * large pages into small in interrupt context, etc.
> > */
> > use_pse = use_gbpages = 0;
> > #else
> > use_pse = cpu_has_pse;
> > use_gbpages = direct_gbpages;
> > #endif
> >
> >
> > So big pages are also not used for DEBUG_PAGEALLOC and KMEMCHECK
> configs even if head_32.S did.
>
> Right, but that is not a problem because head_32.S always uses 4KB
> pages.
We use large pages FOR PAE kernels on x86-32 there
--Mika
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 7+ messages in thread* RE: [PATCH] x86_64: do not assume head_64.S used 4KB pages when !use_pse
2011-06-23 14:50 ` Penttilä Mika
@ 2011-06-23 15:19 ` Stefano Stabellini
2011-06-23 16:25 ` Penttilä Mika
0 siblings, 1 reply; 7+ messages in thread
From: Stefano Stabellini @ 2011-06-23 15:19 UTC (permalink / raw)
To: Penttilä Mika; +Cc: Stefano Stabellini, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1443 bytes --]
On Thu, 23 Jun 2011, Penttilä Mika wrote:
> > > And arch/x86/mm/init.c also has:
> > >
> > > #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK)
> > > /*
> > > * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use
> > small pages.
> > > * This will simplify cpa(), which otherwise needs to support
> > splitting
> > > * large pages into small in interrupt context, etc.
> > > */
> > > use_pse = use_gbpages = 0;
> > > #else
> > > use_pse = cpu_has_pse;
> > > use_gbpages = direct_gbpages;
> > > #endif
> > >
> > >
> > > So big pages are also not used for DEBUG_PAGEALLOC and KMEMCHECK
> > configs even if head_32.S did.
> >
> > Right, but that is not a problem because head_32.S always uses 4KB
> > pages.
>
> We use large pages FOR PAE kernels on x86-32 there
>
Do you mean we use large pages for PAE kernels on x86_32 in
arch/x86/mm/init.c:init_memory_mapping?
That wouldn't be a problem for this patch.
The problem I am trying to solve occurs when head_64.S doesn't allocate
any pte pages because it is using 2MB pages, while init_memory_mapping
wants to use 4KB pages (for example because the user set
CONFIG_DEBUG_PAGEALLOC).
So on x86_32 is not going to be an issue because head_32.S doesn't use
2MB or 4MB pages as far as I can tell, even if the hardware supports
them.
Please correct me if I am wrong but I don't see any _PAGE_PSE in
head_32.S.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] x86_64: do not assume head_64.S used 4KB pages when !use_pse
2011-06-23 15:19 ` Stefano Stabellini
@ 2011-06-23 16:25 ` Penttilä Mika
0 siblings, 0 replies; 7+ messages in thread
From: Penttilä Mika @ 2011-06-23 16:25 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: linux-kernel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2039 bytes --]
> From: Stefano Stabellini [mailto:stefano.stabellini@eu.citrix.com]
> Sent: 23. kesäkuuta 2011 18:20
> To: Penttilä Mika
> Cc: Stefano Stabellini; linux-kernel@vger.kernel.org
> Subject: RE: [PATCH] x86_64: do not assume head_64.S used 4KB pages
> when !use_pse
>
> On Thu, 23 Jun 2011, Penttilä Mika wrote:
> > > > And arch/x86/mm/init.c also has:
> > > >
> > > > #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK)
> > > > /*
> > > > * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use
> > > small pages.
> > > > * This will simplify cpa(), which otherwise needs to
> support
> > > splitting
> > > > * large pages into small in interrupt context, etc.
> > > > */
> > > > use_pse = use_gbpages = 0;
> > > > #else
> > > > use_pse = cpu_has_pse;
> > > > use_gbpages = direct_gbpages;
> > > > #endif
> > > >
> > > >
> > > > So big pages are also not used for DEBUG_PAGEALLOC and KMEMCHECK
> > > configs even if head_32.S did.
> > >
> > > Right, but that is not a problem because head_32.S always uses 4KB
> > > pages.
> >
> > We use large pages FOR PAE kernels on x86-32 there
> >
>
> Do you mean we use large pages for PAE kernels on x86_32 in
> arch/x86/mm/init.c:init_memory_mapping?
> That wouldn't be a problem for this patch.
>
> The problem I am trying to solve occurs when head_64.S doesn't allocate
> any pte pages because it is using 2MB pages, while init_memory_mapping
> wants to use 4KB pages (for example because the user set
> CONFIG_DEBUG_PAGEALLOC).
>
> So on x86_32 is not going to be an issue because head_32.S doesn't use
> 2MB or 4MB pages as far as I can tell, even if the hardware supports
> them.
> Please correct me if I am wrong but I don't see any _PAGE_PSE in
> head_32.S.
Yes you're right head_32.S doesn't do large pages, I remembered it would..
--Mika
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-06-23 23:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-23 11:14 [PATCH] x86_64: do not assume head_64.S used 4KB pages when !use_pse stefano.stabellini
2011-06-23 23:46 ` [tip:x86/mm] x86-64, mm: Do " tip-bot for Stefano Stabellini
2011-06-23 12:38 [PATCH] x86_64: do " Penttilä Mika
2011-06-23 12:56 ` Stefano Stabellini
2011-06-23 14:50 ` Penttilä Mika
2011-06-23 15:19 ` Stefano Stabellini
2011-06-23 16:25 ` Penttilä Mika
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®