[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 0/6] Multi-level page tables and userland mapping fi

From: Richard Henderson
Subject: [Qemu-devel] [PATCH 0/6] Multi-level page tables and userland mapping fixes.
Date: Thu, 11 Feb 2010 16:15:56 -0800

I have previously posted a variant of part 6, to address the problem
of the host returning mmap results that are not page aligned for the
guest.  That, however, led me to the fact that we could also return
addresses that are outside the guest's virtual address space.

Which raises the question of what *is* the guest's virtual address
space?  For a 32-bit guest, clearly we cannot return anything outside
GUEST_BASE through GUEST_BASE+4G.  For a 64-bit guest, the question
is less clear.  One thing is certain: the guest's virtual address space
had better not be anything outside what page_find can support.

Which brings us to the problem of exec.c and the address spaces therein.
First, there was the fact that TARGET_PHYS_ADDR_SPACE_BITS was constrained
to be no larger than 32 (with a partial hack for Alpha to extend this to
42 bits).  Second, that this physical address space value was applied to
virtual addresses via page_find.

This patch series untangles this somewhat.

First, define separate physical and virtual address spaces for each cpu.
This allows the page tables used to be no deeper than necessary in order 
to support what the native hardware does.  E.g. 3 level page tables for
Alpha's 43-bit virtual address space, rather than the 5 levels required
for a full 64-bit space.  I've looked up proper values for x86_64 and 
ppc64; I couldn't find the correct values for mips64 and sparc64, so I
guessed.  Certainly the guess is no worse than what is supported by
the current exec.c values.

Second, implement the multi-level search within exec.c.  The form of
this multi-level search is taken from Tristan Gingold's es40 patches.
However, he only addressed the physical address space and ignored the
virtual; this patch handles both.  I tried to arrange things as 
readably as possible here; getting too clever here is a sure-fire
recipe for confusion.

Third, re-apply the mmap address fixes.  This time, as promised, with
a clear division between host and guest address space -- the last 
variant that I posted could return addresses below GUEST_BASE.


Richard Henderson (6):
  Move TARGET_PHYS_ADDR_SPACE_BITS to target-*/cpu.h.
  Fix last page errors in page_set_flags and page_check_range.
  Implement multi-level page tables.
  linux-user: Use h2g_valid in qemu_vmalloc.
  linux-user: Fix mmap_find_vma returning invalid addresses.

 cpu-all.h               |   23 ++-
 exec.c                  |  513 +++++++++++++++++++++++++++--------------------
 linux-user/main.c       |    7 +-
 linux-user/mmap.c       |  111 ++++++++---
 target-alpha/cpu.h      |    4 +-
 target-arm/cpu.h        |    3 +
 target-cris/cpu.h       |    3 +
 target-i386/cpu.h       |   11 +
 target-m68k/cpu.h       |    3 +
 target-microblaze/cpu.h |    3 +
 target-mips/mips-defs.h |    4 +
 target-ppc/cpu.h        |   17 ++
 target-s390x/cpu.h      |    5 +
 target-sh4/cpu.h        |    3 +
 target-sparc/cpu.h      |    8 +
 15 files changed, 456 insertions(+), 262 deletions(-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]