From: Eric Dumazet <eric.dumazet@gmail.com>
To: Anton Blanchard <anton@samba.org>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: Warning in net/ipv4/af_inet.c:154
Date: Thu, 27 May 2010 06:18:46 +0200 [thread overview]
Message-ID: <1274933926.2542.26.camel@edumazet-laptop> (raw)
In-Reply-To: <20100527035617.GB28295@kryten>
Le jeudi 27 mai 2010 à 13:56 +1000, Anton Blanchard a écrit :
> Hi Eric,
>
> > You are 100% right David, maybe we should add a test when changing
> > sk_forward_alloc to test if socket is locked (lockdep only test), but
> > that's for 2.6.36 :)
>
> Thanks for the patch, unfortunately I can still hit the WARN_ON. I'm somewhat
> confused by the two stage locking in the socket lock (ie sk_lock.slock and
> sk_lock.owned).
>
> What state should the socket lock be in for serialising updates of
> sk_forward_alloc? In some cases we appear to update it with sk_lock.slock =
> unlocked, sk_lock.owned = 1:
>
> NIP [c0000000005b4ad0] .sock_queue_rcv_skb
> LR [c0000000005b4acc] .sock_queue_rcv_skb
> Call Trace:
> [c0000000005f9fcc] .ip_queue_rcv_skb
> [c00000000061d604] .__udp_queue_rcv_skb
> [c0000000005b1a38] .release_sock
> [c0000000006205f0] .udp_sendmsg
> [c0000000006290d4] .inet_sendmsg
> [c0000000005abfb4] .sock_sendmsg
> [c0000000005ae9dc] .SyS_sendto
> [c0000000005ab6c0] .SyS_send
>
> And other times we update it with sk_lock.slock = locked, sk_lock.owned = 0:
>
> NIP [c0000000005b2b6c] .sock_rfree
> LR [c0000000005b2b68] .sock_rfree
> Call Trace:
> [c0000000005bca10] .skb_free_datagram_locked
> [c00000000061fe88] .udp_recvmsg
> [c0000000006285e8] .inet_recvmsg
> [c0000000005abe0c] .sock_recvmsg
> [c0000000005ae358] .SyS_recvfrom
>
> I see we sometimes take sk_lock.slock then check the owned field, but we
> aren't doing that all the time.
>
Old rule was :
A Process context was using
lock + test_and_set_or_sleep + unlock (sk_lock.slock = unlocked,
sk_lock.owned = 1)
softirq handler was using :
(sk_lock.slock = locked, sk_lock.owned =0)
I added a shortcut, but it seems wrong as is
Process context :
lock only (sk_lock.slock = locked, sk_lock.owned = ???)
So I should add a test on owned. If set (by another thread), we should take the slow path.
Thanks !
next prev parent reply other threads:[~2010-05-27 4:18 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-25 11:58 Warning in net/ipv4/af_inet.c:154 Anton Blanchard
2010-05-25 15:27 ` Eric Dumazet
2010-05-26 3:19 ` Anton Blanchard
2010-05-26 5:18 ` Eric Dumazet
2010-05-26 7:56 ` David Miller
2010-05-26 10:12 ` Eric Dumazet
2010-05-27 3:56 ` Anton Blanchard
2010-05-27 4:06 ` David Miller
2010-05-27 4:21 ` Eric Dumazet
2010-05-27 4:18 ` Eric Dumazet [this message]
2010-05-27 4:21 ` David Miller
2010-05-27 5:06 ` [PATCH] net: fix lock_sock_bh/unlock_sock_bh Eric Dumazet
2010-05-27 5:20 ` Eric Dumazet
2010-05-27 5:23 ` David Miller
2010-05-27 6:09 ` Anton Blanchard
2010-05-27 7:29 ` David Miller
2010-05-29 7:21 ` Warning in net/ipv4/af_inet.c:154 David Miller
2010-05-31 16:02 ` [PATCH] net: sock_queue_err_skb() dont mess with sk_forward_alloc Eric Dumazet
2010-06-01 6:44 ` David Miller
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=1274933926.2542.26.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=anton@samba.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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