From: Jakub Kicinski <kuba@kernel.org>
To: Maxim Mikityanskiy <maximmi@nvidia.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
Tariq Toukan <tariqt@nvidia.com>, Gal Pressman <gal@nvidia.com>,
"john.fastabend@gmail.com" <john.fastabend@gmail.com>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"edumazet@google.com" <edumazet@google.com>,
Saeed Mahameed <saeedm@nvidia.com>,
Boris Pismenny <borisp@nvidia.com>,
"Paul E. McKenney" <paulmck@kernel.org>
Subject: Re: [PATCH net-next] net/tls: Use RCU API to access tls_ctx->netdev
Date: Wed, 3 Aug 2022 07:49:57 -0700 [thread overview]
Message-ID: <20220803074957.33783ad4@kernel.org> (raw)
In-Reply-To: <8bf08924a111d4e0875721af264f082cc9c44587.camel@nvidia.com>
On Wed, 3 Aug 2022 09:33:48 +0000 Maxim Mikityanskiy wrote:
> > > The documentation of rcu_access_pointer says it shouldn't be used on
> > > the update side, because we lose lockdep protection:
> > >
> > > --cut--
> > >
> > > Although rcu_access_pointer() may also be used in cases
> > > where update-side locks prevent the value of the pointer from changing,
> > > you should instead use rcu_dereference_protected() for this use case.
> >
> > I think what this is trying to say is to not use the
> > rcu_access_pointer() as a hack against lockdep:
>
> Well, maybe we understand it in different ways. This is how I parsed it
> (the whole comment):
>
> 1. rcu_access_pointer is not for the read side. So, it's either for the
> write side or for usage outside all locks.
>
> 2. It's not for dereferencing. So, it's for reading the pointer's value
> on the write side or outside all locks.
>
> 3. Although it can be used on the write side, rcu_dereference_protected
> should be used. So, it's for reading the pointer's value outside all
> locks.
Using rcu_deref* when we don't dereference the pointer does not compute
for me, but it's not a big deal.
Let me CC Paul for clarification of the docs, as it may also be
confusing to others and therefore worth rewording. But our case is
not that important so unless Paul chimes in clearly indicating one
interpretation is right - either way is fine by me for v2.
next prev parent reply other threads:[~2022-08-03 14:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-01 8:00 [PATCH net-next] net/tls: Use RCU API to access tls_ctx->netdev Maxim Mikityanskiy
2022-08-01 19:42 ` Jakub Kicinski
2022-08-02 12:03 ` Maxim Mikityanskiy
2022-08-02 15:37 ` Jakub Kicinski
2022-08-03 9:33 ` Maxim Mikityanskiy
2022-08-03 14:49 ` Jakub Kicinski [this message]
2022-08-03 16:34 ` Paul E. McKenney
2022-08-04 8:08 ` Maxim Mikityanskiy
2022-08-04 16:18 ` Jakub Kicinski
2022-08-05 10:59 ` Maxim Mikityanskiy
2022-08-04 18:40 ` Paul E. McKenney
2022-08-05 10:59 ` Maxim Mikityanskiy
2022-08-01 19:44 ` Jakub Kicinski
2022-08-02 12:07 ` Maxim Mikityanskiy
2022-08-02 15:38 ` Jakub Kicinski
2022-08-02 16:26 ` kernel test robot
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=20220803074957.33783ad4@kernel.org \
--to=kuba@kernel.org \
--cc=borisp@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=john.fastabend@gmail.com \
--cc=maximmi@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=paulmck@kernel.org \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.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).