qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Cc: Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [RFC] Host vs Guest memory allocation
Date: Mon, 12 Apr 2010 12:25:17 +0100	[thread overview]
Message-ID: <201004121225.18070.paul@codesourcery.com> (raw)
In-Reply-To: <4BBA6803.3000008@twiddle.net>

> The Problem:
> 
> CONFIG_USER_ONLY kinda sorta tries to manage the distinction between
> qemu memory and guest memory. This can be seen in the PAGE_RESERVED
> frobbing and qemu_malloc etc. However, it doesn't handle random malloc
> calls eg from libc itself or other libraries in use.
> 
> Possible solutions:
> 
> There are several possible solutions as I see it, each depending on the
> pairing of host and guest address space characteristics:
> 
> (0) Do nothing.  That is, don't even pretend to record host memory and
>     validate guest access that may or may not overlap.  To my mind this
>     is in fact an improvement over the kinda-sorta solution we have now.

This is effectively what we do now, the PAGE_RESERVED bits aren't used for 
anything interesting.  Any guest application that makes assumptions about 
address space availability (i.e. maps at hardcoded addresses) is already 
likely to be broken on many native kernels. target_mmap is implemented via 
host mmap, so this should just work.
The only time we have a fixed guest address is loading non-pic applications. 
This is known at startup, so can be fixed by setting guest_base appropriately. 
I have partial patches to fix this.
 
> (1) Enable softmmu for userland. This is of course the highest overhead,
>     but will work for all combinations.

This has a significant performance hit, and gets very tricky for things like 
mmaped files.

> (2) Pre-allocate the entire guest address space in the host.  With
>     Linux mmap w/ MAP_NORESERVE or Windows VirtualAlloc w/ MEM_RESERVE
>     and a possibly reduced guest address space this is doesn't seem so bad.

This breaks if the host sets ulimit -v.
 
Paul

  parent reply	other threads:[~2010-04-12 11:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-05 22:45 [Qemu-devel] [RFC] Host vs Guest memory allocation Richard Henderson
2010-04-05 23:18 ` Aurelien Jarno
2010-04-12 11:48   ` Avi Kivity
2010-04-12 14:55     ` Richard Henderson
2010-04-12 15:09       ` Avi Kivity
2010-04-12 15:39         ` Alexander Graf
2010-04-12 15:49           ` Avi Kivity
2010-04-12 15:56             ` Alexander Graf
2010-04-12 16:08               ` Avi Kivity
2010-04-12 11:25 ` Paul Brook [this message]
2010-04-12 14:48   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201004121225.18070.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).