Skip to content

Commit

Permalink
xen: convert p2m to a 3 level tree
Browse files Browse the repository at this point in the history
Make the p2m structure a 3 level tree which covers the full possible
physical space.

The p2m structure contains mappings from the domain's pfns to system-wide
mfns.  The structure has 3 levels and two roots.  The first root is for
the domain's own use, and is linked with virtual addresses.  The second
is all mfn references, and is used by Xen on save/restore to allow it to
update the p2m mapping for the domain.

At boot, the domain builder provides a simple flat p2m array for all the
initially present pages.  We construct the two levels above that using
the early_brk allocator.  After early boot time, set_phys_to_machine()
will allocate any missing levels using the normal kernel allocator
(at GFP_KERNEL, so it must be called in a normal blocking context).

Because the early_brk() API requires us to pre-reserve the maximum amount
of memory we could allocate, there is still a CONFIG_XEN_MAX_DOMAIN_MEMORY
config option, but its only negative side-effect is to increase the
kernel's apparent bss size.  However, since all unused brk memory is
returned to the heap, there's no real downside to making it large.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
  • Loading branch information
Jeremy Fitzhardinge committed Oct 22, 2010
1 parent bbbf61e commit 58e0502
Show file tree
Hide file tree
Showing 2 changed files with 246 additions and 83 deletions.
11 changes: 4 additions & 7 deletions arch/x86/xen/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ config XEN_PVHVM
depends on X86_LOCAL_APIC

config XEN_MAX_DOMAIN_MEMORY
int "Maximum allowed size of a domain in gigabytes"
default 8 if X86_32
default 32 if X86_64
int
default 128
depends on XEN
help
The pseudo-physical to machine address array is sized
according to the maximum possible memory size of a Xen
domain. This array uses 1 page per gigabyte, so there's no
need to be too stingy here.
This only affects the sizing of some bss arrays, the unused
portions of which are freed.

config XEN_SAVE_RESTORE
bool
Expand Down
Loading

0 comments on commit 58e0502

Please sign in to comment.