From: Leon Romanovsky <leon@kernel.org>
To: Michal Kubecek <mkubecek@suse.cz>
Cc: Jakub Kicinski <kuba@kernel.org>,
Sudheer Mogilappagari <sudheer.mogilappagari@intel.com>,
netdev@vger.kernel.org, andrew@lunn.ch, corbet@lwn.net,
sridhar.samudrala@intel.com, anthony.l.nguyen@intel.com
Subject: Re: [PATCH net-next v7] ethtool: add netlink based get rss support
Date: Thu, 8 Dec 2022 10:22:10 +0200 [thread overview]
Message-ID: <Y5GesjGvi+Gtj+Dq@unreal> (raw)
In-Reply-To: <20221207093248.x6dwbcdxkgaqb6zh@lion.mk-sys.cz>
On Wed, Dec 07, 2022 at 10:32:48AM +0100, Michal Kubecek wrote:
> On Wed, Dec 07, 2022 at 10:42:38AM +0200, Leon Romanovsky wrote:
> > On Tue, Dec 06, 2022 at 05:14:41PM +0100, Michal Kubecek wrote:
> > >
> > > - avoiding the inherently racy get/modify/set cycle
> >
> > How? IMHO, it is achieved in netlink by holding relevant locks, it can
> > be rtnl lock or specific to that netlink interface lock (devl). You cam
> > and should have same locking protection for legacy flow as well.
>
> What I had in mind is changing only one (or few) of the parameters which
> are passed in a structure via ioctl interface, i.e. commands like
>
> ethtool -G eth0 rx 2048
>
> To do that with ioctl interface, userspace needs to fetch the whole
> ethtool_ringparam structure with ETHTOOL_GRINGPARAM first, modify its
> rx_pending member and pass the structure back with ETHTOOL_SRINGPARAM.
> Obviously you cannot hold a kernel lock over multiple ioctl() syscall.
Kernel historically doesn't have protection from user space races,
which is what you presented here. Netlink gives you feature flags
over specific fields, which you can achieve over ioctl too.
Anyway, I see your point.
>
> In some cases, there is a special with "no change" meaning but that is
> rather an exception. It would be possible to work around the problem
> using some "version counter" that would kernel check against its own
> (and reject the update if they do not match) but introducing that would
> also be a backward incompatible change.
Another options is to build netlink over ioctl. See as an example RDMA ioctl
interface (ib_uverbs_ioctl ...) which in nutshell is netlink over ioctl. After
long debates, we choose ioctl, because of need to have synchronous and reliable
interface to configure system. But we liked TLV structure of netlink, so used it.
Thanks
>
> Michal
next prev parent reply other threads:[~2022-12-08 8:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 0:25 [PATCH net-next v7] ethtool: add netlink based get rss support Sudheer Mogilappagari
2022-12-04 12:17 ` Leon Romanovsky
2022-12-04 23:38 ` Jakub Kicinski
2022-12-05 7:45 ` Leon Romanovsky
2022-12-06 1:33 ` Jakub Kicinski
2022-12-06 16:14 ` Michal Kubecek
2022-12-07 8:42 ` Leon Romanovsky
2022-12-07 9:32 ` Michal Kubecek
2022-12-08 8:22 ` Leon Romanovsky [this message]
2022-12-06 1:40 ` patchwork-bot+netdevbpf
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=Y5GesjGvi+Gtj+Dq@unreal \
--to=leon@kernel.org \
--cc=andrew@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=corbet@lwn.net \
--cc=kuba@kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=sridhar.samudrala@intel.com \
--cc=sudheer.mogilappagari@intel.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