From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Brook Subject: Re: [PATCH RFC] qemu: fix hot remove assigned device Date: Tue, 9 Jun 2009 15:51:40 +0100 Message-ID: <200906091551.41674.paul@codesourcery.com> References: <1244481435-17224-1-git-send-email-weidong.han@intel.com> <200906081538.22186.paul@codesourcery.com> <715D42877B251141A38726ABF5CABF2C054590C496@pdsmsx503.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: "'avi@redhat.com'" , "'kvm@vger.kernel.org'" To: "Han, Weidong" Return-path: Received: from mail.codesourcery.com ([65.74.133.4]:42020 "EHLO mail.codesourcery.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750709AbZFIOvl (ORCPT ); Tue, 9 Jun 2009 10:51:41 -0400 In-Reply-To: <715D42877B251141A38726ABF5CABF2C054590C496@pdsmsx503.ccr.corp.intel.com> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: 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. Paul