mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
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: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra <peterz@infradead.org> Acked-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
fa4062e7ea
commit
a26724591e
3 changed files with 45 additions and 12 deletions
|
@ -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 {
|
||||||
};
|
};
|
||||||
|
|
||||||
#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) \
|
||||||
|
@ -111,6 +114,17 @@ struct plist_node {
|
||||||
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
|
||||||
|
@ -125,7 +139,7 @@ struct plist_node {
|
||||||
/**
|
/**
|
||||||
* 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)
|
||||||
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,
|
||||||
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,
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue