From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerd Hoffmann Subject: Re: [PATCH RFC] qemu: fix hot remove assigned device Date: Tue, 09 Jun 2009 17:37:13 +0200 Message-ID: <4A2E81A9.4060501@redhat.com> References: <1244481435-17224-1-git-send-email-weidong.han@intel.com> <200906081538.22186.paul@codesourcery.com> <715D42877B251141A38726ABF5CABF2C054590C496@pdsmsx503.ccr.corp.intel.com> <200906091551.41674.paul@codesourcery.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "Han, Weidong" , "'avi@redhat.com'" , "'kvm@vger.kernel.org'" To: Paul Brook Return-path: Received: from mx2.redhat.com ([66.187.237.31]:51423 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751376AbZFIPjS (ORCPT ); Tue, 9 Jun 2009 11:39:18 -0400 In-Reply-To: <200906091551.41674.paul@codesourcery.com> Sender: kvm-owner@vger.kernel.org List-ID: On 06/09/09 16:51, Paul Brook wrote: > On Tuesday 09 June 2009, Han, Weidong wrote: >> Paul Brook wrote: >>> On Monday 08 June 2009, Weidong Han wrote: >>>> When hot remove an assigned device, segmentation fault was triggered >>>> by qemu_free(&pci_dev->qdev) in pci_unregister_device(). >>>> pci_register_device() doesn't initialize or set pci_dev->qdev. For an >>>> assigned device, qdev variable isn't touched at all. So segmentation >>>> fault happens when to free a non-initialized qdev. >>> Better would be to just disable hot remove for devices still using >>> the legacy pci_register_device API. >> PCI passthrough uses pci_register_device to register assigned device to >> qemu. Is there newer API to do so? > > Yes. See e.g. LSI scsi emulation. Well. Except that you can't (yet) register pci config read/write callbacks using the qdev-based API. cheers, Gerd