diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-15 21:23:25 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-15 21:23:25 -0400 |
| commit | c345f60a5f58a65004f22fb0d257d65ec1528310 (patch) | |
| tree | d82d4a9de6034534a4408495c63f992ed9b524b5 | |
| parent | 422e6c4bc4b48c15b3cb57a1ca71431abfc57e54 (diff) | |
| parent | 997772884036e6e121de39322179989154437d9f (diff) | |
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
| -rw-r--r-- | include/linux/debugobjects.h | 5 | ||||
| -rw-r--r-- | kernel/hrtimer.c | 6 | ||||
| -rw-r--r-- | kernel/timer.c | 6 | ||||
| -rw-r--r-- | kernel/workqueue.c | 6 | ||||
| -rw-r--r-- | lib/debugobjects.c | 9 |
5 files changed, 28 insertions, 4 deletions
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h index 597692f1fc8d..65970b811e22 100644 --- a/include/linux/debugobjects.h +++ b/include/linux/debugobjects.h | |||
| @@ -34,7 +34,10 @@ struct debug_obj { | |||
| 34 | 34 | ||
| 35 | /** | 35 | /** |
| 36 | * struct debug_obj_descr - object type specific debug description structure | 36 | * struct debug_obj_descr - object type specific debug description structure |
| 37 | * | ||
| 37 | * @name: name of the object typee | 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 | * @fixup_init: fixup function, which is called when the init check | 41 | * @fixup_init: fixup function, which is called when the init check |
| 39 | * fails | 42 | * fails |
| 40 | * @fixup_activate: fixup function, which is called when the activate check | 43 | * @fixup_activate: fixup function, which is called when the activate check |
| @@ -46,7 +49,7 @@ struct debug_obj { | |||
| 46 | */ | 49 | */ |
| 47 | struct debug_obj_descr { | 50 | struct debug_obj_descr { |
| 48 | const char *name; | 51 | const char *name; |
| 49 | 52 | void *(*debug_hint) (void *addr); | |
| 50 | int (*fixup_init) (void *addr, enum debug_obj_state state); | 53 | int (*fixup_init) (void *addr, enum debug_obj_state state); |
| 51 | int (*fixup_activate) (void *addr, enum debug_obj_state state); | 54 | int (*fixup_activate) (void *addr, enum debug_obj_state state); |
| 52 | int (*fixup_destroy) (void *addr, enum debug_obj_state state); | 55 | int (*fixup_destroy) (void *addr, enum debug_obj_state state); |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 0c8d7c048615..e38f5a073d01 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
| @@ -334,6 +334,11 @@ EXPORT_SYMBOL_GPL(ktime_add_safe); | |||
| 334 | 334 | ||
| 335 | static struct debug_obj_descr hrtimer_debug_descr; | 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 | * fixup_init is called when: | 343 | * fixup_init is called when: |
| 339 | * - an active object is initialized | 344 | * - an active object is initialized |
| @@ -393,6 +398,7 @@ static int hrtimer_fixup_free(void *addr, enum debug_obj_state state) | |||
| 393 | 398 | ||
| 394 | static struct debug_obj_descr hrtimer_debug_descr = { | 399 | static struct debug_obj_descr hrtimer_debug_descr = { |
| 395 | .name = "hrtimer", | 400 | .name = "hrtimer", |
| 401 | .debug_hint = hrtimer_debug_hint, | ||
| 396 | .fixup_init = hrtimer_fixup_init, | 402 | .fixup_init = hrtimer_fixup_init, |
| 397 | .fixup_activate = hrtimer_fixup_activate, | 403 | .fixup_activate = hrtimer_fixup_activate, |
| 398 | .fixup_free = hrtimer_fixup_free, | 404 | .fixup_free = hrtimer_fixup_free, |
diff --git a/kernel/timer.c b/kernel/timer.c index d6459923d245..33a67925d900 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
| @@ -404,6 +404,11 @@ static void timer_stats_account_timer(struct timer_list *timer) {} | |||
| 404 | 404 | ||
| 405 | static struct debug_obj_descr timer_debug_descr; | 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 | * fixup_init is called when: | 413 | * fixup_init is called when: |
| 409 | * - an active object is initialized | 414 | * - an active object is initialized |
| @@ -477,6 +482,7 @@ static int timer_fixup_free(void *addr, enum debug_obj_state state) | |||
| 477 | 482 | ||
| 478 | static struct debug_obj_descr timer_debug_descr = { | 483 | static struct debug_obj_descr timer_debug_descr = { |
| 479 | .name = "timer_list", | 484 | .name = "timer_list", |
| 485 | .debug_hint = timer_debug_hint, | ||
| 480 | .fixup_init = timer_fixup_init, | 486 | .fixup_init = timer_fixup_init, |
| 481 | .fixup_activate = timer_fixup_activate, | 487 | .fixup_activate = timer_fixup_activate, |
| 482 | .fixup_free = timer_fixup_free, | 488 | .fixup_free = timer_fixup_free, |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index ee6578b578ad..b5fe4c00eb3c 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
| @@ -316,6 +316,11 @@ static inline int __next_wq_cpu(int cpu, const struct cpumask *mask, | |||
| 316 | 316 | ||
| 317 | static struct debug_obj_descr work_debug_descr; | 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 | * fixup_init is called when: | 325 | * fixup_init is called when: |
| 321 | * - an active object is initialized | 326 | * - an active object is initialized |
| @@ -387,6 +392,7 @@ static int work_fixup_free(void *addr, enum debug_obj_state state) | |||
| 387 | 392 | ||
| 388 | static struct debug_obj_descr work_debug_descr = { | 393 | static struct debug_obj_descr work_debug_descr = { |
| 389 | .name = "work_struct", | 394 | .name = "work_struct", |
| 395 | .debug_hint = work_debug_hint, | ||
| 390 | .fixup_init = work_fixup_init, | 396 | .fixup_init = work_fixup_init, |
| 391 | .fixup_activate = work_fixup_activate, | 397 | .fixup_activate = work_fixup_activate, |
| 392 | .fixup_free = work_fixup_free, | 398 | .fixup_free = work_fixup_free, |
diff --git a/lib/debugobjects.c b/lib/debugobjects.c index deebcc57d4e6..9d86e45086f5 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c | |||
| @@ -249,14 +249,17 @@ static struct debug_bucket *get_bucket(unsigned long addr) | |||
| 249 | 249 | ||
| 250 | static void debug_print_object(struct debug_obj *obj, char *msg) | 250 | static void debug_print_object(struct debug_obj *obj, char *msg) |
| 251 | { | 251 | { |
| 252 | struct debug_obj_descr *descr = obj->descr; | ||
| 252 | static int limit; | 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 | limit++; | 258 | limit++; |
| 256 | WARN(1, KERN_ERR "ODEBUG: %s %s (active state %u) " | 259 | WARN(1, KERN_ERR "ODEBUG: %s %s (active state %u) " |
| 257 | "object type: %s\n", | 260 | "object type: %s hint: %pS\n", |
| 258 | msg, obj_states[obj->state], obj->astate, | 261 | msg, obj_states[obj->state], obj->astate, |
| 259 | obj->descr->name); | 262 | descr->name, hint); |
| 260 | } | 263 | } |
| 261 | debug_objects_warnings++; | 264 | debug_objects_warnings++; |
| 262 | } | 265 | } |
