public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Adam Litke <agl@us.ibm.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: virtio: Add memory statistics reporting to the balloon driver (V4)
Date: Tue, 1 Dec 2009 12:54:22 +1030	[thread overview]
Message-ID: <200912011254.22861.rusty@rustcorp.com.au> (raw)
In-Reply-To: <1259597655.30369.2.camel@aglitke>

On Tue, 1 Dec 2009 02:44:15 am Adam Litke wrote:
> Changes since V3:

OK, I applied this.  And here's the fixes I applied afterwards (to save YA
round trip: please ack and I'll fold them together)

virtio: balloon fixes

1) Tag and val args to update_stat() are no longer __le.
2) pages_to_bytes() should promote to u64 so we don't truncate.
3) Fix two checkpatch.pl warnings.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 drivers/virtio/virtio_balloon.c |    8 +++++---
 include/linux/virtio_balloon.h  |    3 +--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -158,14 +158,15 @@ static void leak_balloon(struct virtio_b
 }
 
 static inline void update_stat(struct virtio_balloon *vb, int idx,
-				__le16 tag, __le64 val)
+			       u16 tag, u64 val)
 {
 	BUG_ON(idx >= VIRTIO_BALLOON_S_NR);
 	vb->stats[idx].tag = tag;
 	vb->stats[idx].val = val;
 }
 
-#define pages_to_bytes(x) ((x) << PAGE_SHIFT)
+#define pages_to_bytes(x) ((u64)(x) << PAGE_SHIFT)
+
 static void update_balloon_stats(struct virtio_balloon *vb)
 {
 	unsigned long events[NR_VM_EVENT_ITEMS];
@@ -296,7 +297,8 @@ static int virtballoon_probe(struct virt
 		 * use it to signal us later.
 		 */
 		sg_init_one(&sg, vb->stats, sizeof vb->stats);
-		if (vb->stats_vq->vq_ops->add_buf(vb->stats_vq, &sg, 1, 0, vb) < 0)
+		if (vb->stats_vq->vq_ops->add_buf(vb->stats_vq,
+						  &sg, 1, 0, vb) < 0)
 			BUG();
 		vb->stats_vq->vq_ops->kick(vb->stats_vq);
 	}
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h
--- a/include/linux/virtio_balloon.h
+++ b/include/linux/virtio_balloon.h
@@ -28,8 +28,7 @@ struct virtio_balloon_config
 #define VIRTIO_BALLOON_S_MEMTOT   5   /* Total amount of memory */
 #define VIRTIO_BALLOON_S_NR       6
 
-struct virtio_balloon_stat
-{
+struct virtio_balloon_stat {
 	u16 tag;
 	u64 val;
 } __attribute__((packed));



  reply	other threads:[~2009-12-01  2:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-30 16:14 virtio: Add memory statistics reporting to the balloon driver (V4) Adam Litke
2009-12-01  2:24 ` Rusty Russell [this message]
2009-12-01 14:49   ` Adam Litke
2009-12-01 14:56 ` Avi Kivity
2009-12-01 15:05   ` Adam Litke
2009-12-01 15:53     ` Avi Kivity

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=200912011254.22861.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=agl@us.ibm.com \
    --cc=anthony@codemonkey.ws \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox