qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

aio-posix: signal-proof fdmon-io_uring

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. 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>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200408091139.273851-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

+8 -2
+8 -2
util/fdmon-io_uring.c
··· 88 88 } 89 89 90 90 /* No free sqes left, submit pending sqes first */ 91 - ret = io_uring_submit(ring); 91 + do { 92 + ret = io_uring_submit(ring); 93 + } while (ret == -EINTR); 94 + 92 95 assert(ret > 1); 93 96 sqe = io_uring_get_sqe(ring); 94 97 assert(sqe); ··· 282 285 283 286 fill_sq_ring(ctx); 284 287 285 - ret = io_uring_submit_and_wait(&ctx->fdmon_io_uring, wait_nr); 288 + do { 289 + ret = io_uring_submit_and_wait(&ctx->fdmon_io_uring, wait_nr); 290 + } while (ret == -EINTR); 291 + 286 292 assert(ret >= 0); 287 293 288 294 return process_cq_ring(ctx, ready_list);