All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxim Mikityanskiy <maximmi@nvidia.com>
To: "kuba@kernel.org" <kuba@kernel.org>
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>
Subject: Re: [PATCH net-next] net/tls: Use RCU API to access tls_ctx->netdev
Date: Tue, 2 Aug 2022 12:07:18 +0000	[thread overview]
Message-ID: <4a49be4bb85f99de60cfec4c57bce5f1a356416f.camel@nvidia.com> (raw)
In-Reply-To: <20220801124419.4aaffcac@kernel.org>

On Mon, 2022-08-01 at 12:44 -0700, Jakub Kicinski wrote:
> On Mon, 1 Aug 2022 11:00:53 +0300 Maxim Mikityanskiy wrote:
> > Currently, tls_device_down synchronizes with tls_device_resync_rx using
> > RCU, however, the pointer to netdev is stored using WRITE_ONCE and
> > loaded using READ_ONCE.
> > 
> > Although such approach is technically correct (rcu_dereference is
> > essentially a READ_ONCE, and rcu_assign_pointer uses WRITE_ONCE to store
> > NULL), using special RCU helpers for pointers is more valid, as it
> > includes additional checks and might change the implementation
> > transparently to the callers.
> > 
> > Mark the netdev pointer as __rcu and use the correct RCU helpers to
> > access it. For non-concurrent access pass the right conditions that
> > guarantee safe access (locks taken, refcount value). Also use the
> > correct helper in mlx5e, where even READ_ONCE was missing.
> 
> Oops, looks like we also got some new sparse warnings from this:
> 
> 2 new warnings in drivers/net/bonding/bond_main.c
> 1 new warning  in drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c

Looks like neither me, nor our internal CI built these files - sorry!
I'll fix these and look for the usages more carefully.

BTW, the bonding case misses even the READ_ONCE, so it's an existing
bug, exposed by the transition to the proper RCU API in my patch.

  reply	other threads:[~2022-08-02 12:07 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
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 [this message]
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=4a49be4bb85f99de60cfec4c57bce5f1a356416f.camel@nvidia.com \
    --to=maximmi@nvidia.com \
    --cc=borisp@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.