public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org, Vadim Fedorenko <vadim.fedorenko@linux.dev>
Cc: netdev@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
	Kuniyuki Iwashima <kuniyu@amazon.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Richard Cochran <richardcochran@gmail.com>
Subject: Re: [PATCH 2/5] io_uring/poll: introduce io_arm_apoll()
Date: Sat, 31 May 2025 11:28:48 +0100	[thread overview]
Message-ID: <bf6aa4f9-7c6f-4e28-88c0-0e20c5e4a854@gmail.com> (raw)
In-Reply-To: <8abeb8e2328e923515c63e43a1942802efabb3b1.1748607147.git.asml.silence@gmail.com>

On 5/30/25 13:18, Pavel Begunkov wrote:
> In preparation to allowing commands to do file polling, add a helper
> that takes the desired poll event mask and arms it for polling. We won't
> be able to use io_arm_poll_handler() with IORING_OP_URING_CMD as it
> tries to infer the mask from the opcode data, and we can't unify it
> across all commands.
> 
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> ---
... -		if (req->flags & REQ_F_CLEAR_POLLIN)
> -			mask &= ~EPOLLIN;
> -	} else {
> -		mask |= EPOLLOUT | EPOLLWRNORM;
> -	}
> -	if (def->poll_exclusive)
> -		mask |= EPOLLEXCLUSIVE;
> -
>   	apoll = io_req_alloc_apoll(req, issue_flags);
>   	if (!apoll)
>   		return IO_APOLL_ABORTED;
> @@ -712,6 +696,31 @@ int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags)
>   	return IO_APOLL_OK;
>   }
>   
> +int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags)
> +{
> +	const struct io_issue_def *def = &io_issue_defs[req->opcode];
> +	__poll_t mask = POLLPRI | POLLERR | EPOLLET;
> +
> +	if (!def->pollin && !def->pollout)
> +		return IO_APOLL_ABORTED;
> +	if (!io_file_can_poll(req))
> +		return IO_APOLL_ABORTED;
> +
> +	if (def->pollin) {
> +		mask |= EPOLLIN | EPOLLRDNORM;
> +
> +		/* If reading from MSG_ERRQUEUE using recvmsg, ignore POLLIN */
> +		if (req->flags & REQ_F_CLEAR_POLLIN)
> +		mask &= ~EPOLLIN;

fwiw, I need to fix tabulation here

> +	} else {
> +		mask |= EPOLLOUT | EPOLLWRNORM;
> +	}
> +	if (def->poll_exclusive)
> +		mask |= EPOLLEXCLUSIVE;
> +
> +	return io_arm_apoll(req, issue_flags, mask);
> +}
-- 
Pavel Begunkov


  reply	other threads:[~2025-05-31 10:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30 12:18 [PATCH io_uring-next 0/5] io_uring cmd for tx timestamps Pavel Begunkov
2025-05-30 12:18 ` [PATCH 1/5] net: timestamp: add helper returning skb's tx tstamp Pavel Begunkov
2025-05-30 18:14   ` Stanislav Fomichev
2025-05-30 18:30     ` Stanislav Fomichev
2025-05-30 18:44       ` Pavel Begunkov
2025-06-01 13:52   ` Willem de Bruijn
2025-06-02  9:57     ` Pavel Begunkov
2025-06-02 13:31       ` Willem de Bruijn
2025-06-04  8:51         ` Pavel Begunkov
2025-06-04 13:38           ` Willem de Bruijn
2025-05-30 12:18 ` [PATCH 2/5] io_uring/poll: introduce io_arm_apoll() Pavel Begunkov
2025-05-31 10:28   ` Pavel Begunkov [this message]
2025-05-30 12:18 ` [PATCH 3/5] io_uring/cmd: allow multishot polled commands Pavel Begunkov
2025-05-30 12:18 ` [PATCH 4/5] io_uring: add mshot helper for posting CQE32 Pavel Begunkov
2025-05-30 12:18 ` [PATCH 5/5] io_uring/netcmd: add tx timestamping cmd support Pavel Begunkov
2025-05-31  8:34   ` kernel test robot
2025-05-30 13:30 ` [PATCH io_uring-next 0/5] io_uring cmd for tx timestamps Jens Axboe

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=bf6aa4f9-7c6f-4e28-88c0-0e20c5e4a854@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=io-uring@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=willemb@google.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