mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
debugobjects: Extend to assert that an object is initialized
Calling del_timer_sync() on an uninitialized timer leads to a never ending loop in lock_timer_base() that spins checking for a non-NULL timer base. Add an assertion to debugobjects to catch usage of uninitialized objects so that we can initialize timers in the del_timer_sync() path before it calls lock_timer_base(). [ sboyd@codeaurora.org: Clarify commit message ] Signed-off-by: Christine Chan <cschan@codeaurora.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Cc: John Stultz <john.stultz@linaro.org> Link: http://lkml.kernel.org/r/1320724108-20788-3-git-send-email-sboyd@codeaurora.org Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
feac18dda2
commit
b84d435cc2
3 changed files with 94 additions and 0 deletions
|
@ -570,6 +570,44 @@ out_unlock:
|
|||
raw_spin_unlock_irqrestore(&db->lock, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* debug_object_assert_init - debug checks when object should be init-ed
|
||||
* @addr: address of the object
|
||||
* @descr: pointer to an object specific debug description structure
|
||||
*/
|
||||
void debug_object_assert_init(void *addr, struct debug_obj_descr *descr)
|
||||
{
|
||||
struct debug_bucket *db;
|
||||
struct debug_obj *obj;
|
||||
unsigned long flags;
|
||||
|
||||
if (!debug_objects_enabled)
|
||||
return;
|
||||
|
||||
db = get_bucket((unsigned long) addr);
|
||||
|
||||
raw_spin_lock_irqsave(&db->lock, flags);
|
||||
|
||||
obj = lookup_object(addr, db);
|
||||
if (!obj) {
|
||||
struct debug_obj o = { .object = addr,
|
||||
.state = ODEBUG_STATE_NOTAVAILABLE,
|
||||
.descr = descr };
|
||||
|
||||
raw_spin_unlock_irqrestore(&db->lock, flags);
|
||||
/*
|
||||
* Maybe the object is static. Let the type specific
|
||||
* code decide what to do.
|
||||
*/
|
||||
if (debug_object_fixup(descr->fixup_assert_init, addr,
|
||||
ODEBUG_STATE_NOTAVAILABLE))
|
||||
debug_print_object(&o, "assert_init");
|
||||
return;
|
||||
}
|
||||
|
||||
raw_spin_unlock_irqrestore(&db->lock, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* debug_object_active_state - debug checks object usage state machine
|
||||
* @addr: address of the object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue