qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] hmp: fix regression of HMP device_del auto-comp


From: Marcel Apfelbaum
Subject: Re: [Qemu-devel] [PATCH] hmp: fix regression of HMP device_del auto-completion
Date: Fri, 28 Nov 2014 07:53:41 +0200

On Fri, 2014-11-28 at 09:50 +0800, Zhu Guihua wrote:
> On Thu, 2014-11-27 at 15:48 +0200, Marcel Apfelbaum wrote:
> > On Thu, 2014-11-27 at 13:38 +0100, Igor Mammedov wrote:
> > > On Thu, 27 Nov 2014 13:41:07 +0200
> > > Marcel Apfelbaum <address@hidden> wrote:
> > > 
> > > > On Thu, 2014-11-27 at 19:35 +0800, Zhu Guihua wrote:
> > > > > On Thu, 2014-11-27 at 13:11 +0200, Marcel Apfelbaum wrote:
> > > > > > On Wed, 2014-11-26 at 13:05 -0500, Luiz Capitulino wrote:
> > > > > > > On Wed, 26 Nov 2014 13:50:01 +0200
> > > > > > > Marcel Apfelbaum <address@hidden> wrote:
> > > > > > > 
> > > > > > > > The commits:
> > > > > > > >  - 6a1fa9f5 (monitor: add del completion for peripheral device)
> > > > > > > >  - 66e56b13 (qdev: add qdev_build_hotpluggable_device_list 
> > > > > > > > helper)
> > > > > > > > 
> > > > > > > > cause a QEMU crash when trying to use HMP device_del 
> > > > > > > > auto-completion.
> > > > > > > > It can be easily reproduced by:
> > > > > > > >     <qemu-bin> -enable-kvm  ~/images/fedora.qcow2 -monitor 
> > > > > > > > stdio -device virtio-net-pci,id=vnet
> > > > > > > > 
> > > > > > > >     (qemu) device_del
> > > > > > > >     
> > > > > > > > /home/mapfelba/git/upstream/qemu/hw/core/qdev.c:941:qdev_build_hotpluggable_device_list:
> > > > > > > >  Object 0x7f6ce04e4fe0 is not an instance of type device
> > > > > > > >     Aborted (core dumped)
> > > > > > > > 
> > > > > > > > The root cause is qdev_build_hotpluggable_device_list going 
> > > > > > > > recursively over
> > > > > > > > all peripherals and their children assuming all are devices. It 
> > > > > > > > doesn't work
> > > > > > > > since PCI devices have at least on child which is a memory 
> > > > > > > > region (bus master).
> > > > > > > > 
> > > > > > > > Solved by observing that all devices appear as direct children 
> > > > > > > > of
> > > > > > > > /machine/peripheral container. No need of going recursively
> > > > > > > > over all the children.
> > > > > > > > 
> > > > > > > > Signed-off-by: Marcel Apfelbaum <address@hidden>
> > > > > > > 
> > > > > > > Peter, can you apply this patch directly to master to avoid me a 
> > > > > > > pull
> > > > > > > request? Maybe it's a good idea to wait until tomorrow for more
> > > > > > > reviewers though.
> > > > > > Speaking of reviewers, I double checked the patch and indeed it 
> > > > > > solves
> > > > > > the crash, but the original patch has another semantic error.
> > > > > > It looks for hot-pluggable device and not *hot-plugged* ones.
> > > > > > 
> > > > > > I'll try to come with a solution fast. It should be a "hot-plugged" 
> > > > > > property somewhere...
> > > > > > 
> > > > > Hi Marcel,
> > > > > 
> > > > > May you give an example for a hot-plugged but non-hot-pluggable 
> > > > > device?
> > > > I was talking about something different:
> > > > A hot-pluggable device that was not hot-plugged is assumed to be 
> > > > hot-unpluggable.
> > > That's applicable to most of devices.
> > > 
> > > > This is not true for pci-2-pci device.
> > > Do you have a reproducer?
> > Sure:
> > <qemu-bin> <img>  -device pci-bridge,chassis_nr=1,id=bridge
> > 
> 
> It is also not true for pc-dimm.
> <qemu-bin> <img> -m 512,slots=10,maxmem=100G -object
> memory-backend-ram,id=ram0,size=128M -device pc-dimm,id=d0,memdev=ram0

Thanks for finding it!
I'll try to add a "can be hot-unplugged" flag whose default value
is "hotpluggable".
This can be overridden by sub-classes to meet their needs.

2.3 material, of course

Thanks,
Marcel
 
[...]




reply via email to

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