Lines Matching refs:obj
115 struct debug_obj *obj; in lookup_object() local
118 hlist_for_each_entry(obj, &b->list, node) { in lookup_object()
120 if (obj->object == addr) in lookup_object()
121 return obj; in lookup_object()
136 struct debug_obj *obj = NULL; in alloc_object() local
140 obj = hlist_entry(obj_pool.first, typeof(*obj), node); in alloc_object()
142 obj->object = addr; in alloc_object()
143 obj->descr = descr; in alloc_object()
144 obj->state = ODEBUG_STATE_NONE; in alloc_object()
145 obj->astate = 0; in alloc_object()
146 hlist_del(&obj->node); in alloc_object()
148 hlist_add_head(&obj->node, &b->list); in alloc_object()
160 return obj; in alloc_object()
168 struct debug_obj *obj; in free_obj_work() local
173 obj = hlist_entry(obj_pool.first, typeof(*obj), node); in free_obj_work()
174 hlist_del(&obj->node); in free_obj_work()
181 kmem_cache_free(obj_cache, obj); in free_obj_work()
191 static void free_object(struct debug_obj *obj) in free_object() argument
203 hlist_add_head(&obj->node, &obj_pool); in free_object()
220 struct debug_obj *obj; in debug_objects_oom() local
232 hlist_for_each_entry_safe(obj, tmp, &freelist, node) { in debug_objects_oom()
233 hlist_del(&obj->node); in debug_objects_oom()
234 free_object(obj); in debug_objects_oom()
251 static void debug_print_object(struct debug_obj *obj, char *msg) in debug_print_object() argument
253 struct debug_obj_descr *descr = obj->descr; in debug_print_object()
258 descr->debug_hint(obj->object) : NULL; in debug_print_object()
262 msg, obj_states[obj->state], obj->astate, in debug_print_object()
309 struct debug_obj *obj; in __debug_object_init() local
318 obj = lookup_object(addr, db); in __debug_object_init()
319 if (!obj) { in __debug_object_init()
320 obj = alloc_object(addr, db, descr); in __debug_object_init()
321 if (!obj) { in __debug_object_init()
330 switch (obj->state) { in __debug_object_init()
334 obj->state = ODEBUG_STATE_INIT; in __debug_object_init()
338 debug_print_object(obj, "init"); in __debug_object_init()
339 state = obj->state; in __debug_object_init()
345 debug_print_object(obj, "init"); in __debug_object_init()
391 struct debug_obj *obj; in debug_object_activate() local
405 obj = lookup_object(addr, db); in debug_object_activate()
406 if (obj) { in debug_object_activate()
407 switch (obj->state) { in debug_object_activate()
410 obj->state = ODEBUG_STATE_ACTIVE; in debug_object_activate()
415 debug_print_object(obj, "activate"); in debug_object_activate()
416 state = obj->state; in debug_object_activate()
422 debug_print_object(obj, "activate"); in debug_object_activate()
455 struct debug_obj *obj; in debug_object_deactivate() local
465 obj = lookup_object(addr, db); in debug_object_deactivate()
466 if (obj) { in debug_object_deactivate()
467 switch (obj->state) { in debug_object_deactivate()
471 if (!obj->astate) in debug_object_deactivate()
472 obj->state = ODEBUG_STATE_INACTIVE; in debug_object_deactivate()
474 debug_print_object(obj, "deactivate"); in debug_object_deactivate()
478 debug_print_object(obj, "deactivate"); in debug_object_deactivate()
503 struct debug_obj *obj; in debug_object_destroy() local
513 obj = lookup_object(addr, db); in debug_object_destroy()
514 if (!obj) in debug_object_destroy()
517 switch (obj->state) { in debug_object_destroy()
521 obj->state = ODEBUG_STATE_DESTROYED; in debug_object_destroy()
524 debug_print_object(obj, "destroy"); in debug_object_destroy()
525 state = obj->state; in debug_object_destroy()
531 debug_print_object(obj, "destroy"); in debug_object_destroy()
549 struct debug_obj *obj; in debug_object_free() local
559 obj = lookup_object(addr, db); in debug_object_free()
560 if (!obj) in debug_object_free()
563 switch (obj->state) { in debug_object_free()
565 debug_print_object(obj, "free"); in debug_object_free()
566 state = obj->state; in debug_object_free()
571 hlist_del(&obj->node); in debug_object_free()
573 free_object(obj); in debug_object_free()
588 struct debug_obj *obj; in debug_object_assert_init() local
598 obj = lookup_object(addr, db); in debug_object_assert_init()
599 if (!obj) { in debug_object_assert_init()
630 struct debug_obj *obj; in debug_object_active_state() local
640 obj = lookup_object(addr, db); in debug_object_active_state()
641 if (obj) { in debug_object_active_state()
642 switch (obj->state) { in debug_object_active_state()
644 if (obj->astate == expect) in debug_object_active_state()
645 obj->astate = next; in debug_object_active_state()
647 debug_print_object(obj, "active_state"); in debug_object_active_state()
651 debug_print_object(obj, "active_state"); in debug_object_active_state()
674 struct debug_obj *obj; in __debug_check_no_obj_freed() local
689 hlist_for_each_entry_safe(obj, tmp, &db->list, node) { in __debug_check_no_obj_freed()
691 oaddr = (unsigned long) obj->object; in __debug_check_no_obj_freed()
695 switch (obj->state) { in __debug_check_no_obj_freed()
697 debug_print_object(obj, "free"); in __debug_check_no_obj_freed()
698 descr = obj->descr; in __debug_check_no_obj_freed()
699 state = obj->state; in __debug_check_no_obj_freed()
705 hlist_del(&obj->node); in __debug_check_no_obj_freed()
706 hlist_add_head(&obj->node, &freelist); in __debug_check_no_obj_freed()
713 hlist_for_each_entry_safe(obj, tmp, &freelist, node) { in __debug_check_no_obj_freed()
714 hlist_del(&obj->node); in __debug_check_no_obj_freed()
715 free_object(obj); in __debug_check_no_obj_freed()
802 struct self_test *obj = addr; in fixup_init() local
806 debug_object_deactivate(obj, &descr_type_test); in fixup_init()
807 debug_object_init(obj, &descr_type_test); in fixup_init()
821 struct self_test *obj = addr; in fixup_activate() local
825 if (obj->static_init == 1) { in fixup_activate()
826 debug_object_init(obj, &descr_type_test); in fixup_activate()
827 debug_object_activate(obj, &descr_type_test); in fixup_activate()
833 debug_object_deactivate(obj, &descr_type_test); in fixup_activate()
834 debug_object_activate(obj, &descr_type_test); in fixup_activate()
848 struct self_test *obj = addr; in fixup_destroy() local
852 debug_object_deactivate(obj, &descr_type_test); in fixup_destroy()
853 debug_object_destroy(obj, &descr_type_test); in fixup_destroy()
866 struct self_test *obj = addr; in fixup_free() local
870 debug_object_deactivate(obj, &descr_type_test); in fixup_free()
871 debug_object_free(obj, &descr_type_test); in fixup_free()
882 struct debug_obj *obj; in check_results() local
890 obj = lookup_object(addr, db); in check_results()
891 if (!obj && state != ODEBUG_STATE_NONE) { in check_results()
895 if (obj && obj->state != state) { in check_results()
897 obj->state, state); in check_results()
926 static __initdata struct self_test obj = { .static_init = 0 }; variable
939 debug_object_init(&obj, &descr_type_test); in debug_objects_selftest()
940 if (check_results(&obj, ODEBUG_STATE_INIT, fixups, warnings)) in debug_objects_selftest()
942 debug_object_activate(&obj, &descr_type_test); in debug_objects_selftest()
943 if (check_results(&obj, ODEBUG_STATE_ACTIVE, fixups, warnings)) in debug_objects_selftest()
945 debug_object_activate(&obj, &descr_type_test); in debug_objects_selftest()
946 if (check_results(&obj, ODEBUG_STATE_ACTIVE, ++fixups, ++warnings)) in debug_objects_selftest()
948 debug_object_deactivate(&obj, &descr_type_test); in debug_objects_selftest()
949 if (check_results(&obj, ODEBUG_STATE_INACTIVE, fixups, warnings)) in debug_objects_selftest()
951 debug_object_destroy(&obj, &descr_type_test); in debug_objects_selftest()
952 if (check_results(&obj, ODEBUG_STATE_DESTROYED, fixups, warnings)) in debug_objects_selftest()
954 debug_object_init(&obj, &descr_type_test); in debug_objects_selftest()
955 if (check_results(&obj, ODEBUG_STATE_DESTROYED, fixups, ++warnings)) in debug_objects_selftest()
957 debug_object_activate(&obj, &descr_type_test); in debug_objects_selftest()
958 if (check_results(&obj, ODEBUG_STATE_DESTROYED, fixups, ++warnings)) in debug_objects_selftest()
960 debug_object_deactivate(&obj, &descr_type_test); in debug_objects_selftest()
961 if (check_results(&obj, ODEBUG_STATE_DESTROYED, fixups, ++warnings)) in debug_objects_selftest()
963 debug_object_free(&obj, &descr_type_test); in debug_objects_selftest()
964 if (check_results(&obj, ODEBUG_STATE_NONE, fixups, warnings)) in debug_objects_selftest()
967 obj.static_init = 1; in debug_objects_selftest()
968 debug_object_activate(&obj, &descr_type_test); in debug_objects_selftest()
969 if (check_results(&obj, ODEBUG_STATE_ACTIVE, fixups, warnings)) in debug_objects_selftest()
971 debug_object_init(&obj, &descr_type_test); in debug_objects_selftest()
972 if (check_results(&obj, ODEBUG_STATE_INIT, ++fixups, ++warnings)) in debug_objects_selftest()
974 debug_object_free(&obj, &descr_type_test); in debug_objects_selftest()
975 if (check_results(&obj, ODEBUG_STATE_NONE, fixups, warnings)) in debug_objects_selftest()
979 debug_object_init(&obj, &descr_type_test); in debug_objects_selftest()
980 if (check_results(&obj, ODEBUG_STATE_INIT, fixups, warnings)) in debug_objects_selftest()
982 debug_object_activate(&obj, &descr_type_test); in debug_objects_selftest()
983 if (check_results(&obj, ODEBUG_STATE_ACTIVE, fixups, warnings)) in debug_objects_selftest()
985 __debug_check_no_obj_freed(&obj, sizeof(obj)); in debug_objects_selftest()
986 if (check_results(&obj, ODEBUG_STATE_NONE, ++fixups, ++warnings)) in debug_objects_selftest()
1025 struct debug_obj *obj, *new; in debug_objects_replace_static_objects() local
1030 obj = kmem_cache_zalloc(obj_cache, GFP_KERNEL); in debug_objects_replace_static_objects()
1031 if (!obj) in debug_objects_replace_static_objects()
1033 hlist_add_head(&obj->node, &objects); in debug_objects_replace_static_objects()
1044 hlist_for_each_entry_safe(obj, tmp, &obj_pool, node) in debug_objects_replace_static_objects()
1045 hlist_del(&obj->node); in debug_objects_replace_static_objects()
1053 hlist_for_each_entry(obj, &objects, node) { in debug_objects_replace_static_objects()
1054 new = hlist_entry(obj_pool.first, typeof(*obj), node); in debug_objects_replace_static_objects()
1057 *new = *obj; in debug_objects_replace_static_objects()
1068 hlist_for_each_entry_safe(obj, tmp, &objects, node) { in debug_objects_replace_static_objects()
1069 hlist_del(&obj->node); in debug_objects_replace_static_objects()
1070 kmem_cache_free(obj_cache, obj); in debug_objects_replace_static_objects()