* [PATCH] x86/i386: Check PSE bit before using PAGE_KERNEL_LARGE.
@ 2012-05-31 19:40 Konrad Rzeszutek Wilk
2012-05-31 20:21 ` H. Peter Anvin
0 siblings, 1 reply; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-05-31 19:40 UTC (permalink / raw)
To: konrad, linux-kernel, x86, hpa, mingo, tglx; +Cc: Konrad Rzeszutek Wilk, stable
During bootup we would unconditionally do this on any
machine that was built with CONFIG_NUMA=y on i386:
setup_arch
\-initmem_init
\-x86_numa_init (with dummy_init as callback)
\- init_alloc_remap
\- set_pmd_pfn (with PAGE_PSE)
without checking to see if the CPU supports PSE. This
patch adds that and also allows the init_alloc_remap function
to properly work by falling back on PTEs.
CC: stable@kernel.org
Tested-by: William Dauchy <wdauchy@gmail.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
arch/x86/mm/pgtable_32.c | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
index a69bcb8..9fd4abc 100644
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -86,7 +86,30 @@ void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags)
}
pud = pud_offset(pgd, vaddr);
pmd = pmd_offset(pud, vaddr);
- set_pmd(pmd, pfn_pmd(pfn, flags));
+
+ if ((!cpu_has_pse) && (pgprot_val(flags) & _PAGE_PSE)) {
+ pte_t *pte;
+ int i;
+
+ pgprot_val(flags) &= ~_PAGE_PSE;
+
+ /*
+ * This is run _after_ initial memory mapped so the
+ * PTE page are allocated - but we check it just in case.
+ */
+ if (pmd_none(*pmd)) {
+ printk(KERN_WARNING "set_pmd_pfn: pmd_none\n");
+ return;
+ }
+
+ pte = (pte_t *)pmd_page_vaddr(*pmd);
+ for (i = 0; i < PTRS_PER_PTE; i++) {
+ set_pte(pte, pfn_pte(pfn + i, flags));
+ pte++;
+ }
+ } else
+ set_pmd(pmd, pfn_pmd(pfn, flags));
+
/*
* It's enough to flush this one mapping.
* (PGE mappings get flushed as well)
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/i386: Check PSE bit before using PAGE_KERNEL_LARGE.
2012-05-31 19:40 [PATCH] x86/i386: Check PSE bit before using PAGE_KERNEL_LARGE Konrad Rzeszutek Wilk
@ 2012-05-31 20:21 ` H. Peter Anvin
2012-05-31 20:35 ` Konrad Rzeszutek Wilk
0 siblings, 1 reply; 4+ messages in thread
From: H. Peter Anvin @ 2012-05-31 20:21 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk; +Cc: konrad, linux-kernel, x86, mingo, tglx, stable
On 05/31/2012 12:40 PM, Konrad Rzeszutek Wilk wrote:
> During bootup we would unconditionally do this on any
> machine that was built with CONFIG_NUMA=y on i386:
>
> setup_arch
> \-initmem_init
> \-x86_numa_init (with dummy_init as callback)
> \- init_alloc_remap
> \- set_pmd_pfn (with PAGE_PSE)
>
> without checking to see if the CPU supports PSE. This
> patch adds that and also allows the init_alloc_remap function
> to properly work by falling back on PTEs.
>
Well, the code looks like it is PAE-specific, and PAE implies PSE.
Xen breaks that, but that is a divergence of Xen from x86.
-hpa
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/i386: Check PSE bit before using PAGE_KERNEL_LARGE.
2012-05-31 20:21 ` H. Peter Anvin
@ 2012-05-31 20:35 ` Konrad Rzeszutek Wilk
2012-05-31 23:02 ` H. Peter Anvin
0 siblings, 1 reply; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-05-31 20:35 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: konrad, linux-kernel, x86, mingo, tglx, stable
On Thu, May 31, 2012 at 01:21:02PM -0700, H. Peter Anvin wrote:
> On 05/31/2012 12:40 PM, Konrad Rzeszutek Wilk wrote:
> > During bootup we would unconditionally do this on any
> > machine that was built with CONFIG_NUMA=y on i386:
> >
> > setup_arch
> > \-initmem_init
> > \-x86_numa_init (with dummy_init as callback)
> > \- init_alloc_remap
> > \- set_pmd_pfn (with PAGE_PSE)
> >
> > without checking to see if the CPU supports PSE. This
> > patch adds that and also allows the init_alloc_remap function
> > to properly work by falling back on PTEs.
> >
>
> Well, the code looks like it is PAE-specific, and PAE implies PSE.
I have to double check - but I think a kernel built with CONFIG_HIGHMEM64=y
and CONFIG_NUMA=y would boot on a Pentium II which can't do PAE.
But perhaps there are some other checks that would halt the kernel
before it even got there?
>
> Xen breaks that, but that is a divergence of Xen from x86.
It certainly does <sigh>. And that is how I spotted this - b/c the
PMD would fail (with tons of mutlicalls warnings) - and the PTE's
would still point to the old PFNs.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/i386: Check PSE bit before using PAGE_KERNEL_LARGE.
2012-05-31 20:35 ` Konrad Rzeszutek Wilk
@ 2012-05-31 23:02 ` H. Peter Anvin
0 siblings, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2012-05-31 23:02 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk; +Cc: konrad, linux-kernel, x86, mingo, tglx, stable
No, PAE kernels cannot boot on non-PAE hardware.
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
>On Thu, May 31, 2012 at 01:21:02PM -0700, H. Peter Anvin wrote:
>> On 05/31/2012 12:40 PM, Konrad Rzeszutek Wilk wrote:
>> > During bootup we would unconditionally do this on any
>> > machine that was built with CONFIG_NUMA=y on i386:
>> >
>> > setup_arch
>> > \-initmem_init
>> > \-x86_numa_init (with dummy_init as callback)
>> > \- init_alloc_remap
>> > \- set_pmd_pfn (with PAGE_PSE)
>> >
>> > without checking to see if the CPU supports PSE. This
>> > patch adds that and also allows the init_alloc_remap function
>> > to properly work by falling back on PTEs.
>> >
>>
>> Well, the code looks like it is PAE-specific, and PAE implies PSE.
>
>I have to double check - but I think a kernel built with
>CONFIG_HIGHMEM64=y
>and CONFIG_NUMA=y would boot on a Pentium II which can't do PAE.
>
>But perhaps there are some other checks that would halt the kernel
>before it even got there?
>
>>
>> Xen breaks that, but that is a divergence of Xen from x86.
>
>It certainly does <sigh>. And that is how I spotted this - b/c the
>PMD would fail (with tons of mutlicalls warnings) - and the PTE's
>would still point to the old PFNs.
--
Sent from my mobile phone. Please excuse brevity and lack of formatting.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-31 23:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-31 19:40 [PATCH] x86/i386: Check PSE bit before using PAGE_KERNEL_LARGE Konrad Rzeszutek Wilk
2012-05-31 20:21 ` H. Peter Anvin
2012-05-31 20:35 ` Konrad Rzeszutek Wilk
2012-05-31 23:02 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox