From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=48837 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGZqS-0006AY-Al for qemu-devel@nongnu.org; Mon, 24 May 2010 11:45:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OGZqQ-0003we-3K for qemu-devel@nongnu.org; Mon, 24 May 2010 11:45:36 -0400 Received: from are.twiddle.net ([75.149.56.221]:57438) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGZqP-0003wW-U0 for qemu-devel@nongnu.org; Mon, 24 May 2010 11:45:34 -0400 Message-ID: <4BFA9F1B.50301@twiddle.net> Date: Mon, 24 May 2010 08:45:31 -0700 From: Richard Henderson MIME-Version: 1.0 Subject: Re: [Qemu-devel] linux-user mmap bug References: <20100521132817.GA8021@edde.se.axis.com> <4BF6B6F9.3070802@twiddle.net> <4BF6C548.2070400@twiddle.net> <20100524145752.GA15283@edde.se.axis.com> In-Reply-To: <20100524145752.GA15283@edde.se.axis.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Edgar E. Iglesias" Cc: qemu-devel@nongnu.org On 05/24/2010 07:57 AM, Edgar E. Iglesias wrote: > I took a look at the code again and I dont really understand how the > particular case when we get a high address from the kernel while > mmap_min_addr is busy case is supposed to work :/ > In fact, for CRIS it never works on my host. Indeed, there are many cases for which it doesn't work for the Alpha target either. > I changed it locally to keep scanning after a wrap until we succeed to > allocate a chunk or rewrap (SLOW) but at least I can run dynamically > linked CRIS programs again. Yep. My hack had been similar, except that I used the PageDesc tree to help speed things up. But PageDesc is hardly an ideal data structure in which to search, since it quickly devolves into a linear search of the address space. Probably the easiest real fix is to re-read /proc/self/maps each time the mmap_next_start guess fails and the kernel's returned address is out of range. Another is using the MMAP_32BIT flag on x86-64 host whenever a 31-bit address is appropriate for the guest. E.g. mips32, where architecturally the high half of the address space is reserved for kernel mode. See http://www.mail-archive.com/qemu-devel@nongnu.org/msg28924.html for more ideas on the subject. r~