From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: Fam Zheng <fam@euphon.net>, Paolo Bonzini <pbonzini@redhat.com>,
Julia Suvorova <jusual@redhat.com>,
qemu-block@nongnu.org, sgarzare@redhat.com
Subject: Re: [PATCH for-5.0] aio-posix: signal-proof fdmon-io_uring
Date: Wed, 8 Apr 2020 13:47:43 +0200 [thread overview]
Message-ID: <e65273c7-07ee-cea3-4a38-55db2e797f2d@redhat.com> (raw)
In-Reply-To: <20200408091139.273851-1-stefanha@redhat.com>
On 4/8/20 11:11 AM, Stefan Hajnoczi wrote:
> The io_uring_enter(2) syscall returns with errno=EINTR when interrupted
> by a signal. Retry the syscall in this case.
>
> It's essential to do this in the io_uring_submit_and_wait() case. My
> interpretation of the Linux v5.5 io_uring_enter(2) code is that it
> shouldn't affect the io_uring_submit() case, but there is no guarantee
> this will always be the case.
This is how io_uring_enter() is documented indeed (no EINTR).
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Let's check for -EINTR around both APIs.
>
> Note that the liburing APIs have -errno return values.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> util/fdmon-io_uring.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c
> index b4d6109f20..d5a80ed6fb 100644
> --- a/util/fdmon-io_uring.c
> +++ b/util/fdmon-io_uring.c
> @@ -88,7 +88,10 @@ static struct io_uring_sqe *get_sqe(AioContext *ctx)
> }
>
> /* No free sqes left, submit pending sqes first */
> - ret = io_uring_submit(ring);
> + do {
> + ret = io_uring_submit(ring);
> + } while (ret == -EINTR);
> +
> assert(ret > 1);
> sqe = io_uring_get_sqe(ring);
> assert(sqe);
> @@ -282,7 +285,10 @@ static int fdmon_io_uring_wait(AioContext *ctx, AioHandlerList *ready_list,
>
> fill_sq_ring(ctx);
>
> - ret = io_uring_submit_and_wait(&ctx->fdmon_io_uring, wait_nr);
> + do {
> + ret = io_uring_submit_and_wait(&ctx->fdmon_io_uring, wait_nr);
> + } while (ret == -EINTR);
> +
> assert(ret >= 0);
>
> return process_cq_ring(ctx, ready_list);
>
next prev parent reply other threads:[~2020-04-08 11:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-08 9:11 [PATCH for-5.0] aio-posix: signal-proof fdmon-io_uring Stefan Hajnoczi
2020-04-08 10:06 ` Stefano Garzarella
2020-04-09 14:57 ` Stefan Hajnoczi
2020-04-09 15:31 ` Stefano Garzarella
2020-04-08 11:47 ` Philippe Mathieu-Daudé [this message]
2020-04-09 14:55 ` Stefan Hajnoczi
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=e65273c7-07ee-cea3-4a38-55db2e797f2d@redhat.com \
--to=philmd@redhat.com \
--cc=fam@euphon.net \
--cc=jusual@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.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;
as well as URLs for NNTP newsgroup(s).