[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081205184603.GC13133@suse.de>
Date: Fri, 5 Dec 2008 10:46:03 -0800
From: Greg KH <gregkh@...e.de>
To: Mark McLoughlin <markmc@...hat.com>
Cc: Jiri Slaby <jirislaby@...il.com>, Michael Tokarev <mjt@....msk.ru>,
Rusty Russell <rusty@...tcorp.com.au>,
linux-kernel <linux-kernel@...r.kernel.org>,
kvm <kvm@...r.kernel.org>, Anthony Liguori <aliguori@...ibm.com>
Subject: Re: [PATCH] virtio: make PCI devices take a virtio_pci module ref
On Fri, Dec 05, 2008 at 06:30:17PM +0000, Mark McLoughlin wrote:
> On Fri, 2008-12-05 at 07:26 -0800, Greg KH wrote:
> > On Fri, Dec 05, 2008 at 04:25:31PM +0100, Jiri Slaby wrote:
> > > Mark McLoughlin wrote:
> > > >> Fix the virtio bus instead.
> > > >
> > > > Yeah, the patch I posted wasn't meant as a fix for this traceback.
> > >
> > > So what's the module_get patch needed for?
> > >
> > > > Here's one that does fix it.
> > > ...
> > > > From: Mark McLoughlin <markmc@...hat.com>
> > > > Subject: [PATCH] virtio: add device release() function
> > > >
> > > > Add a release() function for virtio_pci devices so as to avoid:
> > > >
> > > > Device 'virtio0' does not have a release() function, it is broken and must be fixed
> >
> > Just providing an empty release function to the kernel is the complete
> > wrong thing. Do you not think the kernel is actually trying to tell you
> > something here? If it could test for an empty release function it would
> > complain about that as well, providing one is no "fix" at all.
> >
> > You need to free your memory in the release function that is owned by
> > the device/structure. Please read the file, Documentation/kobject.txt
> > for details as to what you need to do.
>
> Okay, consider me "mocked mercilessly by the kobject maintainer" :-)
Heh, prepare for some more mocking below...
> Does this version look a bit more reasonable?
>
> (The virtio_pci_root is statically allocated so I don't see how
> release() could be non-empty in this case, but let's debate whether we
> want to keep this dummy device at all)
You should NEVER declare a kobject statically. There should be a check
in the kernel that complains about this on some arches in the -mm and
-next trees, I'm supprised you didn't hit it.
To quote from the kobject.txt documentation file:
Because kobjects are dynamic, they must not be declared
statically or on the stack, but instead, always allocated
dynamically. Future versions of the kernel will contain a
run-time check for kobjects that are created statically and will
warn the developer of this improper usage.
That is why you need a "real" release function.
So, care to respin this again please?
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists