Skip to contentSkip to conversation

Set a separate lockdep class for neighbour table's proxy_queue

PATCH In review Pavel Emelianov 3 participants 3 messages Apr 16, 2007 – Apr 19, 2007 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Set a separate lockdep class for neighbour table's proxy_queue

Otherwise the following calltrace will lead to a wrong lockdep warning:

  neigh_proxy_process()
    `- lock(neigh_table->proxy_queue.lock);
  arp_redo /* via tbl->proxy_redo */
  arp_process
  neigh_event_ns
  neigh_update
  skb_queue_purge
    `- lock(neighbor->arp_queue.lock);

This is not a deadlock actually, as neighbor table's proxy_queue and the neighbor's arp_queue are different queues.

Lockdep thinks there is a deadlock as both queues are initialized with skb_queue_head_init() and thus have a common class.

include/linux/skbuff.h +7 -0
@@ -628,6 +628,13 @@ static inline void skb_queue_head_init(s
 	list->qlen = 0;
 }
 
+static inline void skb_queue_head_init_class(struct sk_buff_head *list,
+		struct lock_class_key *class)
+{
+	skb_queue_head_init(list);
+	lockdep_set_class(&list->lock, class);
+}
+
 /*
  *	Insert an sk_buff at the start of a list.
  *
net/core/neighbour.c +4 -1
@@ -1327,6 +1327,8 @@ void neigh_parms_destroy(struct neigh_pa
 	kfree(parms);
 }
 
+static struct lock_class_key neigh_table_proxy_queue_class;
+
 void neigh_table_init_no_netlink(struct neigh_table *tbl)
 {
 	unsigned long now = jiffies;
@@ -1379,7 +1381,8 @@ void neigh_table_init_no_netlink(struct 
 	init_timer(&tbl->proxy_timer);
 	tbl->proxy_timer.data	  = (unsigned long)tbl;
 	tbl->proxy_timer.function = neigh_proxy_process;
-	skb_queue_head_init(&tbl->proxy_queue);
+	skb_queue_head_init_class(&tbl->proxy_queue,
+			&neigh_table_proxy_queue_class);
 
 	tbl->last_flush = now;
 	tbl->last_rand	= now + tbl->parms.reachable_time * 20;
maintainer
#1 lore raw

From: Pavel Emelianov <[email protected]>
Date: Mon, 16 Apr 2007 16:08:25 +0400

Quoted 12 lines

Otherwise the following calltrace will lead to a wrong lockdep warning:

  neigh_proxy_process()
    `- lock(neigh_table->proxy_queue.lock);
  arp_redo /* via tbl->proxy_redo */
  arp_process
  neigh_event_ns
  neigh_update
  skb_queue_purge
    `- lock(neighbor->arp_queue.lock);
Quoted 5 lines

This is not a deadlock actually, as neighbor table's proxy_queue and the neighbor's arp_queue are different queues.

Lockdep thinks there is a deadlock as both queues are initialized with skb_queue_head_init() and thus have a common class.

Patch applied, thank you.

Please provide a proper "Signed-off-by: " line in future patch submissions or else I will ignore your patches entirely.

Thanks!

#2 lore raw
Quoted 18 lines · David Miller

From: Pavel Emelianov <[email protected]>
Date: Mon, 16 Apr 2007 16:08:25 +0400

Quoted 15 lines

Otherwise the following calltrace will lead to a wrong lockdep warning:

  neigh_proxy_process()
    `- lock(neigh_table->proxy_queue.lock);
  arp_redo /* via tbl->proxy_redo */
  arp_process
  neigh_event_ns
  neigh_update
  skb_queue_purge
    `- lock(neighbor->arp_queue.lock);

This is not a deadlock actually, as neighbor table's proxy_queue and the neighbor's arp_queue are different queues.

Quoted 6 lines
Quoted 2 lines

Lockdep thinks there is a deadlock as both queues are initialized with skb_queue_head_init() and thus have a common class.

Patch applied, thank you.

Please provide a proper "Signed-off-by: " line in future patch

...

And I'd suggest to attach a lockdep's log, or some reference to it, for some born unbelievers...

Regards,
Jarek P.