All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Adam Litke <agl@us.ibm.com>
Cc: qemu-devel@nongnu.org, Anthony Liguori <aliguori@us.ibm.com>,
	Avi Kivity <avi@redhat.com>,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: virtio: Add memory statistics reporting to the balloon driver (V2)
Date: Wed, 18 Nov 2009 12:00:39 +1030	[thread overview]
Message-ID: <200911181200.39971.rusty@rustcorp.com.au> (raw)
In-Reply-To: <1258490189.2820.37.camel@aglitke>

On Wed, 18 Nov 2009 07:06:29 am Adam Litke wrote:
> virtio: Add memory statistics reporting to the balloon driver (V2)
> 
> Changes since V1:
>  - Use a virtqueue instead of the device config space

Hi Adam,

    If Anthony's happy, I'm happy with this approach.

Couple of minor points:

> +static inline void update_stat(struct virtio_balloon *vb, int idx,
> +				unsigned int tag, unsigned long val)
> +{
> +	BUG_ON(idx >= VIRTIO_BALLOON_S_NR);
> +	vb->stats[idx].tag = tag;
> +	vb->stats[idx].val = cpu_to_le32(val);
> +}

The little-endian conversion of the balloon driver is a historical mistake
(no other driver does this).  Let's not extend it to the stats.

Here you've done one and not the other, which is even worse.  (Sparse would
have found this, I assume).

> +struct virtio_balloon_stat
> +{
> +	__le16 tag;
> +	__le32 val;
> +};

Is 32 bits sufficient?  A big machine might get over 4bn faults, and certainly
4 TB of memory isn't that far away.

Thanks,
Rusty.

WARNING: multiple messages have this Message-ID (diff)
From: Rusty Russell <rusty@rustcorp.com.au>
To: Adam Litke <agl@us.ibm.com>
Cc: linux-kernel@vger.kernel.org,
	Anthony Liguori <aliguori@us.ibm.com>,
	virtualization@lists.linux-foundation.org, qemu-devel@nongnu.org,
	Avi Kivity <avi@redhat.com>
Subject: [Qemu-devel] Re: virtio: Add memory statistics reporting to the balloon driver (V2)
Date: Wed, 18 Nov 2009 12:00:39 +1030	[thread overview]
Message-ID: <200911181200.39971.rusty@rustcorp.com.au> (raw)
In-Reply-To: <1258490189.2820.37.camel@aglitke>

On Wed, 18 Nov 2009 07:06:29 am Adam Litke wrote:
> virtio: Add memory statistics reporting to the balloon driver (V2)
> 
> Changes since V1:
>  - Use a virtqueue instead of the device config space

Hi Adam,

    If Anthony's happy, I'm happy with this approach.

Couple of minor points:

> +static inline void update_stat(struct virtio_balloon *vb, int idx,
> +				unsigned int tag, unsigned long val)
> +{
> +	BUG_ON(idx >= VIRTIO_BALLOON_S_NR);
> +	vb->stats[idx].tag = tag;
> +	vb->stats[idx].val = cpu_to_le32(val);
> +}

The little-endian conversion of the balloon driver is a historical mistake
(no other driver does this).  Let's not extend it to the stats.

Here you've done one and not the other, which is even worse.  (Sparse would
have found this, I assume).

> +struct virtio_balloon_stat
> +{
> +	__le16 tag;
> +	__le32 val;
> +};

Is 32 bits sufficient?  A big machine might get over 4bn faults, and certainly
4 TB of memory isn't that far away.

Thanks,
Rusty.

  parent reply	other threads:[~2009-11-18  1:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-17 20:16 [Qemu-devel] virtio: Report new guest memory statistics pertinent to memory ballooning (V3) Adam Litke
2009-11-17 20:36 ` virtio: Add memory statistics reporting to the balloon driver (V2) Adam Litke
2009-11-17 20:36   ` [Qemu-devel] " Adam Litke
2009-11-18  1:30   ` Rusty Russell
2009-11-18  1:30   ` Rusty Russell [this message]
2009-11-18  1:30     ` [Qemu-devel] " Rusty Russell
2009-11-18 15:02     ` Anthony Liguori
2009-11-18 15:02     ` Anthony Liguori
2009-11-18 15:02       ` Anthony Liguori
2009-11-18 16:56       ` Jamie Lokier
2009-11-18 16:56         ` Jamie Lokier
2009-11-18 16:56       ` Jamie Lokier
2009-11-19  0:36       ` Rusty Russell
2009-11-19  0:36       ` Rusty Russell
2009-11-19  0:36         ` Rusty Russell
2009-11-17 20:36 ` Adam Litke

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=200911181200.39971.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=agl@us.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --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.