netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Andy Roulin <aroulin@nvidia.com>
Cc: Francesco Ruggeri <fruggeri@arista.com>, netdev@vger.kernel.org
Subject: Re: neighbour netlink notifications delivered in wrong order
Date: Tue, 11 Apr 2023 18:22:43 -0700	[thread overview]
Message-ID: <20230411182243.120bf51e@hermes.local> (raw)
In-Reply-To: <20230411174131.634e35d3@hermes.local>

On Tue, 11 Apr 2023 17:41:31 -0700
Stephen Hemminger <stephen@networkplumber.org> wrote:

> > >> Neigh info is already protected by RCU, is per neighbour reader/writer lock
> > >> still needed at all?  

Yes there is nothing that prevents an incoming packet changing the contents
of a neighbour entry
  
> > > 
> > > The goal of the patch seems to be to make changing a neighbour's state and
> > > delivering the corresponding notification atomic, in order to prevent
> > > reordering of notifications. It uses the existing lock to do so.
> > > Can reordering be prevented if the lock is replaced with rcu?    
> > 
> > Yes that's the goal of the patch. I'd have to look in more details if 
> > there's a better solution with RCU.  
> 
> But the patch would update ndm->ndm_state based on neigh, but there
> is nothing ensuring that neigh is not going to be deleted or modified.

Making the update atomic would require a redesign of the locking here.
The update would have to acquire the write lock, modify, then call
the code that generates the message; drop the write lock and then
queue the message to the netlink socket.


      reply	other threads:[~2023-04-12  1:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-06 23:01 neighbour netlink notifications delivered in wrong order Francesco Ruggeri
2022-06-07  2:07 ` Andy Roulin
2022-06-07  3:19   ` Stephen Hemminger
2022-06-07 16:29     ` Francesco Ruggeri
2022-06-07 17:32       ` Stephen Hemminger
2022-06-07 20:03         ` Francesco Ruggeri
2022-06-08  3:49           ` Andy Roulin
2022-06-09 16:40             ` Francesco Ruggeri
2022-06-10 16:18               ` Francesco Ruggeri
2022-06-16 18:33                 ` Andy Roulin
2023-04-11 19:49                   ` Kevin Mitchell
2023-04-12  0:41             ` Stephen Hemminger
2023-04-12  1:22               ` Stephen Hemminger [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=20230411182243.120bf51e@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=aroulin@nvidia.com \
    --cc=fruggeri@arista.com \
    --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;
as well as URLs for NNTP newsgroup(s).