io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: io-uring <io-uring@vger.kernel.org>
Subject: TODO list item - multiple poll waitqueues
Date: Mon, 10 Feb 2020 08:12:17 -0700	[thread overview]
Message-ID: <81c68aa5-1ea4-3378-58c2-4bb9c6d779ad@kernel.dk> (raw)

Hi,

This has been on my TODO list for a while, just haven't gotten around to
it.

The issue is that some drivers use multiple waitqueues for poll, which
doesn't work with POLL_ADD. io_poll_queue_proc() checks for this and
fails it:

static void io_poll_queue_proc(struct file *file, struct wait_queue_head *head,
			       struct poll_table_struct *p)
{
	struct io_poll_table *pt = container_of(p, struct io_poll_table, pt);

	if (unlikely(pt->req->poll.head)) {
		pt->error = -EINVAL;
		return;
	}

	pt->error = 0;
	pt->req->poll.head = head;
	add_wait_queue(head, &pt->req->poll.wait);
}

since we just have the one waitqueue on the io_uring side. Most notably
affected are TTYs, I've also noticed that /dev/random does the same
thing, and recently pipes as well.

This is a problem for event handlers, in that not all file types work
reliably with POLL_ADD. Note that this also affects the aio poll
implementation, unsurprisingly.

If anyone has the inclination to look into this, that'd be great.

-- 
Jens Axboe


             reply	other threads:[~2020-02-10 15:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10 15:12 Jens Axboe [this message]
2020-02-10 20:53 ` TODO list item - multiple poll waitqueues 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=81c68aa5-1ea4-3378-58c2-4bb9c6d779ad@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).