qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] virtio-balloon: Reject qmp_balloon during hot-unplug


From: David Hildenbrand
Subject: Re: [PATCH 2/2] virtio-balloon: Reject qmp_balloon during hot-unplug
Date: Thu, 23 Jan 2020 15:17:33 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1

On 23.01.20 15:08, Julia Suvorova wrote:
> On Thu, Jan 16, 2020 at 1:36 PM David Hildenbrand <address@hidden> wrote:
>>
>> On 15.01.20 23:40, Julia Suvorova wrote:
>>> Hot-unplug takes some time due to communication with the guest.
>>> Do not change the device while freeing up resources.
>>>
>>> Signed-off-by: Julia Suvorova <address@hidden>
>>> ---
>>>  balloon.c                  | 2 +-
>>>  hw/virtio/virtio-balloon.c | 9 ++++++++-
>>>  include/sysemu/balloon.h   | 2 +-
>>>  3 files changed, 10 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/balloon.c b/balloon.c
>>> index f104b42961..998ec53a0f 100644
>>> --- a/balloon.c
>>> +++ b/balloon.c
>>> @@ -119,5 +119,5 @@ void qmp_balloon(int64_t target, Error **errp)
>>>      }
>>>
>>>      trace_balloon_event(balloon_opaque, target);
>>> -    balloon_event_fn(balloon_opaque, target);
>>> +    balloon_event_fn(balloon_opaque, target, errp);
>>>  }
>>> diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
>>> index 57f3b9f22d..0fa4e4454b 100644
>>> --- a/hw/virtio/virtio-balloon.c
>>> +++ b/hw/virtio/virtio-balloon.c
>>> @@ -717,12 +717,19 @@ static void virtio_balloon_stat(void *opaque, 
>>> BalloonInfo *info)
>>>                                               VIRTIO_BALLOON_PFN_SHIFT);
>>>  }
>>>
>>> -static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
>>> +static void virtio_balloon_to_target(void *opaque, ram_addr_t target,
>>> +                                     Error **errp)
>>>  {
>>> +    DeviceState *bus_dev = qdev_get_bus_device(DEVICE(opaque));
>>>      VirtIOBalloon *dev = VIRTIO_BALLOON(opaque);
>>>      VirtIODevice *vdev = VIRTIO_DEVICE(dev);
>>>      ram_addr_t vm_ram_size = get_current_ram_size();
>>>
>>> +    if (bus_dev && bus_dev->pending_deleted_event) {
>>> +        error_setg(errp, "Hot-unplug of %s is in progress", vdev->name);
>>> +        return;
>>> +    }
>>> +
>>
>> How exactly does this help? The guest is free to inflate/deflate
>> whenever it wants.
> 
> Guest is aware of hot-unplug start, and virtio driver should not
> initiate any operations. This patch just restricts issuing commands
> from qmp monitor.

Why shouldn't the guest driver inflate/deflate while memory hotplug is
going on?

Simple balloon compaction in a Linux guest -> deflate/inflate triggered
in the hypervisor.

-- 
Thanks,

David / dhildenb




reply via email to

[Prev in Thread] Current Thread [Next in Thread]