[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y763xcz5fdpZnod3@nanopsycho>
Date: Wed, 11 Jan 2023 14:21:09 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, jacob.e.keller@...el.com
Subject: Re: [PATCH net-next 7/9] devlink: allow registering parameters after
the instance
Fri, Jan 06, 2023 at 07:34:00AM CET, kuba@...nel.org wrote:
>It's most natural to register the instance first and then its
>subobjects. Now that we can use the instance lock to protect
>the atomicity of all init - it should also be safe.
>
>Signed-off-by: Jakub Kicinski <kuba@...nel.org>
>---
> net/devlink/leftover.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
>diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
>index 491f821c8b77..1e23b2da78cc 100644
>--- a/net/devlink/leftover.c
>+++ b/net/devlink/leftover.c
>@@ -5263,7 +5263,13 @@ static void devlink_param_notify(struct devlink *devlink,
> WARN_ON(cmd != DEVLINK_CMD_PARAM_NEW && cmd != DEVLINK_CMD_PARAM_DEL &&
> cmd != DEVLINK_CMD_PORT_PARAM_NEW &&
> cmd != DEVLINK_CMD_PORT_PARAM_DEL);
>- ASSERT_DEVLINK_REGISTERED(devlink);
>+
>+ /* devlink_notify_register() / devlink_notify_unregister()
>+ * will replay the notifications if the params are added/removed
>+ * outside of the lifetime of the instance.
>+ */
>+ if (!devl_is_registered(devlink))
>+ return;
>
> msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
> if (!msg)
>@@ -10915,8 +10921,6 @@ int devlink_params_register(struct devlink *devlink,
> const struct devlink_param *param = params;
> int i, err;
>
>- ASSERT_DEVLINK_NOT_REGISTERED(devlink);
Hmm, params list is not protected by any lock. The protection it used
was that it is static after registration. You changed it but didn't add
the lock. All param register/unregister functions need to be renamed to
devl_* and assert instance lock. I will fix this.
[..]
Powered by blists - more mailing lists