From: Anthony Liguori <anthony@codemonkey.ws>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: qemu-devel@nongnu.org, Avi Kivity <avi@redhat.com>,
virtualization <virtualization@lists.linux-foundation.org>,
linux-kernel@vger.kernel.org, Adam Litke <agl@us.ibm.com>
Subject: Re: [Qemu-devel] Re: virtio: Add memory statistics reporting to the balloon driver (V2)
Date: Wed, 18 Nov 2009 09:02:26 -0600 [thread overview]
Message-ID: <4B040C82.6070901@codemonkey.ws> (raw)
In-Reply-To: <200911181200.39971.rusty@rustcorp.com.au>
Rusty Russell wrote:
> 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.
>
I think the mistake is that the other drivers don't do that.
We cheat in qemu and assume that the guest is always in a fixed
endianness but this is not always the case for all architectures.
That said, since we make this mistake everywhere, I guess I understand
the argument to have consistency and to just admit that we're broken
here. But this is where the endianness bits come from.
> Here you've done one and not the other, which is even worse. (Sparse would
> have found this, I assume).
>
Yup, that's definitely wrong.
>> +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.
>
I think making the interface u64 and byte based would be the best
solution. Making assumptions about page size across guest and host is
another thing we should try to avoid.
Regards,
Anthony Liguori
next prev parent reply other threads:[~2009-11-18 15:02 UTC|newest]
Thread overview: 6+ 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 ` [Qemu-devel] virtio: Add memory statistics reporting to the balloon driver (V2) Adam Litke
2009-11-18 1:30 ` [Qemu-devel] " Rusty Russell
2009-11-18 15:02 ` Anthony Liguori [this message]
2009-11-18 16:56 ` Jamie Lokier
2009-11-19 0:36 ` Rusty Russell
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=4B040C82.6070901@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=agl@us.ibm.com \
--cc=avi@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=rusty@rustcorp.com.au \
--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;
as well as URLs for NNTP newsgroup(s).