Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 31772
b: refs/heads/master
c: 9e7f4d4
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Jul 3, 2006
1 parent b3aa00b commit a5df08e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 61f4c3d6db3ecbdd4e1a2a7a1710c1410d085dd1
refs/heads/master: 9e7f4d451e99b7592a96ad0efaf8bcc1e7b2f854
30 changes: 15 additions & 15 deletions trunk/kernel/mutex-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ void debug_mutex_set_owner(struct mutex *lock,
struct thread_info *new_owner __IP_DECL__)
{
lock->owner = new_owner;
DEBUG_WARN_ON(!list_empty(&lock->held_list));
DEBUG_LOCKS_WARN_ON(!list_empty(&lock->held_list));
if (debug_mutex_on) {
list_add_tail(&lock->held_list, &debug_mutex_held_locks);
lock->acquire_ip = ip;
Expand All @@ -389,22 +389,22 @@ void debug_mutex_init_waiter(struct mutex_waiter *waiter)

void debug_mutex_wake_waiter(struct mutex *lock, struct mutex_waiter *waiter)
{
SMP_DEBUG_WARN_ON(!spin_is_locked(&lock->wait_lock));
DEBUG_WARN_ON(list_empty(&lock->wait_list));
DEBUG_WARN_ON(waiter->magic != waiter);
DEBUG_WARN_ON(list_empty(&waiter->list));
SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock));
DEBUG_LOCKS_WARN_ON(list_empty(&lock->wait_list));
DEBUG_LOCKS_WARN_ON(waiter->magic != waiter);
DEBUG_LOCKS_WARN_ON(list_empty(&waiter->list));
}

void debug_mutex_free_waiter(struct mutex_waiter *waiter)
{
DEBUG_WARN_ON(!list_empty(&waiter->list));
DEBUG_LOCKS_WARN_ON(!list_empty(&waiter->list));
memset(waiter, MUTEX_DEBUG_FREE, sizeof(*waiter));
}

void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
struct thread_info *ti __IP_DECL__)
{
SMP_DEBUG_WARN_ON(!spin_is_locked(&lock->wait_lock));
SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock));
check_deadlock(lock, 0, ti, ip);
/* Mark the current thread as blocked on the lock: */
ti->task->blocked_on = waiter;
Expand All @@ -414,9 +414,9 @@ void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,
struct thread_info *ti)
{
DEBUG_WARN_ON(list_empty(&waiter->list));
DEBUG_WARN_ON(waiter->task != ti->task);
DEBUG_WARN_ON(ti->task->blocked_on != waiter);
DEBUG_LOCKS_WARN_ON(list_empty(&waiter->list));
DEBUG_LOCKS_WARN_ON(waiter->task != ti->task);
DEBUG_LOCKS_WARN_ON(ti->task->blocked_on != waiter);
ti->task->blocked_on = NULL;

list_del_init(&waiter->list);
Expand All @@ -425,11 +425,11 @@ void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,

void debug_mutex_unlock(struct mutex *lock)
{
DEBUG_WARN_ON(lock->magic != lock);
DEBUG_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);
DEBUG_WARN_ON(lock->owner != current_thread_info());
DEBUG_LOCKS_WARN_ON(lock->magic != lock);
DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);
DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
if (debug_mutex_on) {
DEBUG_WARN_ON(list_empty(&lock->held_list));
DEBUG_LOCKS_WARN_ON(list_empty(&lock->held_list));
list_del_init(&lock->held_list);
}
}
Expand All @@ -456,7 +456,7 @@ void debug_mutex_init(struct mutex *lock, const char *name)
*/
void fastcall mutex_destroy(struct mutex *lock)
{
DEBUG_WARN_ON(mutex_is_locked(lock));
DEBUG_LOCKS_WARN_ON(mutex_is_locked(lock));
lock->magic = NULL;
}

Expand Down
14 changes: 7 additions & 7 deletions trunk/kernel/mutex-debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ extern void debug_mutex_init(struct mutex *lock, const char *name);
do { \
struct mutex *l = container_of(lock, struct mutex, wait_lock); \
\
DEBUG_WARN_ON(in_interrupt()); \
DEBUG_LOCKS_WARN_ON(in_interrupt()); \
debug_spin_lock_save(&debug_mutex_lock, flags); \
spin_lock(lock); \
DEBUG_WARN_ON(l->magic != l); \
DEBUG_LOCKS_WARN_ON(l->magic != l); \
} while (0)

#define spin_unlock_mutex(lock, flags) \
Expand All @@ -95,7 +95,7 @@ do { \
} \
} while (0)

#define DEBUG_WARN_ON(c) \
#define DEBUG_LOCKS_WARN_ON(c) \
do { \
if (unlikely(c && debug_mutex_on)) { \
DEBUG_OFF(); \
Expand All @@ -110,10 +110,10 @@ do { \
} while (0)

#ifdef CONFIG_SMP
# define SMP_DEBUG_WARN_ON(c) DEBUG_WARN_ON(c)
# define SMP_DEBUG_BUG_ON(c) DEBUG_BUG_ON(c)
# define SMP_DEBUG_LOCKS_WARN_ON(c) DEBUG_LOCKS_WARN_ON(c)
# define SMP_DEBUG_BUG_ON(c) DEBUG_BUG_ON(c)
#else
# define SMP_DEBUG_WARN_ON(c) do { } while (0)
# define SMP_DEBUG_BUG_ON(c) do { } while (0)
# define SMP_DEBUG_LOCKS_WARN_ON(c) do { } while (0)
# define SMP_DEBUG_BUG_ON(c) do { } while (0)
#endif

6 changes: 3 additions & 3 deletions trunk/kernel/mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ __mutex_lock_common(struct mutex *lock, long state __IP_DECL__)

debug_mutex_free_waiter(&waiter);

DEBUG_WARN_ON(list_empty(&lock->held_list));
DEBUG_WARN_ON(lock->owner != task->thread_info);
DEBUG_LOCKS_WARN_ON(list_empty(&lock->held_list));
DEBUG_LOCKS_WARN_ON(lock->owner != task->thread_info);

return 0;
}
Expand All @@ -206,7 +206,7 @@ __mutex_unlock_slowpath(atomic_t *lock_count __IP_DECL__)
struct mutex *lock = container_of(lock_count, struct mutex, count);
unsigned long flags;

DEBUG_WARN_ON(lock->owner != current_thread_info());
DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());

spin_lock_mutex(&lock->wait_lock, flags);

Expand Down
2 changes: 1 addition & 1 deletion trunk/kernel/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define mutex_remove_waiter(lock, waiter, ti) \
__list_del((waiter)->list.prev, (waiter)->list.next)

#define DEBUG_WARN_ON(c) do { } while (0)
#define DEBUG_LOCKS_WARN_ON(c) do { } while (0)
#define debug_mutex_set_owner(lock, new_owner) do { } while (0)
#define debug_mutex_clear_owner(lock) do { } while (0)
#define debug_mutex_init_waiter(waiter) do { } while (0)
Expand Down

0 comments on commit a5df08e

Please sign in to comment.