--- libev/ev_iouring.c 2019/08/17 05:30:16 1.3 +++ libev/ev_iouring.c 2019/12/22 15:05:32 1.7 @@ -49,8 +49,9 @@ * e) why 3 mmaps instead of one? one would be more space-efficient, * and I can't see what benefit three would have (other than being * somehow resizable/relocatable, but that's apparently not possible). + * (FIXME: newer kernels can use 2 mmaps only, need to look into this). * f) hmm, it's practiclaly undebuggable (gdb can't access the memory, and - the bizarre way structure offsets are commuinicated makes it hard to + * the bizarre way structure offsets are communicated makes it hard to * just print the ring buffer heads, even *iff* the memory were visible * in gdb. but then, that's also ok, really. * g) well, you cannot specify a timeout when waiting for events. no, @@ -60,8 +61,10 @@ * like a ยต-optimisation by the io_uring author for his personal * applications, to the detriment of everybody else who just wants * an event loop. but, umm, ok, if that's all, it could be worse. + * (FIXME: jens mentioned timeout commands, need to investigate) * h) there is a hardcoded limit of 4096 outstanding events. okay, * at least there is no arbitrary low system-wide limit... + * (FIXME: apparently, this was increased to 32768 in later kernels( * i) unlike linux aio, you *can* register more then the limit * of fd events, and the kernel will "gracefully" signal an * overflow, after which you could destroy and recreate the kernel @@ -69,6 +72,7 @@ * totally insane, but kind of questions the point a high * performance I/O framework when it doesn't really work * under stress. + * (FIXME: iouring should no longer drop events, need to investigate) * j) but, oh my! is has exactly the same bugs as the linux aio backend, * where some undocumented poll combinations just fail. * so we need epoll AGAIN as a fallback. AGAIN! epoll!! and of course, @@ -363,7 +367,6 @@ static void iouring_modify (EV_P_ int fd, int oev, int nev) { - fprintf (stderr,"modify %d (%d, %d) %d\n", fd, oev,nev, anfds[fd].eflags);//D if (ecb_expect_false (anfds [fd].eflags)) { /* we handed this fd over to epoll, so undo this first */ @@ -473,8 +476,6 @@ return; } - fprintf (stderr, "fd %d event, rearm\n", fd);//D - /* feed events, we do not expect or handle POLLNVAL */ fd_event ( EV_A_ @@ -581,7 +582,7 @@ /* no events, so maybe wait for some */ iouring_tfd_update (EV_A_ timeout); - /* only enter the kernel if we have somethign to submit, or we need to wait */ + /* only enter the kernel if we have something to submit, or we need to wait */ if (timeout || iouring_to_submit) { int res; @@ -611,12 +612,6 @@ if (!epoll_init (EV_A_ 0)) return 0; - ev_io_init (EV_A_ &iouring_epoll_w, iouring_epoll_cb, backend_fd, EV_READ); - ev_set_priority (&iouring_epoll_w, EV_MAXPRI); - - ev_io_init (&iouring_tfd_w, iouring_tfd_cb, iouring_tfd, EV_READ); - ev_set_priority (&iouring_tfd_w, EV_MAXPRI); - iouring_entries = IOURING_INIT_ENTRIES; iouring_max_entries = 0; @@ -626,6 +621,12 @@ return 0; } + ev_io_init (&iouring_epoll_w, iouring_epoll_cb, backend_fd, EV_READ); + ev_set_priority (&iouring_epoll_w, EV_MAXPRI); + + ev_io_init (&iouring_tfd_w, iouring_tfd_cb, iouring_tfd, EV_READ); + ev_set_priority (&iouring_tfd_w, EV_MAXPRI); + ev_io_start (EV_A_ &iouring_epoll_w); ev_unref (EV_A); /* watcher should not keep loop alive */