From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=35441 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCe39-0003Fi-Am for qemu-devel@nongnu.org; Thu, 13 May 2010 15:26:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OCe37-0003Pe-KT for qemu-devel@nongnu.org; Thu, 13 May 2010 15:26:27 -0400 Received: from mail-fx0-f45.google.com ([209.85.161.45]:53470) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCe37-0003PV-FY for qemu-devel@nongnu.org; Thu, 13 May 2010 15:26:25 -0400 Received: by fxm9 with SMTP id 9so543593fxm.4 for ; Thu, 13 May 2010 12:26:24 -0700 (PDT) Date: Thu, 13 May 2010 21:26:26 +0200 From: Martin Jansa Subject: Re: [Qemu-devel] [PATCH] linux-user: use default mmap_min_addr 65536 when /proc/sys/vm/mmap_min_addr cannot be read Message-ID: <20100513192626.GO3370@jama> References: <1273756645-11149-1-git-send-email-Martin.Jansa@gmail.com> <4BEC2FEC.6070900@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BEC2FEC.6070900@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 Thu, May 13, 2010 at 09:59:24AM -0700, Richard Henderson wrote: > On 05/13/2010 06:17 AM, Martin Jansa wrote: > > @@ -2899,8 +2900,14 @@ int main(int argc, char **argv, char **envp) > > if (fscanf(fp, "%lu", &tmp) == 1) { > > mmap_min_addr = tmp; > > qemu_log("host mmap_min_addr=0x%lx\n", mmap_min_addr); > > + } else { > > + qemu_log("cannot read value from /proc/sys/vm/mmap_min_addr, assuming %d\n", MMAP_MIN_ADDR_DEFAULT); > > + mmap_min_addr = MMAP_MIN_ADDR_DEFAULT; > > } > > fclose(fp); > > + } else { > > + qemu_log("cannot open /proc/sys/vm/mmap_min_addr for reading, assuming %d\n", MMAP_MIN_ADDR_DEFAULT); > > + mmap_min_addr = MMAP_MIN_ADDR_DEFAULT; > > } > > } > > Perhaps you can combine these two else clauses? Sure it would be possible, but while trying to find why qemu doesn't work on someone box but works on mine I wanted to distinguish between cannot open and cannot read. Also if I combine it in test ie initialize mmap_min_addr with -1, and then check if it changed after read (because 0 is also valid value), or moving fopen and fscanf to one condition, then it gets IMHO as complicated as those 2 else clauses. BTW: I noticed that qemu-arm works ok when mmap_min_addr is low enough (and doesn't have to be zero). my box had mmap_min_addr 4096 and qemu-arm worked fine even without reading it and the other boxes had mmap_min_addr = 64K and failed later to mmap. Regards, -- uin:136542059 jid:Martin.Jansa@gmail.com Jansa Martin sip:jamasip@voip.wengo.fr JaMa