From mboxrd@z Thu Jan 1 00:00:00 1970 From: liu ping fan Subject: Re: [PATCH 15/15] e1000: using new interface--unmap to unplug Date: Thu, 9 Aug 2012 15:28:19 +0800 Message-ID: References: <1344407156-25562-1-git-send-email-qemulist@gmail.com> <1344407156-25562-16-git-send-email-qemulist@gmail.com> <502237CE.1020206@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Anthony Liguori , Avi Kivity , Jan Kiszka , Marcelo Tosatti , Stefan Hajnoczi , Blue Swirl , =?ISO-8859-1?Q?Andreas_F=E4rber?= To: Paolo Bonzini Return-path: Received: from mail-wg0-f44.google.com ([74.125.82.44]:40256 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755748Ab2HIH2k (ORCPT ); Thu, 9 Aug 2012 03:28:40 -0400 Received: by mail-wg0-f44.google.com with SMTP id dr13so164438wgb.1 for ; Thu, 09 Aug 2012 00:28:40 -0700 (PDT) In-Reply-To: <502237CE.1020206@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Aug 8, 2012 at 5:56 PM, Paolo Bonzini wrote: > Il 08/08/2012 08:25, Liu Ping Fan ha scritto: >> >> +static void >> +pci_e1000_unmap(PCIDevice *p) >> +{ >> + /* DO NOT FREE anything!until refcnt=0 */ >> + /* isolate from memory view */ >> +} > > At least you need to call the superclass method. > Refer to 0013-hotplug-introduce-qdev_unplug_complete-to-remove-dev.patch, we have the following sequence qdev_unmap->pci_unmap_device->pci_e1000_unmap. So pci_e1000_unmap need not to do anything. Regards, pingfan > Paolo > >> static int >> pci_e1000_uninit(PCIDevice *dev) >> { >> @@ -1275,6 +1282,7 @@ static void e1000_class_init(ObjectClass *klass, void *data) >> PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); >> >> k->init = pci_e1000_init; >> + k->unmap = pci_e1000_unmap; >> k->exit = pci_e1000_uninit; >> k->romfile = "pxe-e1000.rom"; >> k->vendor_id = PCI_VENDOR_ID_INTEL; > > From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzNAf-0003YP-NP for qemu-devel@nongnu.org; Thu, 09 Aug 2012 03:28:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzNAe-0008Uv-PZ for qemu-devel@nongnu.org; Thu, 09 Aug 2012 03:28:41 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:59764) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzNAe-0008Un-JF for qemu-devel@nongnu.org; Thu, 09 Aug 2012 03:28:40 -0400 Received: by wibhm2 with SMTP id hm2so38743wib.10 for ; Thu, 09 Aug 2012 00:28:40 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <502237CE.1020206@redhat.com> References: <1344407156-25562-1-git-send-email-qemulist@gmail.com> <1344407156-25562-16-git-send-email-qemulist@gmail.com> <502237CE.1020206@redhat.com> From: liu ping fan Date: Thu, 9 Aug 2012 15:28:19 +0800 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] [PATCH 15/15] e1000: using new interface--unmap to unplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kvm@vger.kernel.org, Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, Blue Swirl , Avi Kivity , Anthony Liguori , Stefan Hajnoczi , =?ISO-8859-1?Q?Andreas_F=E4rber?= On Wed, Aug 8, 2012 at 5:56 PM, Paolo Bonzini wrote: > Il 08/08/2012 08:25, Liu Ping Fan ha scritto: >> >> +static void >> +pci_e1000_unmap(PCIDevice *p) >> +{ >> + /* DO NOT FREE anything!until refcnt=0 */ >> + /* isolate from memory view */ >> +} > > At least you need to call the superclass method. > Refer to 0013-hotplug-introduce-qdev_unplug_complete-to-remove-dev.patch, we have the following sequence qdev_unmap->pci_unmap_device->pci_e1000_unmap. So pci_e1000_unmap need not to do anything. Regards, pingfan > Paolo > >> static int >> pci_e1000_uninit(PCIDevice *dev) >> { >> @@ -1275,6 +1282,7 @@ static void e1000_class_init(ObjectClass *klass, void *data) >> PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); >> >> k->init = pci_e1000_init; >> + k->unmap = pci_e1000_unmap; >> k->exit = pci_e1000_uninit; >> k->romfile = "pxe-e1000.rom"; >> k->vendor_id = PCI_VENDOR_ID_INTEL; > >