public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>
To: "Daniel P. Berrange" <berrange-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Marcelo Tosatti <marcelo-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	kvm-devel
	<kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH] QEMU KVM balloon support
Date: Tue, 8 Jan 2008 15:08:27 -0200	[thread overview]
Message-ID: <20080108170827.GA22747@dmt> (raw)
In-Reply-To: <20080108164342.GF21294-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On Tue, Jan 08, 2008 at 04:43:42PM +0000, Daniel P. Berrange wrote:
> On Tue, Jan 08, 2008 at 01:43:40PM -0200, Marcelo Tosatti wrote:
> > Index: kvm-userspace/qemu/monitor.c
> > ===================================================================
> > --- kvm-userspace.orig/qemu/monitor.c
> > +++ kvm-userspace/qemu/monitor.c
> > @@ -1339,6 +1339,8 @@ static term_cmd_t term_cmds[] = {
> >        "", "cancel the current VM migration" },
> >      { "migrate_set_speed", "s", do_migrate_set_speed,
> >        "value", "set maximum speed (in bytes) for migrations" },
> > +    { "setmem", "s", do_setmemory, "value", 
> > +      "set memory for the guest (in bytes)" },
> >      { NULL, NULL, },
> >  };
> 
> [snip]
> 
> > +void do_setmemory(const char *value)
> > +{
> > +	int target_ramsize;
> > +	char *ptr;
> > +
> > +	target_ramsize = strtol(value, &ptr, 10);
> > +	switch (*ptr) {
> > +	case 'G': case 'g':
> > +		target_ramsize *= 1024;
> > +	case 'M': case 'm':
> > +		target_ramsize *= 1024;
> > +	case 'K': case 'k':
> > +		target_ramsize *= 1024;
> > +	default:
> > +		break;
> > +	}
> > +
> > +	if (target_ramsize > ram_size) {
> > +		term_printf("Invalid RAM size, maximum: %d\n", ram_size);
> > +		return;
> > +	}
> > +	
> > +	balloon_update_target(target_ramsize);
> > +}
> 
> Shouldn't this use  int64, and strtoll(), otherwise you'll wrap
> at the 2 GB mark ?

Good catch, thanks.


-------------------------------------------------------------------------
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 17:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-08 15:43 [PATCH] QEMU KVM balloon support Marcelo Tosatti
2008-01-08 16:43 ` Daniel P. Berrange
     [not found]   ` <20080108164342.GF21294-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-08 17:08     ` Marcelo Tosatti [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=20080108170827.GA22747@dmt \
    --to=marcelo-bw31mazkks3ytjvyw6ydsg@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=berrange-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@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