[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YinBchYsWd/x8kiu@nanopsycho>
Date: Thu, 10 Mar 2022 10:14:26 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Jakub Kicinski <kuba@...nel.org>
Cc: idosch@...dia.com, petrm@...dia.com, simon.horman@...igine.com,
netdev@...r.kernel.org, leonro@...dia.com
Subject: Re: [RFT net-next 1/6] devlink: expose instance locking and add
locked port registering
Thu, Mar 10, 2022 at 01:16:27AM CET, kuba@...nel.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@...nel.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.
[...]
Powered by blists - more mailing lists