From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tqphp-00024X-Jx for qemu-devel@nongnu.org; Thu, 03 Jan 2013 13:39:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tqphm-0002zr-08 for qemu-devel@nongnu.org; Thu, 03 Jan 2013 13:39:53 -0500 Received: from dns1.mips.com ([12.201.5.69]:35040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tqphl-0002yu-NJ for qemu-devel@nongnu.org; Thu, 03 Jan 2013 13:39:49 -0500 Message-ID: <50E5D04E.8010107@mips.com> Date: Thu, 3 Jan 2013 10:39:10 -0800 From: Eric Johnson MIME-Version: 1.0 References: <1357219038-841-1-git-send-email-agraf@suse.de> <7A6BA085-93BA-407E-AAE9-58247D779A2C@suse.de> In-Reply-To: <7A6BA085-93BA-407E-AAE9-58247D779A2C@suse.de> Content-Type: multipart/alternative; boundary="------------080002050803040706020205" Subject: Re: [Qemu-devel] [PATCH] linux-user: fix mips 32-on-64 prealloc case List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Peter Maydell , Riku Voipio , Michael Tokarev , qemu-devel qemu-devel , Aurelien Jarno --------------080002050803040706020205 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit 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 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 Go to section 1.2.7.5 Enhanced Virtual Address Eric --------------080002050803040706020205 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit 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™ Multiprocessing System Software User's Manual

Go to section
1.2.7.5 Enhanced Virtual Address

Eric
--------------080002050803040706020205--