From: Brenden Blanco <bblanco@plumgrid.com>
To: Tom Herbert <tom@herbertland.com>
Cc: Saeed Mahameed <saeedm@dev.mellanox.co.il>,
Tariq Toukan <tariqt@mellanox.com>,
"David S. Miller" <davem@davemloft.net>,
Linux Kernel Network Developers <netdev@vger.kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Tariq Toukan <ttoukan.linux@gmail.com>,
Or Gerlitz <gerlitz.or@gmail.com>
Subject: Re: [PATCH] net/mlx4_en: protect ring->xdp_prog with rcu_read_lock
Date: Fri, 2 Sep 2016 10:50:10 -0700 [thread overview]
Message-ID: <20160902175006.GA14176@gmail.com> (raw)
In-Reply-To: <CALx6S37A9QimRinL7YAcoSh8MRn6jpJ7pMZwqGLGiTeaBoBORg@mail.gmail.com>
On Thu, Sep 01, 2016 at 04:30:28PM -0700, Tom Herbert wrote:
[...]
> > Yep, but this is an unlikely condition and the critical code here is
> > much smaller and it is more clear that the rcu_read_lock here meant to
> > protect the ring->xdp_prog under this small xdp critical section in
> > comparison to your patch where it is held across the whole RX
> > function.
>
> Note that there is already an rcu_read_lock potentially per packet
> buried in the function, if the whole function is under rcu_read_lock
> then that can be removed.
Yes I was aware of that, I had left it as-is since: 1. it seemed to be
in an exception path and less performance sensitive to nested calls, and
2. in case some future developer removed the top-level rcu_read_lock,
the finer-grained one would have been unprotected if not code reviewed
carefully.
I'll instead add a note at the top pointing out the dual need for the
lock, to address both yours and Saeed's comments.
As a side note, when considering the idea of moving the rcu_read_lock to
a more generic location (napi), I had toyed with the idea of
benchmarking to see if removing the actually-fast-path use of
rcu_read_lock in netif_receive_skb_internal could have any performance
benefit for the universal use case (non-xdp). However, that seems
completely out of scope at the moment, and only beneficial for
non-standard (IMO) .configs, besides being much harder to review. It was
showing up in perf at about 1-2% overhead in preempt=y kernels.
>
> Tom
next prev parent reply other threads:[~2016-09-02 17:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-26 20:38 [PATCH] net/mlx4_en: protect ring->xdp_prog with rcu_read_lock Brenden Blanco
2016-08-26 21:01 ` Brenden Blanco
2016-08-29 14:59 ` Tariq Toukan
2016-08-29 15:55 ` Brenden Blanco
2016-08-29 17:46 ` Tom Herbert
2016-08-30 9:35 ` Saeed Mahameed
2016-08-31 1:50 ` Brenden Blanco
2016-09-01 22:59 ` Saeed Mahameed
2016-09-01 23:30 ` Tom Herbert
2016-09-02 17:50 ` Brenden Blanco [this message]
2016-09-02 18:01 ` Brenden Blanco
2016-09-02 18:13 ` Brenden Blanco
2016-09-02 19:14 ` Tom Herbert
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=20160902175006.GA14176@gmail.com \
--to=bblanco@plumgrid.com \
--cc=alexei.starovoitov@gmail.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=gerlitz.or@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@dev.mellanox.co.il \
--cc=tariqt@mellanox.com \
--cc=tom@herbertland.com \
--cc=ttoukan.linux@gmail.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).