qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/6] Multi-level page tables and userland mapping fixes, v3
@ 2010-03-10 23:59 Richard Henderson
  2010-03-10 22:33 ` [Qemu-devel] [PATCH 1/6] Move TARGET_PHYS_ADDR_SPACE_BITS to target-*/cpu.h Richard Henderson
                   ` (6 more replies)
  0 siblings, 7 replies; 26+ messages in thread
From: Richard Henderson @ 2010-03-10 23:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: paul

Changes since v2:
  * Fix two errors pointed out by pbrook: l1_map size in system mode,
    and h2g_valid definition for 64-on-32-bit.
  * Assertions that addresses are not outside the bounds of the 
    guest address space.
  * Re-base vs master, after l1_map_phys changes.


r~


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

 cpu-all.h               |   23 ++-
 exec.c                  |  522 ++++++++++++++++++++++++++++-------------------
 linux-user/main.c       |   11 +-
 linux-user/mmap.c       |  111 ++++++++---
 linux-user/qemu.h       |    2 -
 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 +
 16 files changed, 474 insertions(+), 259 deletions(-)

^ permalink raw reply	[flat|nested] 26+ messages in thread
* [Qemu-devel] [PATCH 0/6] Multi-level page tables and userland mapping fixes.
@ 2010-02-12  0:15 Richard Henderson
  2010-02-11 22:20 ` [Qemu-devel] [PATCH 1/6] Move TARGET_PHYS_ADDR_SPACE_BITS to target-*/cpu.h Richard Henderson
  0 siblings, 1 reply; 26+ messages in thread
From: Richard Henderson @ 2010-02-12  0:15 UTC (permalink / raw)
  To: qemu-devel

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.



r~

Richard Henderson (6):
  Move TARGET_PHYS_ADDR_SPACE_BITS to target-*/cpu.h.
  Use TARGET_VIRT_ADDR_SPACE_BITS in h2g_valid.
  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(-)

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2010-03-17 14:32 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-10 23:59 [Qemu-devel] [PATCH 0/6] Multi-level page tables and userland mapping fixes, v3 Richard Henderson
2010-03-10 22:33 ` [Qemu-devel] [PATCH 1/6] Move TARGET_PHYS_ADDR_SPACE_BITS to target-*/cpu.h Richard Henderson
2010-03-11 11:11   ` Aurelien Jarno
2010-03-11 15:19     ` Richard Henderson
2010-03-10 22:36 ` [Qemu-devel] [PATCH 2/6] Use TARGET_VIRT_ADDR_SPACE_BITS in h2g_valid Richard Henderson
2010-03-10 22:38 ` [Qemu-devel] [PATCH 3/6] linux-user: Use h2g_valid in qemu_vmalloc Richard Henderson
2010-03-10 23:39 ` [Qemu-devel] [PATCH 4/6] linux-user: Fix mmap_find_vma returning invalid addresses Richard Henderson
2010-03-10 23:53 ` [Qemu-devel] [PATCH 5/6] Implement multi-level page tables Richard Henderson
2010-03-13 22:48   ` Stefan Weil
2010-03-14 15:02     ` Paul Brook
2010-03-14 16:41       ` Aurelien Jarno
2010-03-10 23:57 ` [Qemu-devel] [PATCH 6/6] Fix last page errors in page_check_range and page_set_flags Richard Henderson
2010-03-12 18:51 ` [Qemu-devel] [PATCH 0/6] Multi-level page tables and userland mapping fixes, v3 Paul Brook
2010-03-12 19:26   ` Blue Swirl
2010-03-12 23:28     ` Paul Brook
2010-03-13 12:45   ` Aurelien Jarno
2010-03-13 14:00     ` Martin Mohring
2010-03-15  7:45       ` Riku Voipio
2010-03-15 12:46         ` Jan-Simon Möller
2010-03-15 14:48           ` Riku Voipio
2010-03-15 15:08             ` Jan-Simon Möller
2010-03-17 11:48               ` Riku Voipio
2010-03-17 14:32                 ` Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
2010-02-12  0:15 [Qemu-devel] [PATCH 0/6] Multi-level page tables and userland mapping fixes Richard Henderson
2010-02-11 22:20 ` [Qemu-devel] [PATCH 1/6] Move TARGET_PHYS_ADDR_SPACE_BITS to target-*/cpu.h Richard Henderson
2010-02-12 20:01   ` Blue Swirl
2010-02-12 20:25     ` Richard Henderson

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).