On Sat, Feb 27, 2021 at 09:27:26AM -0700, Dave Jiang wrote: > > On 2/26/2021 6:36 PM, Jason Gunthorpe wrote: > > On Wed, Feb 24, 2021 at 03:35:19PM -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. > > You've tested this now with kasn and all the other debugging turned > > on? > > Only with DEBUG_KOBJECT_RELEASE. I wasn't aware of the kasn tests. I'll go > test with those. Thanks for the thorough review. Really appreciate it. I turn on these things in my debug kernel builds: DEBUG_ATOMIC_SLEEP DEBUG_BUGVERBOSE DEBUG_KERNEL DEBUG_KOBJECT DEBUG_LIST DETECT_HUNG_TASK HARDLOCKUP_DETECTOR HAVE_RELIABLE_STACKTRACE KASAN MAGIC_SYSRQ_SERIAL PERF_EVENTS PRINTK_TIME PROVE_LOCKING PROVE_RCU SOFTLOCKUP_DETECTOR STACKPROTECTOR_STRONG STACK_VALIDATION UBSAN UBSAN_SANITIZE_ALL UNWINDER_FRAME_POINTER WQ_WATCHDOG Jason