All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Cc: Stefan Roesch <shr@devkernel.io>,
	Facebook Kernel Team <kernel-team@fb.com>,
	Olivier Langlois <olivier@trillion01.com>,
	netdev Mailing List <netdev@vger.kernel.org>,
	io-uring Mailing List <io-uring@vger.kernel.org>,
	Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH v5 2/3] io_uring: add api to set / get napi configuration.
Date: Tue, 22 Nov 2022 06:19:01 -0700	[thread overview]
Message-ID: <06973f73-16c9-1e21-3416-bc624b8675e4@kernel.dk> (raw)
In-Reply-To: <0bb0734c-5c3e-3f2c-1163-a9bfa720bf26@gnuweeb.org>

On 11/22/22 6:13 AM, Ammar Faizi wrote:
> On 11/22/22 2:46 AM, Jens Axboe wrote:
>> On 11/21/22 12:14?PM, Stefan Roesch wrote:
>>> +static int io_unregister_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,
>>> +    };
>>> +
>>> +    if (copy_to_user(arg, &curr, sizeof(curr)))
>>> +        return -EFAULT;
>>> +
>>> +    WRITE_ONCE(ctx->napi_busy_poll_to, 0);
>>> +    return 0;
>>> +#else
>>> +    return -EINVAL;
>>> +#endif
>>> +}
>>
>> Should probably check resv/pad here as well, maybe even the
>> 'busy_poll_to' being zero?
> 
> Jens, this function doesn't read from __user memory, it writes to
> __user memory.
> 
> @curr.resv and @curr.pad are on the kernel's stack. Both are already
> implicitly initialized to zero by the partial struct initializer.

Oh yes, guess I totally missed that we don't care about the value
at all (just zero the target) and copy back the old values.

-- 
Jens Axboe



  reply	other threads:[~2022-11-22 13:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 19:14 [PATCH v5 0/3] io_uring: add napi busy polling support Stefan Roesch
2022-11-21 19:14 ` [PATCH v5 1/3] " Stefan Roesch
2022-11-21 19:45   ` Jens Axboe
2022-11-21 23:59     ` Jens Axboe
2022-11-21 19:14 ` [PATCH v5 2/3] io_uring: add api to set / get napi configuration Stefan Roesch
2022-11-21 19:46   ` Jens Axboe
2022-11-22 13:13     ` Ammar Faizi
2022-11-22 13:19       ` Jens Axboe [this message]
2022-11-25 21:43   ` Ammar Faizi
2022-11-28 20:22     ` Stefan Roesch
2022-11-21 19:14 ` [PATCH v5 3/3] io_uring: add api to set napi prefer busy poll Stefan Roesch

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=06973f73-16c9-1e21-3416-bc624b8675e4@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=ammarfaizi2@gnuweeb.org \
    --cc=io-uring@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olivier@trillion01.com \
    --cc=shr@devkernel.io \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.