Patchwork [07/10] unplug: using new intf qdev_delete_subtree in acpi_piix_eject_slot

login
register
mail settings
Submitter pingfan liu
Date Aug. 24, 2012, 9:49 a.m.
Message ID <1345801763-24227-8-git-send-email-qemulist@gmail.com>
Download mbox | patch
Permalink /patch/179809/
State New
Headers show

Comments

pingfan liu - Aug. 24, 2012, 9:49 a.m.
From: Liu Ping Fan <pingfank@linux.vnet.ibm.com>

We are not long to force to delete the obj at that place, just
let its refcnt handle this issue.

Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
 hw/acpi_piix4.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Paolo Bonzini - Aug. 24, 2012, 10:24 a.m.
Il 24/08/2012 11:49, Liu Ping Fan ha scritto:
> From: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
> 
> We are not long to force to delete the obj at that place, just
> let its refcnt handle this issue.

This seems wrong.  If anything, unplug requests should propagate down
the tree and the top device should only acknowledge it hot-unplug after
all its children.  You are effectively surprise-removing everything
below a bridge.


Paolo
pingfan liu - Aug. 25, 2012, 7:05 a.m.
On Fri, Aug 24, 2012 at 6:24 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Il 24/08/2012 11:49, Liu Ping Fan ha scritto:
>> From: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
>>
>> We are not long to force to delete the obj at that place, just
>> let its refcnt handle this issue.
>
> This seems wrong.  If anything, unplug requests should propagate down
> the tree and the top device should only acknowledge it hot-unplug after
> all its children.  You are effectively surprise-removing everything
> below a bridge.
>
I had thought that the bridge's acknowledge will be the last one eject
by guest, can not assume that?  Another question is that if we got ack
for a bridge, but not for its child, then we will just leave the
bridge on the fly?

Anyway, I thought another method to work around this. Will send out it later.

Thanks and regards,
pingfan
>
> Paolo

Patch

diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index 0aace60..f00d4d8 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -305,8 +305,11 @@  static void acpi_piix_eject_slot(PIIX4PMState *s, unsigned slots)
             if (pc->no_hotplug) {
                 slot_free = false;
             } else {
+#if 0
                 object_unparent(OBJECT(dev));
                 qdev_free(qdev);
+#endif
+                qdev_delete_subtree(qdev);
             }
         }
     }