All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: agl@linux.vnet.ibm.com
Cc: qemu-devel@nongnu.org,
	virtualization <virtualization@lists.linux-foundation.org>
Subject: Re: virtio: Add memory statistics reporting to the balloon driver
Date: Thu, 05 Nov 2009 17:39:09 -0600	[thread overview]
Message-ID: <4AF3621D.1080401@us.ibm.com> (raw)
In-Reply-To: <1257462155.3121.25.camel@aglitke>

agl@linux.vnet.ibm.com wrote:
> Here are the corresponding changes to the Linux virtio driver...
>
>     virtio: Add memory statistics reporting to the balloon driver
>     
>     When using ballooning to manage overcommitted memory on a host, a system for
>     guests to communicate their memory usage to the host can provide information
>     that will minimize the impact of ballooning on the guests.  The current method
>     employs a daemon running in each guest that communicates memory statistics to a
>     host daemon at a specified time interval.  The host daemon aggregates this
>     information and inflates and/or deflates balloons according to the level of
>     host memory pressure.  This approach is effective but overly complex since a
>     daemon must be installed inside each guest and coordinated to communicate with
>     the host.  A simpler approach is to collect memory statistics in the virtio
>     balloon driver and communicate them to the host via the device config space.
>     
>     This patch enables the guest-side support by adding stats collection and
>     reporting to the virtio balloon driver.
>     
>     Signed-off-by: Adam Litke <agl@us.ibm.com>
>
> diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
> index 3a43ebf..1029363 100644
> --- a/drivers/virtio/virtio.c
> +++ b/drivers/virtio/virtio.c
> @@ -135,6 +135,7 @@ static int virtio_dev_probe(struct device *_d)
>  			set_bit(i, dev->features);
>
>  	dev->config->finalize_features(dev);
> +	printk("virtio_dev_probe: final features = %lx\n", dev->features[0]);
>   

Looks like leftover debugging.

>  	err = drv->probe(dev);
>  	if (err)
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 200c22f..77cb953 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -180,6 +180,45 @@ static void update_balloon_size(struct virtio_balloon *vb)
>  			      &actual, sizeof(actual));
>  }
>
> +static inline void update_stat(struct virtio_device *vdev, int feature,
> +				unsigned long value, unsigned offset)
> +{
> +	if (virtio_has_feature(vdev, feature)) {
> +		vdev->config->set(vdev, offset, &value, sizeof(value));
>   

I think this bit assumes a little endian guest.  We shouldn't make that 
assumption.

For virtio kernel patches, please CC the virtualization list and Rusty 
as he's the maintainer.  It wouldn't hurt to CC lkml either.

-- 
Regards,

Anthony Liguori

WARNING: multiple messages have this Message-ID (diff)
From: Anthony Liguori <aliguori@us.ibm.com>
To: agl@linux.vnet.ibm.com
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	qemu-devel@nongnu.org,
	virtualization <virtualization@lists.linux-foundation.org>
Subject: [Qemu-devel] Re: virtio: Add memory statistics reporting to the balloon driver
Date: Thu, 05 Nov 2009 17:39:09 -0600	[thread overview]
Message-ID: <4AF3621D.1080401@us.ibm.com> (raw)
In-Reply-To: <1257462155.3121.25.camel@aglitke>

agl@linux.vnet.ibm.com wrote:
> Here are the corresponding changes to the Linux virtio driver...
>
>     virtio: Add memory statistics reporting to the balloon driver
>     
>     When using ballooning to manage overcommitted memory on a host, a system for
>     guests to communicate their memory usage to the host can provide information
>     that will minimize the impact of ballooning on the guests.  The current method
>     employs a daemon running in each guest that communicates memory statistics to a
>     host daemon at a specified time interval.  The host daemon aggregates this
>     information and inflates and/or deflates balloons according to the level of
>     host memory pressure.  This approach is effective but overly complex since a
>     daemon must be installed inside each guest and coordinated to communicate with
>     the host.  A simpler approach is to collect memory statistics in the virtio
>     balloon driver and communicate them to the host via the device config space.
>     
>     This patch enables the guest-side support by adding stats collection and
>     reporting to the virtio balloon driver.
>     
>     Signed-off-by: Adam Litke <agl@us.ibm.com>
>
> diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
> index 3a43ebf..1029363 100644
> --- a/drivers/virtio/virtio.c
> +++ b/drivers/virtio/virtio.c
> @@ -135,6 +135,7 @@ static int virtio_dev_probe(struct device *_d)
>  			set_bit(i, dev->features);
>
>  	dev->config->finalize_features(dev);
> +	printk("virtio_dev_probe: final features = %lx\n", dev->features[0]);
>   

Looks like leftover debugging.

>  	err = drv->probe(dev);
>  	if (err)
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 200c22f..77cb953 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -180,6 +180,45 @@ static void update_balloon_size(struct virtio_balloon *vb)
>  			      &actual, sizeof(actual));
>  }
>
> +static inline void update_stat(struct virtio_device *vdev, int feature,
> +				unsigned long value, unsigned offset)
> +{
> +	if (virtio_has_feature(vdev, feature)) {
> +		vdev->config->set(vdev, offset, &value, sizeof(value));
>   

I think this bit assumes a little endian guest.  We shouldn't make that 
assumption.

For virtio kernel patches, please CC the virtualization list and Rusty 
as he's the maintainer.  It wouldn't hurt to CC lkml either.

-- 
Regards,

Anthony Liguori

  reply	other threads:[~2009-11-05 23:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-05 22:50 [Qemu-devel] [RFC] virtio: Report new guest memory statistics pertinent to memory ballooning Adam Litke
2009-11-05 23:02 ` [Qemu-devel] virtio: Add memory statistics reporting to the balloon driver Adam Litke
2009-11-05 23:39   ` Anthony Liguori [this message]
2009-11-05 23:39     ` [Qemu-devel] " Anthony Liguori
2009-11-05 23:36 ` [Qemu-devel] Re: [RFC] virtio: Report new guest memory statistics pertinent to memory ballooning Anthony Liguori
2009-11-08  9:02 ` [Qemu-devel] " Avi Kivity
2009-11-08 23:27   ` Jamie Lokier
2009-11-09 13:59   ` Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2009-11-09 16:07 [Qemu-devel] [RFC] virtio: Report new guest memory statistics pertinent to memory ballooning (V2) Adam Litke
2009-11-09 16:32 ` virtio: Add memory statistics reporting to the balloon driver Adam Litke
2009-11-09 16:32 ` Adam Litke
2009-11-10  2:42   ` Rusty Russell
2009-11-10  2:42   ` Rusty Russell
2009-11-10 21:52     ` Anthony Liguori
2009-11-10 21:52     ` Anthony Liguori
2009-11-11  0:02       ` Rusty Russell
2009-11-11  0:02       ` Rusty Russell
2009-11-11  0:07         ` Anthony Liguori
2009-11-11  2:43           ` Rusty Russell
2009-11-11  2:43           ` Rusty Russell
2009-11-11 15:08             ` Adam Litke
2009-11-12  2:29               ` Rusty Russell
2009-11-12  2:29               ` Rusty Russell
2009-11-11 15:08             ` Adam Litke
2009-11-11  0:07         ` Anthony Liguori

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=4AF3621D.1080401@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=agl@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=virtualization@lists.linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.