From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jesse Barnes Subject: Re: [PATCH] virtio: make PCI devices take a virtio_pci module ref Date: Tue, 9 Dec 2008 14:25:24 -0800 Message-ID: <200812091425.25569.jbarnes@virtuousgeek.org> References: <1228394671.3732.77.camel@blaa> <200812051043.51417.rusty@rustcorp.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: Mark McLoughlin , "linux-kernel" , kvm , Anthony Liguori , Michael Tokarev To: Rusty Russell Return-path: In-Reply-To: <200812051043.51417.rusty@rustcorp.com.au> Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Thursday, December 04, 2008 4:13 pm Rusty Russell wrote: > On Thursday 04 December 2008 23:14:31 Mark McLoughlin wrote: > > Nothing takes a ref on virtio_pci, so even if you have > > devices in use, rmmod will attempt to unload the module. > > > > Fix by simply making each device take a ref on the module. > > Hi Mark, > > Taking a reference to oneself is almost always wrong. I'm a little > surprised that a successful call to pci_device->probe doesn't bump the > module count though. > > Jesse? Looks like the PCI bus type's probe function does take a device reference, which should get called from driver_register when the driver calls pci_register_driver... Is that not happening in the virtio case? -- Jesse Barnes, Intel Open Source Technology Center