netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Jiri Pirko <jiri@resnulli.us>,
	netdev@vger.kernel.org, davem@davemloft.net, idosch@mellanox.com,
	eladr@mellanox.com, yotamg@mellanox.com, nogahf@mellanox.com,
	arkadis@mellanox.com, ogerlitz@mellanox.com,
	roopa@cumulusnetworks.com, dsa@cumulusnetworks.com,
	nikolay@cumulusnetworks.com, andy@greyhouse.net,
	vivien.didelot@savoirfairelinux.com, andrew@lunn.ch,
	f.fainelli@gmail.com, alexander.h.duyck@intel.com,
	kaber@trash.net
Subject: Re: [patch net-next v2 09/11] ipv4: fib: Add an API to request a FIB dump
Date: Thu, 24 Nov 2016 10:47:58 +0200	[thread overview]
Message-ID: <20161124084758.q5uh7lr55pwwhxoh@splinter> (raw)
In-Reply-To: <6d57dab8-2c83-501e-f3ee-0bad0b72efbb@stressinduktion.org>

On Thu, Nov 24, 2016 at 12:04:57AM +0100, Hannes Frederic Sowa wrote:
> On 23.11.2016 20:53, Ido Schimmel wrote:
> > On Wed, Nov 23, 2016 at 06:47:03PM +0100, Hannes Frederic Sowa wrote:
> >> Hmm, I think you need to read the sequence counter under rtnl_lock to
> >> have an ordering with the rest of the updates to the RCU trie. Otherwise
> >> you don't know if the fib trie has the correct view regarding to the
> >> incoming notifications as a whole. This is also necessary during restarts.
> >
> > I spent quite a lot of time thinking about this specific issue, but I
> > couldn't convince myself that the read should be done under RTNL and I'm
> > not sure I understand your reasoning. Can you please elaborate?
> >
> > If, before each notification sent, we call atomic_inc() and then call
> > atomic_read() at the end, then how can we be tricked?
> 
> The race I am suspecting to happen is:
> 
> <CPU0> fib_register()
> 
> <CPU1> delete route by notifier
> <CPU1> enqueue delete cmd into ordered queue
> 
> <CPU0> starts dump
> <CPU0> sees deleted route by CPU1 because route not yet removed from RCU
> <CPU0> enqueues route for addition

Yea, I missed this trivial case... My mind was fixed on problems that
could happen after the dump already started. :(

Regarding your suggestion, I think the API will be more useful if we
don't bundle fib_register() and fib_dump() together. We can do the
following instead:

1) Sum 'fib_seq' (doesn't need to be atomic_t anymore) from all net
namespaces under RTNL
2) Dump FIB tables under RCU
3) Do 1) again
4) Compare results from 1) and 3) and retry (according to sysctl limit)
if results differ. Before each retry the module's callback (if passed)
will be invoked.

Sounds OK?

  reply	other threads:[~2016-11-24  8:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-23 14:34 [patch net-next v2 00/11] ipv4: fib: Allow modules to dump FIB tables Jiri Pirko
2016-11-23 14:34 ` [patch net-next v2 01/11] ipv4: fib: Export free_fib_info() Jiri Pirko
2016-11-23 14:34 ` [patch net-next v2 02/11] ipv4: fib: Add fib_info_hold() helper Jiri Pirko
2016-11-23 14:34 ` [patch net-next v2 03/11] mlxsw: core: Create an ordered workqueue for FIB offload Jiri Pirko
2016-11-23 14:34 ` [patch net-next v2 04/11] mlxsw: spectrum_router: Implement FIB offload in deferred work Jiri Pirko
2016-11-23 14:34 ` [patch net-next v2 05/11] rocker: Create an ordered workqueue for FIB offload Jiri Pirko
2016-11-23 14:34 ` [patch net-next v2 06/11] rocker: Implement FIB offload in deferred work Jiri Pirko
2016-11-23 14:34 ` [patch net-next v2 07/11] ipv4: fib: Convert FIB notification chain to be atomic Jiri Pirko
2016-11-23 14:34 ` [patch net-next v2 08/11] ipv4: fib: Allow for consistent FIB dumping Jiri Pirko
2016-11-23 14:34 ` [patch net-next v2 09/11] ipv4: fib: Add an API to request a FIB dump Jiri Pirko
2016-11-23 17:47   ` Hannes Frederic Sowa
2016-11-23 19:53     ` Ido Schimmel
2016-11-23 23:04       ` Hannes Frederic Sowa
2016-11-24  8:47         ` Ido Schimmel [this message]
2016-11-24 12:34           ` Hannes Frederic Sowa
2016-11-23 14:48 ` [patch net-next v2 10/11] mlxsw: spectrum_router: Request a dump of FIB tables during init Jiri Pirko
2016-11-23 16:00   ` Hannes Frederic Sowa
2016-11-23 16:04     ` Jiri Pirko
2016-11-23 16:59       ` Hannes Frederic Sowa
2016-11-23 17:04         ` Jiri Pirko
2016-11-23 17:08           ` Hannes Frederic Sowa
2016-11-23 19:22             ` Ido Schimmel
2016-11-23 19:45               ` Jiri Pirko
2016-11-23 14:48 ` [patch net-next v2 11/11] rocker: Register FIB notifier before creating ports Jiri Pirko

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=20161124084758.q5uh7lr55pwwhxoh@splinter \
    --to=idosch@idosch.org \
    --cc=alexander.h.duyck@intel.com \
    --cc=andrew@lunn.ch \
    --cc=andy@greyhouse.net \
    --cc=arkadis@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=eladr@mellanox.com \
    --cc=f.fainelli@gmail.com \
    --cc=hannes@stressinduktion.org \
    --cc=idosch@mellanox.com \
    --cc=jiri@resnulli.us \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=nogahf@mellanox.com \
    --cc=ogerlitz@mellanox.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=vivien.didelot@savoirfairelinux.com \
    --cc=yotamg@mellanox.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).