All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Maxim Mikityanskiy <maximmi@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Boris Pismenny <borisp@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Tariq Toukan <tariqt@nvidia.com>,
	John Fastabend <john.fastabend@gmail.com>,
	Gal Pressman <gal@nvidia.com>, <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] net/tls: Use RCU API to access tls_ctx->netdev
Date: Mon, 1 Aug 2022 12:42:39 -0700	[thread overview]
Message-ID: <20220801124239.067573de@kernel.org> (raw)
In-Reply-To: <20220801080053.21849-1-maximmi@nvidia.com>

On Mon, 1 Aug 2022 11:00:53 +0300 Maxim Mikityanskiy wrote:
> @@ -1329,7 +1345,11 @@ static int tls_device_down(struct net_device *netdev)
>  
>  	spin_lock_irqsave(&tls_device_lock, flags);
>  	list_for_each_entry_safe(ctx, tmp, &tls_device_list, list) {
> -		if (ctx->netdev != netdev ||
> +		struct net_device *ctx_netdev =
> +			rcu_dereference_protected(ctx->netdev,
> +						  lockdep_is_held(&device_offload_lock));
> +
> +		if (ctx_netdev != netdev ||
>  		    !refcount_inc_not_zero(&ctx->refcount))
>  			continue;

For cases like this where we don't actually hold onto the object, just
take a peek at the address of it we can save a handful of LoC by using
rcu_access_pointer(). 

  reply	other threads:[~2022-08-01 19:42 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 [this message]
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
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=20220801124239.067573de@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=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.