Skip to content

Commit c4db2d3

Browse files
bebarinoKAGA-KOKO
authored andcommitted
debugobjects: Print object pointer in debug_print_object()
Delayed kobject debugging (CONFIG_DEBUG_KOBJECT_RELEASE) prints the kobject pointer that's being released in kobject_release() before scheduling a randomly delayed work to do the actual release work. If the caller of kobject_put() frees the kobject upon return then this will typically emit a debugobject warning about freeing an active timer. Usually the release function is the function that does the kfree() of the struct containing the kobject. For example the following print is seen kobject: 'queue' (ffff888114236190): kobject_release, parent 0000000000000000 (delayed 1000) ------------[ cut here ]------------ ODEBUG: free active (active state 0) object type: timer_list hint: kobject_delayed_cleanup+0x0/0x390 but the kobject printk cannot be matched with the debug object printk because it could be any number of kobjects that was released around that time. The random delay for the work doesn't help either. Print the address of the object being tracked to help to figure out which kobject is the problem here. Note that this does not use %px here to match the other %p usage in debugobject debugging. Due to %p usage it is required to disable pointer hashing to correlate the two pointer printks. Signed-off-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20220519202201.2348343-1-swboyd@chromium.org
1 parent b7b275e commit c4db2d3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/debugobjects.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,9 @@ static void debug_print_object(struct debug_obj *obj, char *msg)
500500
descr->debug_hint(obj->object) : NULL;
501501
limit++;
502502
WARN(1, KERN_ERR "ODEBUG: %s %s (active state %u) "
503-
"object type: %s hint: %pS\n",
503+
"object: %p object type: %s hint: %pS\n",
504504
msg, obj_states[obj->state], obj->astate,
505-
descr->name, hint);
505+
obj->object, descr->name, hint);
506506
}
507507
debug_objects_warnings++;
508508
}

0 commit comments

Comments
 (0)