From: "Daniel P. Berrange" <berrange-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Dave Hansen <haveblue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: Slow Kernel Boot
Date: Tue, 8 Jan 2008 19:26:30 +0000 [thread overview]
Message-ID: <20080108192630.GM21294@redhat.com> (raw)
In-Reply-To: <1199819588.9834.72.camel@localhost>
On Tue, Jan 08, 2008 at 11:13:08AM -0800, Dave Hansen wrote:
> On Tue, 2008-01-08 at 12:12 +0530, Amit Shah wrote:
> > > BIOS-provided physical RAM map:
> > > BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
> > > BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
> > > BIOS-e820: 00000000000e8000 - 0000000000100000 (reserved)
> > > BIOS-e820: 0000000000100000 - 00000000fffbd000 (usable)
> > > BIOS-e820: 00000000fffbd000 - 00000000ffff0000 (reserved)
> > >
> > > Note that this is with '-m 1G'!! It looks to me like one of those
> >
> > And there lies the problem. qemu doesn't understand suffixes like 'G'.
> > If you
> > pass -m 1024, you'll boot just fine.
> >
> > This is really annoying of qemu (it should either accept that input
> > properly
> > or bail out); a patch is welcome!
>
> OK. Here's a function stolen blatantly from the kernel. Seems to work
What license was this under originally ? The kernel is typically GPLv2,
while QEMU's core infrastructure is BSD (only some device emulation
is GPL). So not a good idea if you want this to go into upstream QEMU.
> --- orig/qemu-0.9.1/vl.c 2008-01-06 11:38:42.000000000 -0800
> +++ qemu-0.9.1/vl.c 2008-01-08 11:23:29.000000000 -0800
> @@ -8052,6 +8052,47 @@
> }
> #endif
>
> +/**
> + * memparse - parse a string with mem suffixes into a number of bytes
> + * @ptr: Where parse begins
> + *
> + * Parses a string into a number. The number stored at @ptr is
> + * potentially suffixed with %M (for megabytes, or 1048576 bytes)
> + * or %G (for gigabytes, or 1073741824). If the number is
> + * suffixed with M or G, then the return value is the number
> + * multiplied by one megabyte or one gigabyte, respectively. No
> + * suffix implies megabytes.
> + */
> +
> +unsigned long long memparse (const char *ptr)
> +{
> + char *endptr;
> + unsigned long ret = strtoull(ptr, &endptr, 0);
32-bit overflow here on i686. Should be unsigned long long if
you want to support > 2 G on a 32-bit platform.
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
prev parent reply other threads:[~2008-01-08 19:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-07 22:05 Slow Kernel Boot Dave Hansen
2008-01-07 22:16 ` Izik Eidus
[not found] ` <4782A4AF.6020902-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-07 22:46 ` Dave Hansen
2008-01-07 22:46 ` Izik Eidus
[not found] ` <4782ABCA.2090303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-07 23:03 ` Dave Hansen
2008-01-08 6:42 ` Amit Shah
[not found] ` <200801081212.53737.amit.shah-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-08 13:01 ` Amit Shah
[not found] ` <200801081831.54465.amit.shah-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-08 12:54 ` Izik Eidus
2008-01-08 13:18 ` Amit Shah
2008-01-08 19:13 ` Dave Hansen
2008-01-08 19:26 ` Daniel P. Berrange [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080108192630.GM21294@redhat.com \
--to=berrange-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=haveblue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox