[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1385569075.5352.12.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Wed, 27 Nov 2013 08:17:55 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Veaceslav Falico <vfalico@...hat.com>
Cc: netdev@...r.kernel.org, jstancek@...hat.com,
"David S. Miller" <davem@...emloft.net>,
Daniel Borkmann <dborkman@...hat.com>,
Willem de Bruijn <willemb@...gle.com>,
Phil Sutter <phil@....cc>, Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net] af_packet: use spin_lock_bh() for sk_buff_head
On Wed, 2013-11-27 at 13:57 +0100, Veaceslav Falico wrote:
> While running a debug kernel, a warning of inconsistent lock state showed
> up for sk->sk_receive_queue->lock between packet_set_ring() (actually,
> static prb_shutdown_retire_blk_timer(), which does spin_lock()) and
> sock_queue_rcv_skb(), which does spin_lock_irqsave().
>
> Fix this by converting the spin_lock() used in
> prb_shutdown_retire_blk_timer() to spin_lock_bh(), as it is used in
> packet_set_ring().
Patch is good, but description is slightly misleading.
Problem is not because sock_queue_rcv_skb() uses spin_lock_irqsave().
Problem is prb_retire_rx_blk_timer_expired() is called from softirq
context.
So if we do not block BH in prb_shutdown_retire_blk_timer() :
spin_lock(&rb_queue->lock);
pkc->delete_blk_timer = 1;
spin_unlock(&rb_queue->lock);
Timer could fire right in the middle and would spin forever trying
to acquire the same lock.
Using spin_lock_bh() prevents timer being fired on this cpu.
Thanks !
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists