[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <qvqw5yf85e91.fsf@dev0134.prn3.facebook.com>
Date: Mon, 21 Nov 2022 10:55:06 -0800
From: Stefan Roesch <shr@...kernel.io>
To: Jens Axboe <axboe@...nel.dk>
Cc: kernel-team@...com, olivier@...llion01.com, netdev@...r.kernel.org,
io-uring@...r.kernel.org, kuba@...nel.org
Subject: Re: [RFC PATCH v4 2/3] io_uring: add api to set / get napi
configuration.
Jens Axboe <axboe@...nel.dk> writes:
> On 11/21/22 10:29?AM, Stefan Roesch wrote:
>> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
>> index 4f432694cbed..cf0e7cc8ad2e 100644
>> --- a/io_uring/io_uring.c
>> +++ b/io_uring/io_uring.c
>> @@ -4122,6 +4122,48 @@ static __cold int io_register_iowq_max_workers(struct io_ring_ctx *ctx,
>> return ret;
>> }
>>
>> +static int io_register_napi(struct io_ring_ctx *ctx, void __user *arg)
>> +{
>> +#ifdef CONFIG_NET_RX_BUSY_POLL
>> + const struct io_uring_napi curr = {
>> + .busy_poll_to = ctx->napi_busy_poll_to,
>> + };
>> + struct io_uring_napi *napi;
>> +
>> + napi = memdup_user(arg, sizeof(*napi));
>> + if (IS_ERR(napi))
>> + return PTR_ERR(napi);
>> +
>> + WRITE_ONCE(ctx->napi_busy_poll_to, napi->busy_poll_to);
>> +
>> + kfree(napi);
>> +
>> + if (copy_to_user(arg, &curr, sizeof(curr)))
>> + return -EFAULT;
>> +
>> + return 0;
>> +#else
>> + return -EINVAL;
>> +#endif
>> +}
>
> This should return -EINVAL if any of the padding or reserved fields are
> non-zero. If you don't do that, then it's not expendable in the future.
The next version will have that change.
Powered by blists - more mailing lists