Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1474158

Re: [RT PATCH 2/2] net: add a lock around icmp_sk()

From Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Newsgroups linux.kernel
Subject Re: [RT PATCH 2/2] net: add a lock around icmp_sk()
Date 2016-09-01 10:20 +0200
Message-ID <scvo5-6SP-9@gated-at.bofh.it> (permalink)
References <scgfn-4zJ-15@gated-at.bofh.it> <scgfn-4zJ-13@gated-at.bofh.it> <scgIp-4Kp-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2016-08-31 09:37:43 [-0700], Eric Dumazet wrote:
> > --- a/net/ipv4/icmp.c
> > +++ b/net/ipv4/icmp.c
> > @@ -216,12 +219,14 @@ static inline struct sock *icmp_xmit_lock(struct net *net)
> >  
> >  	local_bh_disable();
> >  
> > +	local_lock(icmp_sk_lock);
> 
> Deadlock alert ?
> Please read the comment few lines after, explaining why we have to use
> spin_trylock().
> Or maybe I should double check what is local_lock() in RT

On !RT local_lock() is preempt_disable().
On RT local_lock() is a per-CPU sleeping spinlock which can be taken
recursively by the owner.

On a "normal" ping reply we have
- icmp_reply()
  - icmp_xmit_lock()
    - local_lock()
  - icmp_push_reply()
 icmp_send()
    - local_lock()

so that works. I didn't manage to resolve a possible dst_link_failure()
path but I would assume it is like the above (where the owner takes the
same local_lock() multiple times).

Sebastian

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RT PATCH 2/2] net: add a lock around icmp_sk() Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-31 18:10 +0200
  Re: [RT PATCH 2/2] net: add a lock around icmp_sk() Eric Dumazet <eric.dumazet@gmail.com> - 2016-08-31 18:40 +0200
    Re: [RT PATCH 2/2] net: add a lock around icmp_sk() Steven Rostedt <rostedt@goodmis.org> - 2016-08-31 19:10 +0200
    Re: [RT PATCH 2/2] net: add a lock around icmp_sk() Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-01 10:20 +0200
      Re: [RT PATCH 2/2] net: add a lock around icmp_sk() Eric Dumazet <eric.dumazet@gmail.com> - 2016-09-01 15:20 +0200

csiph-web