2008-10-22 23:26:29 -06:00
|
|
|
#ifndef _ASM_X86_PGTABLE_3LEVEL_DEFS_H
|
|
|
|
#define _ASM_X86_PGTABLE_3LEVEL_DEFS_H
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2009-02-11 11:20:05 -07:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
typedef u64 pteval_t;
|
|
|
|
typedef u64 pmdval_t;
|
|
|
|
typedef u64 pudval_t;
|
|
|
|
typedef u64 pgdval_t;
|
|
|
|
typedef u64 pgprotval_t;
|
|
|
|
|
|
|
|
typedef union {
|
|
|
|
struct {
|
|
|
|
unsigned long pte_low, pte_high;
|
|
|
|
};
|
|
|
|
pteval_t pte;
|
|
|
|
} pte_t;
|
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
|
[PATCH] i386: PARAVIRT: Allow paravirt backend to choose kernel PMD sharing
Normally when running in PAE mode, the 4th PMD maps the kernel address space,
which can be shared among all processes (since they all need the same kernel
mappings).
Xen, however, does not allow guests to have the kernel pmd shared between page
tables, so parameterize pgtable.c to allow both modes of operation.
There are several side-effects of this. One is that vmalloc will update the
kernel address space mappings, and those updates need to be propagated into
all processes if the kernel mappings are not intrinsically shared. In the
non-PAE case, this is done by maintaining a pgd_list of all processes; this
list is used when all process pagetables must be updated. pgd_list is
threaded via otherwise unused entries in the page structure for the pgd, which
means that the pgd must be page-sized for this to work.
Normally the PAE pgd is only 4x64 byte entries large, but Xen requires the PAE
pgd to page aligned anyway, so this patch forces the pgd to be page
aligned+sized when the kernel pmd is unshared, to accomodate both these
requirements.
Also, since there may be several distinct kernel pmds (if the user/kernel
split is below 3G), there's no point in allocating them from a slab cache;
they're just allocated with get_free_page and initialized appropriately. (Of
course the could be cached if there is just a single kernel pmd - which is the
default with a 3G user/kernel split - but it doesn't seem worthwhile to add
yet another case into this code).
[ Many thanks to wli for review comments. ]
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: William Lee Irwin III <wli@holomorphy.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Zachary Amsden <zach@vmware.com>
Cc: Christoph Lameter <clameter@sgi.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2007-05-02 11:27:13 -06:00
|
|
|
#ifdef CONFIG_PARAVIRT
|
2007-10-16 12:51:29 -06:00
|
|
|
#define SHARED_KERNEL_PMD (pv_info.shared_kernel_pmd)
|
[PATCH] i386: PARAVIRT: Allow paravirt backend to choose kernel PMD sharing
Normally when running in PAE mode, the 4th PMD maps the kernel address space,
which can be shared among all processes (since they all need the same kernel
mappings).
Xen, however, does not allow guests to have the kernel pmd shared between page
tables, so parameterize pgtable.c to allow both modes of operation.
There are several side-effects of this. One is that vmalloc will update the
kernel address space mappings, and those updates need to be propagated into
all processes if the kernel mappings are not intrinsically shared. In the
non-PAE case, this is done by maintaining a pgd_list of all processes; this
list is used when all process pagetables must be updated. pgd_list is
threaded via otherwise unused entries in the page structure for the pgd, which
means that the pgd must be page-sized for this to work.
Normally the PAE pgd is only 4x64 byte entries large, but Xen requires the PAE
pgd to page aligned anyway, so this patch forces the pgd to be page
aligned+sized when the kernel pmd is unshared, to accomodate both these
requirements.
Also, since there may be several distinct kernel pmds (if the user/kernel
split is below 3G), there's no point in allocating them from a slab cache;
they're just allocated with get_free_page and initialized appropriately. (Of
course the could be cached if there is just a single kernel pmd - which is the
default with a 3G user/kernel split - but it doesn't seem worthwhile to add
yet another case into this code).
[ Many thanks to wli for review comments. ]
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: William Lee Irwin III <wli@holomorphy.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Zachary Amsden <zach@vmware.com>
Cc: Christoph Lameter <clameter@sgi.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2007-05-02 11:27:13 -06:00
|
|
|
#else
|
|
|
|
#define SHARED_KERNEL_PMD 1
|
|
|
|
#endif
|
|
|
|
|
2009-02-13 12:01:54 -07:00
|
|
|
#define PAGETABLE_LEVELS 3
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
/*
|
|
|
|
* PGDIR_SHIFT determines what a top-level page table entry can map
|
|
|
|
*/
|
|
|
|
#define PGDIR_SHIFT 30
|
|
|
|
#define PTRS_PER_PGD 4
|
|
|
|
|
|
|
|
/*
|
|
|
|
* PMD_SHIFT determines the size of the area a middle-level
|
|
|
|
* page table can map
|
|
|
|
*/
|
|
|
|
#define PMD_SHIFT 21
|
|
|
|
#define PTRS_PER_PMD 512
|
|
|
|
|
|
|
|
/*
|
|
|
|
* entries per page directory level
|
|
|
|
*/
|
|
|
|
#define PTRS_PER_PTE 512
|
|
|
|
|
2009-02-11 11:20:05 -07:00
|
|
|
|
2008-10-22 23:26:29 -06:00
|
|
|
#endif /* _ASM_X86_PGTABLE_3LEVEL_DEFS_H */
|