Commit a2672459 authored by Thomas Gleixner's avatar Thomas Gleixner

plist: Make plist debugging raw_spinlock aware

plists are used with spinlocks and raw_spinlocks. Change the plist
debugging to handle both types.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
parent fa4062e7
...@@ -81,7 +81,8 @@ struct plist_head { ...@@ -81,7 +81,8 @@ struct plist_head {
struct list_head prio_list; struct list_head prio_list;
struct list_head node_list; struct list_head node_list;
#ifdef CONFIG_DEBUG_PI_LIST #ifdef CONFIG_DEBUG_PI_LIST
spinlock_t *lock; raw_spinlock_t *rawlock;
spinlock_t *spinlock;
#endif #endif
}; };
...@@ -91,9 +92,11 @@ struct plist_node { ...@@ -91,9 +92,11 @@ struct plist_node {
}; };
#ifdef CONFIG_DEBUG_PI_LIST #ifdef CONFIG_DEBUG_PI_LIST
# define PLIST_HEAD_LOCK_INIT(_lock) .lock = _lock # define PLIST_HEAD_LOCK_INIT(_lock) .spinlock = _lock
# define PLIST_HEAD_LOCK_INIT_RAW(_lock) .rawlock = _lock
#else #else
# define PLIST_HEAD_LOCK_INIT(_lock) # define PLIST_HEAD_LOCK_INIT(_lock)
# define PLIST_HEAD_LOCK_INIT_RAW(_lock)
#endif #endif
#define _PLIST_HEAD_INIT(head) \ #define _PLIST_HEAD_INIT(head) \
...@@ -107,10 +110,21 @@ struct plist_node { ...@@ -107,10 +110,21 @@ struct plist_node {
*/ */
#define PLIST_HEAD_INIT(head, _lock) \ #define PLIST_HEAD_INIT(head, _lock) \
{ \ { \
_PLIST_HEAD_INIT(head), \ _PLIST_HEAD_INIT(head), \
PLIST_HEAD_LOCK_INIT(&(_lock)) \ PLIST_HEAD_LOCK_INIT(&(_lock)) \
} }
/**
* PLIST_HEAD_INIT_RAW - static struct plist_head initializer
* @head: struct plist_head variable name
* @_lock: lock to initialize for this list
*/
#define PLIST_HEAD_INIT_RAW(head, _lock) \
{ \
_PLIST_HEAD_INIT(head), \
PLIST_HEAD_LOCK_INIT_RAW(&(_lock)) \
}
/** /**
* PLIST_NODE_INIT - static struct plist_node initializer * PLIST_NODE_INIT - static struct plist_node initializer
* @node: struct plist_node variable name * @node: struct plist_node variable name
...@@ -119,13 +133,13 @@ struct plist_node { ...@@ -119,13 +133,13 @@ struct plist_node {
#define PLIST_NODE_INIT(node, __prio) \ #define PLIST_NODE_INIT(node, __prio) \
{ \ { \
.prio = (__prio), \ .prio = (__prio), \
.plist = { _PLIST_HEAD_INIT((node).plist) }, \ .plist = { _PLIST_HEAD_INIT((node).plist) }, \
} }
/** /**
* plist_head_init - dynamic struct plist_head initializer * plist_head_init - dynamic struct plist_head initializer
* @head: &struct plist_head pointer * @head: &struct plist_head pointer
* @lock: list spinlock, remembered for debugging * @lock: spinlock protecting the list (debugging)
*/ */
static inline void static inline void
plist_head_init(struct plist_head *head, spinlock_t *lock) plist_head_init(struct plist_head *head, spinlock_t *lock)
...@@ -133,7 +147,24 @@ plist_head_init(struct plist_head *head, spinlock_t *lock) ...@@ -133,7 +147,24 @@ plist_head_init(struct plist_head *head, spinlock_t *lock)
INIT_LIST_HEAD(&head->prio_list); INIT_LIST_HEAD(&head->prio_list);
INIT_LIST_HEAD(&head->node_list); INIT_LIST_HEAD(&head->node_list);
#ifdef CONFIG_DEBUG_PI_LIST #ifdef CONFIG_DEBUG_PI_LIST
head->lock = lock; head->spinlock = lock;
head->rawlock = NULL;
#endif
}
/**
* plist_head_init_raw - dynamic struct plist_head initializer
* @head: &struct plist_head pointer
* @lock: raw_spinlock protecting the list (debugging)
*/
static inline void
plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock)
{
INIT_LIST_HEAD(&head->prio_list);
INIT_LIST_HEAD(&head->node_list);
#ifdef CONFIG_DEBUG_PI_LIST
head->rawlock = lock;
head->spinlock = NULL;
#endif #endif
} }
......
...@@ -1010,7 +1010,7 @@ void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1, ...@@ -1010,7 +1010,7 @@ void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1,
plist_add(&q->list, &hb2->chain); plist_add(&q->list, &hb2->chain);
q->lock_ptr = &hb2->lock; q->lock_ptr = &hb2->lock;
#ifdef CONFIG_DEBUG_PI_LIST #ifdef CONFIG_DEBUG_PI_LIST
q->list.plist.lock = &hb2->lock; q->list.plist.spinlock = &hb2->lock;
#endif #endif
} }
get_futex_key_refs(key2); get_futex_key_refs(key2);
...@@ -1046,7 +1046,7 @@ void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key, ...@@ -1046,7 +1046,7 @@ void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key,
q->lock_ptr = &hb->lock; q->lock_ptr = &hb->lock;
#ifdef CONFIG_DEBUG_PI_LIST #ifdef CONFIG_DEBUG_PI_LIST
q->list.plist.lock = &hb->lock; q->list.plist.spinlock = &hb->lock;
#endif #endif
wake_up_state(q->task, TASK_NORMAL); wake_up_state(q->task, TASK_NORMAL);
...@@ -1394,7 +1394,7 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb) ...@@ -1394,7 +1394,7 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb)
plist_node_init(&q->list, prio); plist_node_init(&q->list, prio);
#ifdef CONFIG_DEBUG_PI_LIST #ifdef CONFIG_DEBUG_PI_LIST
q->list.plist.lock = &hb->lock; q->list.plist.spinlock = &hb->lock;
#endif #endif
plist_add(&q->list, &hb->chain); plist_add(&q->list, &hb->chain);
q->task = current; q->task = current;
......
...@@ -54,9 +54,11 @@ static void plist_check_list(struct list_head *top) ...@@ -54,9 +54,11 @@ static void plist_check_list(struct list_head *top)
static void plist_check_head(struct plist_head *head) static void plist_check_head(struct plist_head *head)
{ {
WARN_ON(!head->lock); WARN_ON(!head->rawlock && !head->spinlock);
if (head->lock) if (head->rawlock)
WARN_ON_SMP(!spin_is_locked(head->lock)); WARN_ON_SMP(!raw_spin_is_locked(head->rawlock));
if (head->spinlock)
WARN_ON_SMP(!spin_is_locked(head->spinlock));
plist_check_list(&head->prio_list); plist_check_list(&head->prio_list);
plist_check_list(&head->node_list); plist_check_list(&head->node_list);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment