public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Jakub Kicinski <kuba@kernel.org>
Cc: idosch@nvidia.com, petrm@nvidia.com, simon.horman@corigine.com,
	netdev@vger.kernel.org, leonro@nvidia.com
Subject: Re: [RFT net-next 1/6] devlink: expose instance locking and add locked port registering
Date: Thu, 10 Mar 2022 10:14:26 +0100	[thread overview]
Message-ID: <YinBchYsWd/x8kiu@nanopsycho> (raw)
In-Reply-To: <20220310001632.470337-2-kuba@kernel.org>

Thu, Mar 10, 2022 at 01:16:27AM CET, kuba@kernel.org wrote:
>It should be familiar and beneficial to expose devlink instance
>lock to the drivers. This way drivers can block devlink from
>calling them during critical sections without breakneck locking.
>
>Add port helpers, port splitting callbacks will be the first
>target.
>
>Use 'devl_' prefix for "explicitly locked" API. Initial RFC used
>'__devlink' but that's too much typing.
>
>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
>---
> include/net/devlink.h | 11 +++++
> net/core/devlink.c    | 99 ++++++++++++++++++++++++++++++++-----------
> 2 files changed, 86 insertions(+), 24 deletions(-)
>
>diff --git a/include/net/devlink.h b/include/net/devlink.h
>index 8d5349d2fb68..9de0d091aee9 100644
>--- a/include/net/devlink.h
>+++ b/include/net/devlink.h
>@@ -1479,6 +1479,17 @@ void *devlink_priv(struct devlink *devlink);
> struct devlink *priv_to_devlink(void *priv);
> struct device *devlink_to_dev(const struct devlink *devlink);
> 
>+/* Devlink instance explicit locking */
>+void devl_lock(struct devlink *devlink);
>+void devl_unlock(struct devlink *devlink);
>+void devl_assert_locked(struct devlink *devlink);
>+bool devl_lock_is_held(struct devlink *devlink);
>+
>+int devl_port_register(struct devlink *devlink,

It is kind of confusing to have:
devlink_* - locked api
devl_* - unlocked api

And not really, because by this division, devl_lock() should be called
devlink_lock(). So it is oddly mixed..

I believe that "_" or "__" prefix is prefered here and everyone knows
with away what it it is good for.

If you find "__devlink_port_register" as "too much typing" (I don't),
why don't we have all devlink api shortened to:
devl_*
and then the unlocked api could be called:
__devl_*
?


[...]


>+bool devl_lock_is_held(struct devlink *devlink)
>+{
>+	/* We have to check this at runtime because struct devlink
>+	 * is now private. Normally lock_is_held() should be eliminated

"is now private" belong more to the patch description, not to the actual
code I believe.

[...]

  reply	other threads:[~2022-03-10  9:14 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10  0:16 [RFT net-next 0/6] devlink: expose instance locking and simplify port splitting Jakub Kicinski
2022-03-10  0:16 ` [RFT net-next 1/6] devlink: expose instance locking and add locked port registering Jakub Kicinski
2022-03-10  9:14   ` Jiri Pirko [this message]
2022-03-10 20:06     ` Jakub Kicinski
2022-03-11  9:15       ` Jiri Pirko
2022-03-11 16:33         ` Jakub Kicinski
2022-03-14 12:43           ` Jiri Pirko
2022-03-11 16:09   ` Leon Romanovsky
2022-03-11 16:26     ` Jakub Kicinski
2022-03-11 16:57       ` Leon Romanovsky
2022-03-11 17:39         ` Jakub Kicinski
2022-03-11 17:41           ` Jakub Kicinski
2022-03-11 17:49           ` Leon Romanovsky
2022-03-11 18:06             ` Jakub Kicinski
2022-03-11 18:19               ` Leon Romanovsky
2022-03-10  0:16 ` [RFT net-next 2/6] eth: nfp: wrap locking assertions in helpers Jakub Kicinski
2022-03-10  0:16 ` [RFT net-next 3/6] eth: nfp: replace driver's "pf" lock with devlink instance lock Jakub Kicinski
2022-03-10  0:16 ` [RFT net-next 4/6] eth: mlxsw: switch to explicit locking for port registration Jakub Kicinski
2022-03-10  9:17   ` Jiri Pirko
2022-03-10 20:08     ` Jakub Kicinski
2022-03-10  0:16 ` [RFT net-next 5/6] devlink: hold the instance lock in port_split / port_unsplit callbacks Jakub Kicinski
2022-03-10  0:16 ` [RFT net-next 6/6] devlink: pass devlink_port to " Jakub Kicinski
2022-03-10  8:57 ` [RFT net-next 0/6] devlink: expose instance locking and simplify port splitting Ido Schimmel
2022-03-10 21:13   ` Ido Schimmel
2022-03-10 21:28     ` Jakub Kicinski
2022-03-14 18:46     ` Jakub Kicinski
2022-03-14 19:10       ` Ido Schimmel
2022-03-14 20:11         ` Jakub Kicinski
2022-03-15  7:39       ` Leon Romanovsky
2022-03-15 15:58         ` Jakub Kicinski
2022-03-15 17:54           ` Leon Romanovsky
2022-03-10  9:05 ` Jiri Pirko
2022-03-10  9:07 ` Leon Romanovsky
2022-03-10 20:13   ` Jakub Kicinski
2022-03-11  6:30     ` Leon Romanovsky
2022-03-11 10:48 ` Simon Horman
2022-03-11 16:34   ` Jakub Kicinski

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=YinBchYsWd/x8kiu@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@nvidia.com \
    --cc=simon.horman@corigine.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