[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240207185014.GA1221@fastly.com>
Date: Wed, 7 Feb 2024 10:50:15 -0800
From: Joe Damato <jdamato@...tly.com>
To: kuba@...nel.org, netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
chuck.lever@...cle.com, jlayton@...nel.org,
linux-api@...r.kernel.org, brauner@...nel.org, edumazet@...gle.com,
davem@...emloft.net, alexander.duyck@...il.com,
sridhar.samudrala@...el.com, kuba@...nel.org,
willemdebruijn.kernel@...il.com, weiwan@...gle.com,
David.Laight@...LAB.COM, arnd@...db.de, sdf@...gle.com,
amritha.nambiar@...el.com, Jonathan Corbet <corbet@....net>,
Alexander Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>,
Nathan Lynch <nathanl@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Namjae Jeon <linkinjeon@...nel.org>,
Steve French <stfrench@...rosoft.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
Julien Panis <jpanis@...libre.com>,
Andrew Waterman <waterman@...s.berkeley.edu>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
"open list:FILESYSTEMS (VFS and infrastructure)" <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH net-next v6 4/4] eventpoll: Add epoll ioctl for
epoll_params
On Wed, Feb 07, 2024 at 09:37:14AM +0100, Jiri Slaby wrote:
> On 05. 02. 24, 22:04, Joe Damato wrote:
> >Add an ioctl for getting and setting epoll_params. User programs can use
> >this ioctl to get and set the busy poll usec time, packet budget, and
> >prefer busy poll params for a specific epoll context.
> >
> >Parameters are limited:
> > - busy_poll_usecs is limited to <= u32_max
> > - busy_poll_budget is limited to <= NAPI_POLL_WEIGHT by unprivileged
> > users (!capable(CAP_NET_ADMIN))
> > - prefer_busy_poll must be 0 or 1
> > - __pad must be 0
> >
> >Signed-off-by: Joe Damato <jdamato@...tly.com>
> ...
> >--- a/fs/eventpoll.c
> >+++ b/fs/eventpoll.c
> ...
> >@@ -497,6 +498,50 @@ static inline void ep_set_busy_poll_napi_id(struct epitem *epi)
> > ep->napi_id = napi_id;
> > }
> >+static long ep_eventpoll_bp_ioctl(struct file *file, unsigned int cmd,
> >+ unsigned long arg)
> >+{
> >+ struct eventpoll *ep;
> >+ struct epoll_params epoll_params;
> >+ void __user *uarg = (void __user *) arg;
> >+
> >+ ep = file->private_data;
>
> This might have been on the ep declaration line.
>
> >+ switch (cmd) {
> >+ case EPIOCSPARAMS:
> >+ if (copy_from_user(&epoll_params, uarg, sizeof(epoll_params)))
> >+ return -EFAULT;
> >+
> >+ if (memchr_inv(epoll_params.__pad, 0, sizeof(epoll_params.__pad)))
> >+ return -EINVAL;
> >+
> >+ if (epoll_params.busy_poll_usecs > U32_MAX)
> >+ return -EINVAL;
> >+
> >+ if (epoll_params.prefer_busy_poll > 1)
> >+ return -EINVAL;
> >+
> >+ if (epoll_params.busy_poll_budget > NAPI_POLL_WEIGHT &&
> >+ !capable(CAP_NET_ADMIN))
> >+ return -EPERM;
> >+
> >+ ep->busy_poll_usecs = epoll_params.busy_poll_usecs;
> >+ ep->busy_poll_budget = epoll_params.busy_poll_budget;
> >+ ep->prefer_busy_poll = !!epoll_params.prefer_busy_poll;
>
> This !! is unnecessary. Nonzero values shall be "converted" to true.
>
> But FWIW, the above is nothing which should be blocking, so:
">
> Reviewed-by: Jiri Slaby <jirislaby@...nel.org>
netdev maintainers: Jiri marked this with Reviewed-by, but was this review
what caused "Changes Requested" to be the status set for this patch set in
patchwork?
If needed, I'll send a v7 with the changes Jiri suggested and add the
"Reviewed-by" since the changes are cosmetic, but I wanted to make sure
this was the reason.
Thanks.
Powered by blists - more mailing lists