On 08/22/11 10:20, Amit Kulkarni wrote:
I am unable to start a qemu guest with more than 256M of memory, despite
having 4G in my system.  I get ENOMEM and qemu exits.  Using 256M or less
works just fine.

After some debugging, I see that qemu uses valloc(), which then uses
malloc() and that's preventing anything larger than 256M.

Out of curiosity, I wrote a simple test program that used valloc() to ask
for 256M.  Then I tried 512M, and got the failure I expected. Debugging
passed NKMEMPAGES in front of my eyes and I was curious what changing that
would have.  I built a kernel with:

    option NKMEMPAGES=131072

My test program was able to request 536678400 bytes and no more, short of
512M by 192512 bytes, or 47 pages on my system.

Despite that test, qemu still wouldn't have any of it and refused to start
guests with more than 256M.  I really am at a loss.  Anyone have any
suggestions?

I am back to running GENERIC.MP unmodified on OpenBSD 4.9.

I have tried qemu-13 with more than 1G memory just fine on amd64. So
this is a recent regression. what qemu version?

qemu is working fine for me now, though I think there is a problem in another port worth investigating. See below.

If you increase pagecache size using malloc.conf, does it allow you to
go higher? (man malloc.conf)

As recommended by the first two replies to my original message suggested, increase the data segment size. I tried that initially, but it never worked. So I started looking elsewhere for a solution. I skipped over a key thing I should have eliminated during debugging.

The problem appears to be in bash's ulimit builtin. My user account is in the default login class. I increased the datasize-max value, logged out, logged back in. When trying to increase ulimit -d, bash insisted it couldn't be done. I ran /bin/ksh and tried ulimit there and it worked. I was able to start up a qemu guest with 384M and another with 512M. Tried under root's account (which I keep /bin/ksh) and it worked fine. Go back to my account using bash and ulimit -d won't go up past the datasize-cur value.

I created a new login class for myself and set datasize=infinity:, rather than setting both a -cur and -max datasize value. Logging in with bash and checking ulimit -d reported unlimited. qemu fired up just fine. So it was the data segment size after all, the problem appears to be in bash's ulimit builtin.

Might be worth noting for people in qemu's MESSAGE. I use bash for my user account because at work we have standardized on bash across all platforms. It's just easier for me to have the same shell everywhere. Workarounds are easy, either make a change in /etc/login.conf similar to what described or don't use bash and expect ulimit to behave.

When I get some spare time, I want to dig in to bash and see why it's ulimit builtin is behaving incorrectly.

Thanks,

--
David Cantrell <david.l.cantr...@gmail.com>
WH6DSN | http://blog.burdell.org/

Reply via email to