public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Izik Eidus <izike-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Amit Shah <amit.shah-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Subject: Re: Slow Kernel Boot
Date: Tue, 08 Jan 2008 14:54:40 +0200	[thread overview]
Message-ID: <1199796880.5550.0.camel@localhost.localdomain> (raw)
In-Reply-To: <200801081831.54465.amit.shah-atKUWr5tajBWk0Htik3J/w@public.gmane.org>


On Tue, 2008-01-08 at 18:31 +0530, Amit Shah wrote:
> On Tuesday 08 January 2008 12:12:53 Amit Shah wrote:
> > On Tuesday 08 January 2008 03:35:48 Dave Hansen wrote:
> > > With kvm-44, I thought my kernel was freezing during boot if I gave it
> > > 1G of RAM.  But, it boots fine with 512M.
> > >
> > > So, I instrumented the kernel, and found out that it is just taking a
> > > long time to memset a 58MB area of memory for mem_map[].  It appears to
> > > be taking a mmio_exit for every access of every byte of memory.  The end
> > > result is a ~100kbps memset() speed.  Yes, 100 kilobytes/sec.
> > >
> > > I just tried kvm from git, and the kernel doesn't even get that far.  I
> > > see this in debugfs
> > >
> > > 	insn_emulation:1393985
> > >
> > > even before I get a single kernel message.  And it keeps going up, fast.
> > > I can get the kernel to boot just fine if I give it less than 896MB of
> > > RAM.
> > >
> > > kvm-44 boots long enough for me to see a really funky e820 table:
> > >
> > > 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!
> 
> Just wrote this.
> 
> From 575b4414314cdc5c8280cfbf1761a6d419dd7a40 Mon Sep 17 00:00:00 2001
> From: Amit Shah <amit.shah-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
> Date: Tue, 8 Jan 2008 18:24:34 +0530
> Subject: [PATCH] qemu: Add support for suffixes to the -m parameter
> 
> The -m parameter doesn't take suffixes like G or M currently
> and it doesn't complain if such a suffix is given.
> 
> Add support for the G and M suffixes and update the usage
> instructions appropriately.
> 
> Signed-off-by: Amit Shah <amit.shah-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
> ---
>  qemu/vl.c |   25 +++++++++++++++++++++++--
>  1 files changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/qemu/vl.c b/qemu/vl.c
> index 0f023ac..114a84e 100644
> --- a/qemu/vl.c
> +++ b/qemu/vl.c
> @@ -7927,7 +7927,9 @@ static void help(int exitcode)
>  #ifdef TARGET_I386
>             "-no-fd-bootchk  disable boot signature checking for floppy 
> disks\n"
>  #endif
> -           "-m megs         set virtual RAM size to megs MB [default=%d]\n"
> +           "-m size         set virtual RAM size to size megs [default=%d 
> MB].\n"
> +           "                Optional suffixes 'M' (megabyte) and 'G' 
> (gigabyte)"
> +                            " are supported\n"
>             "-smp n          set the number of CPUs to 'n' [default=1]\n"
>             "-nographic      disable graphical output and redirect serial I/Os 
> to console\n"
>             "-portrait       rotate graphical output 90 deg left (only PXA 
> LCD)\n"
> @@ -8858,7 +8860,26 @@ int main(int argc, char **argv)
>                  help(0);
>                  break;
>              case QEMU_OPTION_m:
> -                ram_size = (int64_t)atoi(optarg) * 1024 * 1024;
> +                errno = 0;
> +                ram_size = strtoul(optarg, &optarg, 0);
> +                if (errno)
> +                    help(1);
> +                switch (*optarg) {
> +                case 'G':
> +                case 'g':
> +                    ram_size *= 1024;
> +                    /* fall through */
> +                case 'M':
> +                case 'm':
> +                case '\0':
> +                    ram_size *= 1024 * 1024;
> +                    optarg++;
> +                    break;
> +                default:
> +                    help(1);
> +                    break;
> +                }
> +
>                  if (ram_size <= 0)
>                      help(1);
>                  if (ram_size > PHYS_RAM_MAX_SIZE) {
i guess you should send it to qemu-devel, and then it will be merged to
kvm from there


-------------------------------------------------------------------------
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

  parent reply	other threads:[~2008-01-08 12:54 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 [this message]
2008-01-08 13:18         ` Amit Shah
2008-01-08 19:13     ` Dave Hansen
2008-01-08 19:26       ` Daniel P. Berrange

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=1199796880.5550.0.camel@localhost.localdomain \
    --to=izike-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=amit.shah-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@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