"Michael S. Tsirkin" <> writes:
> On Tue, Oct 29, 2013 at 10:44:53AM +1030, Rusty Russell wrote:
>> "Michael S. Tsirkin" <> writes:
>> > OK there are some more issues to consider around deflate.
>> >
>> >
>> > 1. On KVM, we actually want to change QEMU so that pagefaults don't
>> > work either. Specifically, we want to skip pages in the balloon for
>> > migration.
>> > However, migration is done in userspace while pagefaults
>> > are done in kernel.
>> > I think the implication is that
>> > - you should be able to ask guest to inflate balloon
>> > with pages that can be paged in (when you don't want to migrate
>> > and want max local performance) or with pages that can not be paged in
>> > (when you want to migrate faster), dynamically, not through a
>> > device feature
>> > - "will notify before use" feature should be per a bunch or pages actually.
>>
>> I am always reluctant to implement a spec for things which don't exist.
>> This is the cause of the current "negative feature" mess with
>> VIRTIO_BALLOON_F_MUST_TELL_HOST.
>
> Well it's no longer negative now that we made it optional.
> The name might need to be changed to VIRTIO_BALLOON_F_GUEST_TELLS_HOST.
It's still a problem: if a host *needs* this feature, and a guest
doesn't accept it, we're in trouble.
>> So if we *ever* want to ask for pages, let's make the the driver always
>> ask for pages. You place a buffer in the queue and the device fills it
>> with page addresses you can now use.
>>
>> See below.
>
> Hmm but then, this does not look so different from the current
> balloon anymore ...
I don't necessarily want different. I want to fix the various virtio
balloon bugs, eg:
VIRTIO-37 allow >4G 4K pages in balloon
VIRTIO-36 balloon: align val in virtio_balloon_stat
VIRTIO-25 balloon: remove VIRTIO_BALLOON_F_MUST_TELL_HOST and deflate queue.
VIRTIO-24 balloon: don't define endianness separately for config space.
I want the balloon to return to the simple device it was meant to be.
>> +3. To withdraw pages from the balloon, the same structure should be
>> + placed in the todevq queue, with the page array writable:
>> +
>> + struct virtio_balloon_pages {
>> +#define VIRTIO_BALLOON_REQ_PAGES 2
>> + u32 type; // VIRTIO_BALLOON_REQ_PAGES
>> + u64 page[];
>> + };
>> +
>> + The device may not fill the entire page array. The contents
>> + of the pages received will be undefined.
>
> On a Linux host they are actually zeroed out.
> Maybe document this?
Absolutely not, I don't want anyone relying on it! This can certainly
change in a future implementation.
In fact, I'm not even sure it's true on a hugepage-backed guest.
Cheers,
Rusty.