On Tue, Feb 23, 2021 at 5:00 AM Jason Gunthorpe <jgg@xxxxxxxxxx> wrote: > > On Thu, Feb 18, 2021 at 02:31:54PM -0700, Dave Jiang wrote: > > Remove devm_* allocation of memory of 'struct device' objects. > > The devm_* lifetime is incompatible with device->release() lifetime. > > Address issues flagged by CONFIG_DEBUG_KOBJECT_RELEASE. Add release > > functions for each component in order to free the allocated memory at > > the appropriate time. Each component such as wq, engine, and group now > > needs to be allocated individually in order to setup the lifetime properly. > > I really don't understand why idxd has so many struct device objects. > > Typically I expect a simple driver to have exactly one, usually > provided by its subsystem. > > What is the purpose? > > And it is still messed up because it has: > > struct idxd_device { > enum idxd_type type; > struct device conf_dev; <-- This is a kref > > struct dma_device dma_dev; <-- And this is also a kref > } > > The first kref does kfree() and the second does > idxd_conf_device_release() which does nothing - this is obviously > wrong too. Obviously... I apologize I flubbed this and assumed the devm conversions also moved these to pointers.