IO-Uring Archive on lore.kernel.org
 help / color / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-kernel@vger.kernel.org, io-uring@vger.kernel.org
Subject: Re: [PATCH liburing v2 0/1] test: add epoll test case
Date: Thu, 6 Feb 2020 21:12:03 +0100
Message-ID: <CAGxU2F7MWwvLw7dgGSoY0uFeZVe6JbYcvhmKRMfTpzVBwho3yg@mail.gmail.com> (raw)
In-Reply-To: <548cb67b-bb43-c22a-f3c6-e707e2c07c13@kernel.dk>

On Thu, Feb 6, 2020 at 8:51 PM Jens Axboe <axboe@kernel.dk> wrote:
>
> On 2/6/20 12:15 PM, Jens Axboe wrote:
> > On 2/6/20 10:33 AM, Stefano Garzarella wrote:
> >>
> >>
> >> On Fri, Jan 31, 2020 at 4:39 PM Jens Axboe <axboe@kernel.dk> wrote:
> >>>
> >>> On 1/31/20 7:29 AM, Stefano Garzarella wrote:
> >>>> Hi Jens,
> >>>> this is a v2 of the epoll test.
> >>>>
> >>>> v1 -> v2:
> >>>>     - if IORING_FEAT_NODROP is not available, avoid to overflow the CQ
> >>>>     - add 2 new tests to test epoll with IORING_FEAT_NODROP
> >>>>     - cleanups
> >>>>
> >>>> There are 4 sub-tests:
> >>>>     1. test_epoll
> >>>>     2. test_epoll_sqpoll
> >>>>     3. test_epoll_nodrop
> >>>>     4. test_epoll_sqpoll_nodrop
> >>>>
> >>>> In the first 2 tests, I try to avoid to queue more requests than we have room
> >>>> for in the CQ ring. These work fine, I have no faults.
> >>>
> >>> Thanks!
> >>>
> >>>> In the tests 3 and 4, if IORING_FEAT_NODROP is supported, I try to submit as
> >>>> much as I can until I get a -EBUSY, but they often fail in this way:
> >>>> the submitter manages to submit everything, the receiver receives all the
> >>>> submitted bytes, but the cleaner loses completion events (I also tried to put a
> >>>> timeout to epoll_wait() in the cleaner to be sure that it is not related to the
> >>>> patch that I send some weeks ago, but the situation doesn't change, it's like
> >>>> there is still overflow in the CQ).
> >>>>
> >>>> Next week I'll try to investigate better which is the problem.
> >>>
> >>> Does it change if you have an io_uring_enter() with GETEVENTS set? I wonder if
> >>> you just pruned the CQ ring but didn't flush the internal side.
> >>
> >> If I do io_uring_enter() with GETEVENTS set and wait_nr = 0 it solves
> >> the issue, I think because we call io_cqring_events() that flushes the
> >> overflow list.
> >>
> >> At this point, should we call io_cqring_events() (that flushes the
> >> overflow list) in io_uring_poll()?
> >> I mean something like this:
> >>
> >> diff --git a/fs/io_uring.c b/fs/io_uring.c
> >> index 77f22c3da30f..2769451af89a 100644
> >> --- a/fs/io_uring.c
> >> +++ b/fs/io_uring.c
> >> @@ -6301,7 +6301,7 @@ static __poll_t io_uring_poll(struct file *file, poll_table *wait)
> >>         if (READ_ONCE(ctx->rings->sq.tail) - ctx->cached_sq_head !=
> >>             ctx->rings->sq_ring_entries)
> >>                 mask |= EPOLLOUT | EPOLLWRNORM;
> >> -       if (READ_ONCE(ctx->rings->cq.head) != ctx->cached_cq_tail)
> >> +       if (!io_cqring_events(ctx, false))
> >>                 mask |= EPOLLIN | EPOLLRDNORM;
> >>
> >>         return mask;
> >
> > That's not a bad idea, would just have to verify that it is indeed safe
> > to always call the flushing variant from there.
>
> Double checked, and it should be fine. We may be invoked with
> ctx->uring_lock held, but that's fine.
>

Maybe yes, I'll check better and I'll send a patch :-)

Thanks,
Stefano


  reply index

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 14:29 Stefano Garzarella
2020-01-31 14:29 ` [PATCH liburing v2 1/1] " Stefano Garzarella
2020-01-31 15:41   ` Jens Axboe
2020-02-03  9:04     ` Stefano Garzarella
2020-02-03 15:43       ` Jens Axboe
2020-01-31 15:39 ` [PATCH liburing v2 0/1] " Jens Axboe
2020-02-03  9:03   ` Stefano Garzarella
2020-02-06 17:33   ` Stefano Garzarella
2020-02-06 19:15     ` Jens Axboe
2020-02-06 19:51       ` Jens Axboe
2020-02-06 20:12         ` Stefano Garzarella [this message]
2020-02-06 19:46     ` Jens Axboe
2020-02-07 16:51   ` Stefano Garzarella

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=CAGxU2F7MWwvLw7dgGSoY0uFeZVe6JbYcvhmKRMfTpzVBwho3yg@mail.gmail.com \
    --to=sgarzare@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@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

IO-Uring Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/io-uring/0 io-uring/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 io-uring io-uring/ https://lore.kernel.org/io-uring \
		io-uring@vger.kernel.org
	public-inbox-index io-uring

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.io-uring


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git