netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Veaceslav Falico <vfalico@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, jstancek@redhat.com,
	"David S. Miller" <davem@davemloft.net>,
	Daniel Borkmann <dborkman@redhat.com>,
	Willem de Bruijn <willemb@google.com>, Phil Sutter <phil@nwl.cc>,
	Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH net] af_packet: use spin_lock_bh() for sk_buff_head
Date: Thu, 28 Nov 2013 08:06:23 +0100	[thread overview]
Message-ID: <20131128070623.GA24570@redhat.com> (raw)
In-Reply-To: <1385569075.5352.12.camel@edumazet-glaptop2.roam.corp.google.com>

On Wed, Nov 27, 2013 at 08:17:55AM -0800, Eric Dumazet wrote:
>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.

Yep, thank you, will reword and resubmit.

>
>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 !
>
>

      reply	other threads:[~2013-11-28  7:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 12:57 [PATCH net] af_packet: use spin_lock_bh() for sk_buff_head Veaceslav Falico
2013-11-27 16:17 ` Eric Dumazet
2013-11-28  7:06   ` Veaceslav Falico [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131128070623.GA24570@redhat.com \
    --to=vfalico@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jstancek@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=phil@nwl.cc \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).