From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=49837 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGqPr-0007Hs-Si for qemu-devel@nongnu.org; Tue, 25 May 2010 05:27:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OGqPq-0001EL-FW for qemu-devel@nongnu.org; Tue, 25 May 2010 05:27:15 -0400 Received: from miranda.se.axis.com ([193.13.178.8]:47634) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGqPq-0001Ds-6R for qemu-devel@nongnu.org; Tue, 25 May 2010 05:27:14 -0400 Date: Tue, 25 May 2010 11:19:11 +0200 From: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] linux-user mmap bug Message-ID: <20100525091911.GA23403@edde.se.axis.com> References: <20100521132817.GA8021@edde.se.axis.com> <4BF6B6F9.3070802@twiddle.net> <4BF6C548.2070400@twiddle.net> <20100524145752.GA15283@edde.se.axis.com> <4BFA9F1B.50301@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BFA9F1B.50301@twiddle.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org On Mon, May 24, 2010 at 08:45:31AM -0700, Richard Henderson wrote: > 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. Ye, what puzzled me was that if I am not completely senile, CRIS apps used to emulate on my x86_64 host not so long ago :) > > 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. MAP_32BIT sounds good as long as guest_base is not used. When used I guess we'd need to fallback to something else anyway.. Maybe these issues are something too look more at during the bug day? :) In the meantime, I've patched the cris git to use the MAP_32BIT and to fallback to a super ugly and slow linear scan.. Thanks again for the help, Cheers > See > http://www.mail-archive.com/qemu-devel@nongnu.org/msg28924.html > for more ideas on the subject. > > > > r~