Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'core-debugobjects-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'core-debugobjects-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
debugobjects: Add hint for better object identification

+28 -4
+4 -1
include/linux/debugobjects.h
··· 34 34 35 35 /** 36 36 * struct debug_obj_descr - object type specific debug description structure 37 + * 37 38 * @name: name of the object typee 39 + * @debug_hint: function returning address, which have associated 40 + * kernel symbol, to allow identify the object 38 41 * @fixup_init: fixup function, which is called when the init check 39 42 * fails 40 43 * @fixup_activate: fixup function, which is called when the activate check ··· 49 46 */ 50 47 struct debug_obj_descr { 51 48 const char *name; 52 - 49 + void *(*debug_hint) (void *addr); 53 50 int (*fixup_init) (void *addr, enum debug_obj_state state); 54 51 int (*fixup_activate) (void *addr, enum debug_obj_state state); 55 52 int (*fixup_destroy) (void *addr, enum debug_obj_state state);
+6
kernel/hrtimer.c
··· 334 334 335 335 static struct debug_obj_descr hrtimer_debug_descr; 336 336 337 + static void *hrtimer_debug_hint(void *addr) 338 + { 339 + return ((struct hrtimer *) addr)->function; 340 + } 341 + 337 342 /* 338 343 * fixup_init is called when: 339 344 * - an active object is initialized ··· 398 393 399 394 static struct debug_obj_descr hrtimer_debug_descr = { 400 395 .name = "hrtimer", 396 + .debug_hint = hrtimer_debug_hint, 401 397 .fixup_init = hrtimer_fixup_init, 402 398 .fixup_activate = hrtimer_fixup_activate, 403 399 .fixup_free = hrtimer_fixup_free,
+6
kernel/timer.c
··· 404 404 405 405 static struct debug_obj_descr timer_debug_descr; 406 406 407 + static void *timer_debug_hint(void *addr) 408 + { 409 + return ((struct timer_list *) addr)->function; 410 + } 411 + 407 412 /* 408 413 * fixup_init is called when: 409 414 * - an active object is initialized ··· 482 477 483 478 static struct debug_obj_descr timer_debug_descr = { 484 479 .name = "timer_list", 480 + .debug_hint = timer_debug_hint, 485 481 .fixup_init = timer_fixup_init, 486 482 .fixup_activate = timer_fixup_activate, 487 483 .fixup_free = timer_fixup_free,
+6
kernel/workqueue.c
··· 316 316 317 317 static struct debug_obj_descr work_debug_descr; 318 318 319 + static void *work_debug_hint(void *addr) 320 + { 321 + return ((struct work_struct *) addr)->func; 322 + } 323 + 319 324 /* 320 325 * fixup_init is called when: 321 326 * - an active object is initialized ··· 392 387 393 388 static struct debug_obj_descr work_debug_descr = { 394 389 .name = "work_struct", 390 + .debug_hint = work_debug_hint, 395 391 .fixup_init = work_fixup_init, 396 392 .fixup_activate = work_fixup_activate, 397 393 .fixup_free = work_fixup_free,
+6 -3
lib/debugobjects.c
··· 249 249 250 250 static void debug_print_object(struct debug_obj *obj, char *msg) 251 251 { 252 + struct debug_obj_descr *descr = obj->descr; 252 253 static int limit; 253 254 254 - if (limit < 5 && obj->descr != descr_test) { 255 + if (limit < 5 && descr != descr_test) { 256 + void *hint = descr->debug_hint ? 257 + descr->debug_hint(obj->object) : NULL; 255 258 limit++; 256 259 WARN(1, KERN_ERR "ODEBUG: %s %s (active state %u) " 257 - "object type: %s\n", 260 + "object type: %s hint: %pS\n", 258 261 msg, obj_states[obj->state], obj->astate, 259 - obj->descr->name); 262 + descr->name, hint); 260 263 } 261 264 debug_objects_warnings++; 262 265 }