From: Jakub Kicinski <kuba@kernel.org>
To: Parav Pandit <parav@mellanox.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, jiri@mellanox.com
Subject: Re: [PATCH net-next] devlink: Always use user_ptr[0] for devlink and simplify post_doit
Date: Wed, 22 Jul 2020 10:14:17 -0700 [thread overview]
Message-ID: <20200722101417.40c5a1d6@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20200722155711.976214-1-parav@mellanox.com>
On Wed, 22 Jul 2020 18:57:11 +0300 Parav Pandit wrote:
> Currently devlink instance is searched on all doit() operations.
> But it is optionally stored into user_ptr[0]. This requires
> rediscovering devlink again doing post_doit().
>
> Few devlink commands related to port shared buffers needs 3 pointers
> (devlink, devlink_port, and devlink_sb) while executing doit commands.
> Though devlink pointer can be derived from the devlink_port during
> post_doit() operation when doit() callback has acquired devlink
> instance lock, relying on such scheme to access devlik pointer makes
> code very fragile.
>
> Hence, to avoid ambiguity in post_doit() and to avoid searching
> devlink instance again, simplify code by always storing devlink
> instance in user_ptr[0] and derive devlink_sb pointer in their
> respective callback routines.
>
> Signed-off-by: Parav Pandit <parav@mellanox.com>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Other options include having some static variable (since doit is always
under devlink_mutex AFAICS) or doing a tiny allocation to fit more
pointers. But whatever:
Acked-by: Jakub Kicinski <kuba@kernel.org>
next prev parent reply other threads:[~2020-07-22 17:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 15:57 [PATCH net-next] devlink: Always use user_ptr[0] for devlink and simplify post_doit Parav Pandit
2020-07-22 17:14 ` Jakub Kicinski [this message]
2020-07-23 1:07 ` David Miller
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=20200722101417.40c5a1d6@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=parav@mellanox.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;
as well as URLs for NNTP newsgroup(s).