[PATCH v1 0/5] virtio-mem: Device unplug support

David Hildenbrand posted 5 patches 10 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230613150210.449406-1-david@redhat.com
Maintainers: Peter Maydell <peter.maydell@linaro.org>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, David Hildenbrand <david@redhat.com>
There is a newer version of this series
hw/arm/virt.c                  | 60 +++++++++++++++++++++++++++++--
hw/i386/pc.c                   | 66 ++++++++++++++++++++++++++++++----
hw/virtio/virtio-mem-pci.c     | 42 ++++++++++++++++++++--
hw/virtio/virtio-mem-pci.h     |  2 ++
hw/virtio/virtio-mem.c         | 24 +++++++++++++
include/hw/virtio/virtio-mem.h |  2 ++
6 files changed, 183 insertions(+), 13 deletions(-)
[PATCH v1 0/5] virtio-mem: Device unplug support
Posted by David Hildenbrand 10 months, 3 weeks ago
One limitation of virtio-mem is that we cannot currently unplug virtio-mem
devices that have all memory unplugged from the VM.

Let's properly handle forced unplug (as can be triggered by the VM) and
add support for ordinary unplug (requests) of virtio-mem devices that are
in a compatible state (no legacy mode, no plugged memory, no plug request).

Briefly tested on both, x86_64 and aarch64.

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Eduardo Habkost <eduardo@habkost.net>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-arm@nongnu.org
Cc: Gavin Shan <gshan@redhat.com>

David Hildenbrand (5):
  pc: Properly handle unplug of virtio based memory devices
  arm/virt: Properly handle unplug of virtio based memory devices
  virtio-mem: Prepare for unplug support of virtio-mem-pci devices
  pc: Support unplug of virtio-mem-pci devices
  arm/virt: Support unplug of virtio-mem-pci devices

 hw/arm/virt.c                  | 60 +++++++++++++++++++++++++++++--
 hw/i386/pc.c                   | 66 ++++++++++++++++++++++++++++++----
 hw/virtio/virtio-mem-pci.c     | 42 ++++++++++++++++++++--
 hw/virtio/virtio-mem-pci.h     |  2 ++
 hw/virtio/virtio-mem.c         | 24 +++++++++++++
 include/hw/virtio/virtio-mem.h |  2 ++
 6 files changed, 183 insertions(+), 13 deletions(-)

-- 
2.40.1
Re: [PATCH v1 0/5] virtio-mem: Device unplug support
Posted by Michael S. Tsirkin 10 months, 2 weeks ago
On Tue, Jun 13, 2023 at 05:02:05PM +0200, David Hildenbrand wrote:
> One limitation of virtio-mem is that we cannot currently unplug virtio-mem
> devices that have all memory unplugged from the VM.
> 
> Let's properly handle forced unplug (as can be triggered by the VM) and
> add support for ordinary unplug (requests) of virtio-mem devices that are
> in a compatible state (no legacy mode, no plugged memory, no plug request).
> 
> Briefly tested on both, x86_64 and aarch64.
> 
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Eduardo Habkost <eduardo@habkost.net>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Cc: qemu-arm@nongnu.org
> Cc: Gavin Shan <gshan@redhat.com>

Lots of duplication pc/arm. Which is not new but do we have to keep
growing this?  Can't we put at least the new common code somewhere?

What do ARM maintainers think about it?


> David Hildenbrand (5):
>   pc: Properly handle unplug of virtio based memory devices
>   arm/virt: Properly handle unplug of virtio based memory devices
>   virtio-mem: Prepare for unplug support of virtio-mem-pci devices
>   pc: Support unplug of virtio-mem-pci devices
>   arm/virt: Support unplug of virtio-mem-pci devices
> 
>  hw/arm/virt.c                  | 60 +++++++++++++++++++++++++++++--
>  hw/i386/pc.c                   | 66 ++++++++++++++++++++++++++++++----
>  hw/virtio/virtio-mem-pci.c     | 42 ++++++++++++++++++++--
>  hw/virtio/virtio-mem-pci.h     |  2 ++
>  hw/virtio/virtio-mem.c         | 24 +++++++++++++
>  include/hw/virtio/virtio-mem.h |  2 ++
>  6 files changed, 183 insertions(+), 13 deletions(-)
> 
> -- 
> 2.40.1
Re: [PATCH v1 0/5] virtio-mem: Device unplug support
Posted by David Hildenbrand 10 months, 2 weeks ago
On 23.06.23 07:58, Michael S. Tsirkin wrote:
> On Tue, Jun 13, 2023 at 05:02:05PM +0200, David Hildenbrand wrote:
>> One limitation of virtio-mem is that we cannot currently unplug virtio-mem
>> devices that have all memory unplugged from the VM.
>>
>> Let's properly handle forced unplug (as can be triggered by the VM) and
>> add support for ordinary unplug (requests) of virtio-mem devices that are
>> in a compatible state (no legacy mode, no plugged memory, no plug request).
>>
>> Briefly tested on both, x86_64 and aarch64.
>>
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Richard Henderson <richard.henderson@linaro.org>
>> Cc: Eduardo Habkost <eduardo@habkost.net>
>> Cc: "Michael S. Tsirkin" <mst@redhat.com>
>> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
>> Cc: Igor Mammedov <imammedo@redhat.com>
>> Cc: qemu-arm@nongnu.org
>> Cc: Gavin Shan <gshan@redhat.com>
> 
> Lots of duplication pc/arm. Which is not new but do we have to keep
> growing this?  Can't we put at least the new common code somewhere?

There are some minor differences in the code, but I guess we could 
factor the (un)plug handlers out.

hw/virtio/virtio-md.c
include/hw/virtio/virtio-md.c

?

-- 
Cheers,

David / dhildenb
Re: [PATCH v1 0/5] virtio-mem: Device unplug support
Posted by Michael S. Tsirkin 10 months, 2 weeks ago
On Fri, Jun 23, 2023 at 09:04:37AM +0200, David Hildenbrand wrote:
> On 23.06.23 07:58, Michael S. Tsirkin wrote:
> > On Tue, Jun 13, 2023 at 05:02:05PM +0200, David Hildenbrand wrote:
> > > One limitation of virtio-mem is that we cannot currently unplug virtio-mem
> > > devices that have all memory unplugged from the VM.
> > > 
> > > Let's properly handle forced unplug (as can be triggered by the VM) and
> > > add support for ordinary unplug (requests) of virtio-mem devices that are
> > > in a compatible state (no legacy mode, no plugged memory, no plug request).
> > > 
> > > Briefly tested on both, x86_64 and aarch64.
> > > 
> > > Cc: Peter Maydell <peter.maydell@linaro.org>
> > > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > > Cc: Richard Henderson <richard.henderson@linaro.org>
> > > Cc: Eduardo Habkost <eduardo@habkost.net>
> > > Cc: "Michael S. Tsirkin" <mst@redhat.com>
> > > Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> > > Cc: Igor Mammedov <imammedo@redhat.com>
> > > Cc: qemu-arm@nongnu.org
> > > Cc: Gavin Shan <gshan@redhat.com>
> > 
> > Lots of duplication pc/arm. Which is not new but do we have to keep
> > growing this?  Can't we put at least the new common code somewhere?
> 
> There are some minor differences in the code, but I guess we could factor
> the (un)plug handlers out.

maybe with a callback.

> 
> hw/virtio/virtio-md.c
> include/hw/virtio/virtio-md.c
> 
> ?

Sure.

> -- 
> Cheers,
> 
> David / dhildenb