qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user: fix mips 32-on-64 prealloc case
@ 2013-01-03 13:17 Alexander Graf
  2013-01-03 17:19 ` Peter Maydell
  2013-01-08 15:45 ` Aurelien Jarno
  0 siblings, 2 replies; 7+ messages in thread
From: Alexander Graf @ 2013-01-03 13:17 UTC (permalink / raw)
  To: qemu-devel qemu-devel; +Cc: Riku Voipio, Michael Tokarev, Aurelien Jarno

MIPS only supports 31 bits of virtual address space for user space, so let's
make sure we stay within that limit with our preallocated memory block.

This fixes the MIPS user space targets when executed without command line
option.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 linux-user/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/linux-user/main.c b/linux-user/main.c
index c4d10ac..a2bc09d 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -57,7 +57,12 @@ int have_guest_base;
  * This way we will never overlap with our own libraries or binaries or stack
  * or anything else that QEMU maps.
  */
+# ifdef TARGET_MIPS
+/* MIPS only supports 31 bits of virtual address space for user space */
+unsigned long reserved_va = 0x77000000;
+# else
 unsigned long reserved_va = 0xf7000000;
+# endif
 #else
 unsigned long reserved_va;
 #endif
-- 
1.7.12.4

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

* Re: [Qemu-devel] [PATCH] linux-user: fix mips 32-on-64 prealloc case
  2013-01-03 13:17 [Qemu-devel] [PATCH] linux-user: fix mips 32-on-64 prealloc case Alexander Graf
@ 2013-01-03 17:19 ` Peter Maydell
  2013-01-03 17:24   ` Alexander Graf
  2013-01-08 15:45 ` Aurelien Jarno
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2013-01-03 17:19 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Riku Voipio, Michael Tokarev, qemu-devel qemu-devel,
	Aurelien Jarno

On 3 January 2013 13:17, Alexander Graf <agraf@suse.de> wrote:
> MIPS only supports 31 bits of virtual address space for user space, so let's
> make sure we stay within that limit with our preallocated memory block.
>
> This fixes the MIPS user space targets when executed without command line
> option.

This looks weird -- why should the guest care that we've reserved a
4GB block which it only uses half of? Or is the problem that host
mmap() ends up handing out addresses from anywhere in the 4GB
reserved area?

-- PMM

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

* Re: [Qemu-devel] [PATCH] linux-user: fix mips 32-on-64 prealloc case
  2013-01-03 17:19 ` Peter Maydell
@ 2013-01-03 17:24   ` Alexander Graf
  2013-01-03 18:39     ` Eric Johnson
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Graf @ 2013-01-03 17:24 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Riku Voipio, Michael Tokarev, qemu-devel qemu-devel,
	Aurelien Jarno


On 03.01.2013, at 18:19, Peter Maydell wrote:

> On 3 January 2013 13:17, Alexander Graf <agraf@suse.de> wrote:
>> MIPS only supports 31 bits of virtual address space for user space, so let's
>> make sure we stay within that limit with our preallocated memory block.
>> 
>> This fixes the MIPS user space targets when executed without command line
>> option.
> 
> This looks weird -- why should the guest care that we've reserved a
> 4GB block which it only uses half of? Or is the problem that host
> mmap() ends up handing out addresses from anywhere in the 4GB
> reserved area?

Even worse, it starts from the top IIRC.

MIPS uses the upper virtual address bit for kernel/user space indication. I'm not sure where exactly this logic falls apart in our case, but user space virtual addresses above 2GB are simple illegal in that world, so I wouldn't expect QEMU or a guest process to cope with them.


Alex

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

* Re: [Qemu-devel] [PATCH] linux-user: fix mips 32-on-64 prealloc case
  2013-01-03 17:24   ` Alexander Graf
@ 2013-01-03 18:39     ` Eric Johnson
  2013-01-03 18:50       ` Richard Henderson
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Johnson @ 2013-01-03 18:39 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Peter Maydell, Riku Voipio, Michael Tokarev,
	qemu-devel qemu-devel, Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 1560 bytes --]

On 01/03/2013 09:24 AM, Alexander Graf wrote:
> On 03.01.2013, at 18:19, Peter Maydell wrote:
>
>> On 3 January 2013 13:17, Alexander Graf<agraf@suse.de>  wrote:
>>> MIPS only supports 31 bits of virtual address space for user space, so let's
>>> make sure we stay within that limit with our preallocated memory block.
>>>
>>> This fixes the MIPS user space targets when executed without command line
>>> option.
>> This looks weird -- why should the guest care that we've reserved a
>> 4GB block which it only uses half of? Or is the problem that host
>> mmap() ends up handing out addresses from anywhere in the 4GB
>> reserved area?
> Even worse, it starts from the top IIRC.
>
> MIPS uses the upper virtual address bit for kernel/user space indication. I'm not sure where exactly this logic falls apart in our case, but user space virtual addresses above 2GB are simple illegal in that world, so I wouldn't expect QEMU or a guest process to cope with them.
>
>
> Alex
>
>

While making this change please keep in mind that newer MIPS32 
processors allow more than 31 bits of user address space (up to 3.5 GiB) 
if they have Enhanced Virtual Address support.  For example see the 
Software User's Manual for the interAptiv processors:

At the bottom of the page
http://www.mips.com/products/processor-cores/aptiv/interaptiv/
is the link
interAptiv^(TM) Multiprocessing System Software User's Manual 
<http://www.mips.com/secure-download/index.dot?product_name=/auth/MD00904-2B-interAptiv-SUM-01.04.pdf>

Go to section
1.2.7.5 Enhanced Virtual Address

Eric

[-- Attachment #2: Type: text/html, Size: 2428 bytes --]

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

* Re: [Qemu-devel] [PATCH] linux-user: fix mips 32-on-64 prealloc case
  2013-01-03 18:39     ` Eric Johnson
@ 2013-01-03 18:50       ` Richard Henderson
  2013-01-03 19:09         ` Eric Johnson
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2013-01-03 18:50 UTC (permalink / raw)
  To: Eric Johnson
  Cc: Peter Maydell, Riku Voipio, Michael Tokarev, Alexander Graf,
	qemu-devel qemu-devel, Aurelien Jarno

On 01/03/2013 10:39 AM, Eric Johnson wrote:
> While making this change please keep in mind that newer MIPS32
> processors allow more than 31 bits of user address space (up to 3.5
> GiB) if they have Enhanced Virtual Address support.

Interesting.

Well, would you be able to help figure out exactly what's going on in:

  http://lists.gnu.org/archive/html/qemu-devel/2012-12/msg03233.html

and the thread leading up to it?

Now, I don't *know* that this is an emulation failure -- the linux-user-test
binary certainly isn't aware of enhanced virtual addresses.  So it's
possible that (older?) binaries can't cope with more than 2GB.

Alternately, it really is a translation problem somewhere...


r~

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

* Re: [Qemu-devel] [PATCH] linux-user: fix mips 32-on-64 prealloc case
  2013-01-03 18:50       ` Richard Henderson
@ 2013-01-03 19:09         ` Eric Johnson
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Johnson @ 2013-01-03 19:09 UTC (permalink / raw)
  To: Richard Henderson
  Cc: Peter Maydell, Riku Voipio, Michael Tokarev, Alexander Graf,
	qemu-devel qemu-devel, Aurelien Jarno

On 01/03/2013 10:50 AM, Richard Henderson wrote:
> On 01/03/2013 10:39 AM, Eric Johnson wrote:
>> While making this change please keep in mind that newer MIPS32
>> processors allow more than 31 bits of user address space (up to 3.5
>> GiB) if they have Enhanced Virtual Address support.
> Interesting.
>
> Well, would you be able to help figure out exactly what's going on in:
>
>    http://lists.gnu.org/archive/html/qemu-devel/2012-12/msg03233.html
>
> and the thread leading up to it?
>
> Now, I don't *know* that this is an emulation failure -- the linux-user-test
> binary certainly isn't aware of enhanced virtual addresses.  So it's
> possible that (older?) binaries can't cope with more than 2GB.
>
> Alternately, it really is a translation problem somewhere...
>
>
> r~

That is correct.  The current test and MIPS32 processors supported by 
QEMU do not support more than 2 GiB of user space.  I didn't mean to 
imply otherwise.

Looking at the MIPS32 processor linux-user on a 64-bit host issue is 
already on my long list of tasks.  Sorry I have not been able to look at 
it yet.

On second thought ignore my EVA comment for now.  We'll worry about that 
when implementing EVA.

Eric

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

* Re: [Qemu-devel] [PATCH] linux-user: fix mips 32-on-64 prealloc case
  2013-01-03 13:17 [Qemu-devel] [PATCH] linux-user: fix mips 32-on-64 prealloc case Alexander Graf
  2013-01-03 17:19 ` Peter Maydell
@ 2013-01-08 15:45 ` Aurelien Jarno
  1 sibling, 0 replies; 7+ messages in thread
From: Aurelien Jarno @ 2013-01-08 15:45 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Riku Voipio, Michael Tokarev, qemu-devel qemu-devel

On Thu, Jan 03, 2013 at 02:17:18PM +0100, Alexander Graf wrote:
> MIPS only supports 31 bits of virtual address space for user space, so let's
> make sure we stay within that limit with our preallocated memory block.
> 
> This fixes the MIPS user space targets when executed without command line
> option.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  linux-user/main.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/linux-user/main.c b/linux-user/main.c
> index c4d10ac..a2bc09d 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -57,7 +57,12 @@ int have_guest_base;
>   * This way we will never overlap with our own libraries or binaries or stack
>   * or anything else that QEMU maps.
>   */
> +# ifdef TARGET_MIPS
> +/* MIPS only supports 31 bits of virtual address space for user space */
> +unsigned long reserved_va = 0x77000000;
> +# else
>  unsigned long reserved_va = 0xf7000000;
> +# endif
>  #else
>  unsigned long reserved_va;
>  #endif

Thanks, applied.


-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

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

end of thread, other threads:[~2013-01-08 15:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-03 13:17 [Qemu-devel] [PATCH] linux-user: fix mips 32-on-64 prealloc case Alexander Graf
2013-01-03 17:19 ` Peter Maydell
2013-01-03 17:24   ` Alexander Graf
2013-01-03 18:39     ` Eric Johnson
2013-01-03 18:50       ` Richard Henderson
2013-01-03 19:09         ` Eric Johnson
2013-01-08 15:45 ` Aurelien Jarno

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