From: Paul Brook <paul@codesourcery.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Riku Voipio <riku.voipio@iki.fi>,
Richard Henderson <rth@twiddle.net>,
"dvaleev@suse.com" <dvaleev@suse.com>,
Alexander Graf <agraf@suse.de>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] PPC: Fix linker scripts on ppc hosts
Date: Wed, 14 Dec 2011 17:34:08 +0000 [thread overview]
Message-ID: <201112141734.09301.paul@codesourcery.com> (raw)
In-Reply-To: <CAFEAcA-RsxJyHMdZ8B4qC_dLGOtfmgT3Ju4t3uM5v7QhuKuiEg@mail.gmail.com>
> >> The proper solution would be to rewrite mmap.c to be smarter (perhaps
> >> by looking at /proc/self/maps and reserving a lot of space with
> >> PROT_NONE mappings at startup and then managing it itself), but so far
> >> nobody's done that
> >
> > Yes they have. That's what -R does.
>
> -R doesn't happen by default, it requires you to specify how much you
> want, and it insists that the space all be in one chunk.
I've covered the defaults elsewhere in this thread.
If your 64-bit host can't find a contiguous 4G block of address space then
you've much more serious issues. System policies preventing applications
allocating that much address space are a different problem, and splitting the
into chunks would not help.
> > We used to try and parse /proc/self/maps. This caused more problems than
> > it solved. It doesn't cover things like mmap_min_addr, and you have to
> > re-parse it before every allocation in case the host libc allocated
> > something new in between.
>
> If you've used a PROT_NONE mapping to claim the space at startup, host libc
> doesn't override that mapping, does it?
Ah, I see what you mean.
If you're solving problems other than 32-on-64 then there's some argument for
allowing discontiguous blocks. I'm not convinced there's much point parsing
/proc/self/maps though. Just keep calling mmap for sensible sized blocks
until you either have enough address space or it fails. In the latter case
maybe free some back immediately to give the host libc room to work.
The hard bit is coming up with heuristics for "sensibe size block" and "have
enough". /proc/self/maps only tells you which areas of the host VM are
currently mapped. What we really want to know is which areas are available to
be mapped. On 32-bit hosts this may be this may be less than half of the gaps
in /proc/self/maps. On 64-bit hosts it's many orders of magnitude smaller.
For example x86-64 only has 47-bits of usable virtual address space.
Nested qemu is also going to make a complete mess of /proc/self/maps, though I
admit you're probably going to trip over other bugs first :-)
Paul
next prev parent reply other threads:[~2011-12-14 17:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-12 21:36 [Qemu-devel] [PATCH] PPC: Fix linker scripts on ppc hosts Alexander Graf
2011-12-13 0:55 ` Richard Henderson
2011-12-13 1:05 ` Alexander Graf
2011-12-13 6:19 ` Paul Brook
2011-12-13 7:45 ` Alexander Graf
2011-12-13 16:31 ` Paul Brook
2011-12-13 21:59 ` Alexander Graf
2011-12-14 0:30 ` Paul Brook
2011-12-14 1:43 ` Alexander Graf
2011-12-14 2:24 ` Paul Brook
2011-12-20 16:17 ` Peter Maydell
2011-12-20 16:29 ` Alexander Graf
2011-12-20 16:33 ` Peter Maydell
2011-12-20 16:43 ` Alexander Graf
2011-12-14 8:53 ` Peter Maydell
2011-12-14 12:04 ` Paul Brook
2011-12-14 12:21 ` Peter Maydell
2011-12-14 17:34 ` Paul Brook [this message]
2011-12-13 8:13 ` Peter Maydell
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=201112141734.09301.paul@codesourcery.com \
--to=paul@codesourcery.com \
--cc=agraf@suse.de \
--cc=dvaleev@suse.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
--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).