* i386 and PAE: pud_present()
@ 2006-04-28 7:40 Magnus Damm
2006-04-28 7:54 ` Nick Piggin
0 siblings, 1 reply; 6+ messages in thread
From: Magnus Damm @ 2006-04-28 7:40 UTC (permalink / raw)
To: Linux Kernel Mailing List, Linux Memory Management
Hi guys,
In file include/asm-i386/pgtable-3level.h:
On i386 with PAE enabled, shouldn't pud_present() return (pud_val(pud)
& _PAGE_PRESENT) instead of constant 1?
Today pud_present() returns constant 1 regardless of PAE or not. This
looks wrong to me, but maybe I'm misunderstanding how to fold the page
tables... =)
Thanks,
/ magnus
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: i386 and PAE: pud_present()
2006-04-28 7:40 i386 and PAE: pud_present() Magnus Damm
@ 2006-04-28 7:54 ` Nick Piggin
2006-04-28 8:27 ` Andi Kleen
0 siblings, 1 reply; 6+ messages in thread
From: Nick Piggin @ 2006-04-28 7:54 UTC (permalink / raw)
To: Magnus Damm; +Cc: Linux Kernel Mailing List, Linux Memory Management
Magnus Damm wrote:
> Hi guys,
>
> In file include/asm-i386/pgtable-3level.h:
>
> On i386 with PAE enabled, shouldn't pud_present() return (pud_val(pud)
> & _PAGE_PRESENT) instead of constant 1?
>
> Today pud_present() returns constant 1 regardless of PAE or not. This
> looks wrong to me, but maybe I'm misunderstanding how to fold the page
> tables... =)
Take a look a little further down the page for the comment.
In i386 + PAE, pud is always present.
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: i386 and PAE: pud_present()
2006-04-28 7:54 ` Nick Piggin
@ 2006-04-28 8:27 ` Andi Kleen
2006-04-30 6:07 ` Dave McCracken
[not found] ` <2432524299CCD3CA89BB647D@10.1.1.4>
0 siblings, 2 replies; 6+ messages in thread
From: Andi Kleen @ 2006-04-28 8:27 UTC (permalink / raw)
To: Nick Piggin
Cc: Magnus Damm, Linux Kernel Mailing List, Linux Memory Management
On Friday 28 April 2006 09:54, Nick Piggin wrote:
> Magnus Damm wrote:
> > Hi guys,
> >
> > In file include/asm-i386/pgtable-3level.h:
> >
> > On i386 with PAE enabled, shouldn't pud_present() return (pud_val(pud)
> > & _PAGE_PRESENT) instead of constant 1?
> >
> > Today pud_present() returns constant 1 regardless of PAE or not. This
> > looks wrong to me, but maybe I'm misunderstanding how to fold the page
> > tables... =)
>
> Take a look a little further down the page for the comment.
>
> In i386 + PAE, pud is always present.
I think his problem is that the PGD is always present too (in pgtables-nopud.h)
Indeed looks strange.
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: i386 and PAE: pud_present()
2006-04-28 8:27 ` Andi Kleen
@ 2006-04-30 6:07 ` Dave McCracken
2006-04-30 8:53 ` Andi Kleen
[not found] ` <2432524299CCD3CA89BB647D@10.1.1.4>
1 sibling, 1 reply; 6+ messages in thread
From: Dave McCracken @ 2006-04-30 6:07 UTC (permalink / raw)
To: Andi Kleen, Nick Piggin
Cc: Magnus Damm, Linux Kernel Mailing List, Linux Memory Management
--On Friday, April 28, 2006 10:27:21 +0200 Andi Kleen <ak@suse.de> wrote:
>> Take a look a little further down the page for the comment.
>>
>> In i386 + PAE, pud is always present.
>
> I think his problem is that the PGD is always present too (in
> pgtables-nopud.h) Indeed looks strange.
The PGD is always fully populated on i386 if PAE is enabled. All three of
the pmd pages are allocated at page table creation time and persist till
the page table is deleted.
Dave McCracken
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: i386 and PAE: pud_present()
2006-04-30 6:07 ` Dave McCracken
@ 2006-04-30 8:53 ` Andi Kleen
0 siblings, 0 replies; 6+ messages in thread
From: Andi Kleen @ 2006-04-30 8:53 UTC (permalink / raw)
To: Dave McCracken
Cc: Nick Piggin, Magnus Damm, Linux Kernel Mailing List,
Linux Memory Management
On Sunday 30 April 2006 08:07, Dave McCracken wrote:
>
> --On Friday, April 28, 2006 10:27:21 +0200 Andi Kleen <ak@suse.de> wrote:
>
> >> Take a look a little further down the page for the comment.
> >>
> >> In i386 + PAE, pud is always present.
> >
> > I think his problem is that the PGD is always present too (in
> > pgtables-nopud.h) Indeed looks strange.
>
> The PGD is always fully populated on i386 if PAE is enabled. All three of
> the pmd pages are allocated at page table creation time and persist till
> the page table is deleted.
At least with the new flexmmap it sounds like a waste of memory.
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: i386 and PAE: pud_present()
[not found] ` <2432524299CCD3CA89BB647D@10.1.1.4>
@ 2006-05-01 3:07 ` Magnus Damm
0 siblings, 0 replies; 6+ messages in thread
From: Magnus Damm @ 2006-05-01 3:07 UTC (permalink / raw)
To: Dave McCracken
Cc: Andi Kleen, Nick Piggin, Linux Kernel Mailing List,
Linux Memory Management
On 4/30/06, Dave McCracken <dmccr@us.ibm.com> wrote:
>
> --On Friday, April 28, 2006 10:27:21 +0200 Andi Kleen <ak@suse.de> wrote:
>
> >> Take a look a little further down the page for the comment.
> >>
> >> In i386 + PAE, pud is always present.
> >
> > I think his problem is that the PGD is always present too (in
> > pgtables-nopud.h) Indeed looks strange.
>
> The PGD is always fully populated on i386 if PAE is enabled. All three of
> the pmd pages are allocated at page table creation time and persist till
> the page table is deleted.
The following code snippet is from some kexec patch of mine. The
function is used to build a new set of page tables which are used when
jumping to the new kernel.
The code should be pretty archtecture independent - the same code
works on x86 and x86_64. And x86/PAE with a workaround.
#ifdef CONFIG_X86_PAE
#undef pud_present
#define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT)
#endif
#define pa_page(page) __pa(page_address(page))
static int create_mapping(struct page *root, struct page **pages,
unsigned long va, unsigned long pa)
{
pgd_t *pgd;
pud_t *pud;
pmd_t *pmd;
pte_t *pte;
int k = 0;
pgd = (pgd_t *)page_address(root) + pgd_index(va);
if (!pgd_present(*pgd))
set_pgd(pgd, __pgd(pa_page(pages[k++]) | _KERNPG_TABLE));
pud = pud_offset(pgd, va);
if (!pud_present(*pud))
set_pud(pud, __pud(pa_page(pages[k++]) | _KERNPG_TABLE));
pmd = pmd_offset(pud, va);
if (!pmd_present(*pmd))
set_pmd(pmd, __pmd(pa_page(pages[k++]) | _KERNPG_TABLE));
pte = (pte_t *)page_address(pmd_page(*pmd)) + pte_index(va);
set_pte(pte, __pte(pa | _PAGE_KERNEL_EXEC));
return k;
}
Any comments?
/ magnus
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-05-01 3:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-28 7:40 i386 and PAE: pud_present() Magnus Damm
2006-04-28 7:54 ` Nick Piggin
2006-04-28 8:27 ` Andi Kleen
2006-04-30 6:07 ` Dave McCracken
2006-04-30 8:53 ` Andi Kleen
[not found] ` <2432524299CCD3CA89BB647D@10.1.1.4>
2006-05-01 3:07 ` Magnus Damm
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).