public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v4 2/7] epoll_ctl: Extract epoll operations
Date: Wed, 22 Oct 2025 11:58:48 +1100	[thread overview]
Message-ID: <aPgsSL1ock3NrPk6@zatzit> (raw)
In-Reply-To: <e5973e33-bb22-4c8f-b532-56f39ef87ea9@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2992 bytes --]

On Tue, Oct 21, 2025 at 01:52:25PM +0200, Laurent Vivier wrote:
> On 20/10/2025 03:20, David Gibson wrote:
> > On Fri, Oct 17, 2025 at 12:31:24PM +0200, Laurent Vivier wrote:
> > > Centralize epoll_add() and epoll_del() helper functions into new
> > > epoll_ctl.c/h files.
> > > 
> > > This also moves the union epoll_ref definition from passt.h to
> > > epoll_ctl.h where it's more logically placed.
> > > 
> > > The new epoll_add() helper simplifies adding file descriptors to epoll
> > > by taking an epoll_ref and events, handling error reporting
> > > consistently across all call sites.
> > > 
> > > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> > 
> > Concept looks good, some minor details in execution.
> > 
> > > ---
> > >   Makefile     | 22 +++++++++++-----------
> > >   epoll_ctl.c  | 45 +++++++++++++++++++++++++++++++++++++++++++++
> > >   epoll_ctl.h  | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
> > >   icmp.c       |  4 +---
> > >   passt.c      |  2 +-
> > >   passt.h      | 34 ----------------------------------
> > >   pasta.c      |  7 +++----
> > >   repair.c     | 14 +++++---------
> > >   tap.c        | 13 ++++---------
> > >   tcp.c        |  2 +-
> > >   tcp_splice.c |  2 +-
> > >   udp.c        |  2 +-
> > >   udp_flow.c   |  1 +
> > >   util.c       | 22 +++-------------------
> > >   util.h       |  4 +++-
> > >   vhost_user.c |  8 ++------
> > >   vu_common.c  |  2 +-
> > >   17 files changed, 134 insertions(+), 101 deletions(-)
> > >   create mode 100644 epoll_ctl.c
> > >   create mode 100644 epoll_ctl.h
> ...
> > > @@ -1327,14 +1327,12 @@ static void tap_backend_show_hints(struct ctx *c)
> > >   static void tap_sock_unix_init(const struct ctx *c)
> > >   {
> > >   	union epoll_ref ref = { .type = EPOLL_TYPE_TAP_LISTEN };
> > > -	struct epoll_event ev = { 0 };
> > >   	listen(c->fd_tap_listen, 0);
> > >   	ref.fd = c->fd_tap_listen;
> > > -	ev.events = EPOLLIN | EPOLLET;
> > > -	ev.data.u64 = ref.u64;
> > > -	epoll_ctl(c->epollfd, EPOLL_CTL_ADD, c->fd_tap_listen, &ev);
> > > +
> > > +	epoll_add(c->epollfd, EPOLLIN | EPOLLET, &ref);
> > 
> > Preexisting, but we should probably check for errors here.
> > 
> 
> To do what? die() ? err() to report the place where the error happens?

The case I'm concerned about is this fails, but we carry on.  Then we
lose 1/Nth of our packets because we're not getting events for one
queue, and weird failures follow.  It takes us ages to debug, because
we don't consider that the fd might have silently failed to make it
into the epoll set.

err() would be probably be enough to make this debuggable.  But
honestly, if we can't put our tap fds into the epoll, we're in a
sufficiently bad state that die() makes sense.

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2025-10-22  1:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17 10:31 [PATCH v4 0/7] Refactor epoll handling in preparation for multithreading Laurent Vivier
2025-10-17 10:31 ` [PATCH v4 1/7] util: Simplify epoll_del() interface to take epollfd directly Laurent Vivier
2025-10-17 10:31 ` [PATCH v4 2/7] epoll_ctl: Extract epoll operations Laurent Vivier
2025-10-17 11:48   ` Stefano Brivio
2025-10-17 12:21     ` Laurent Vivier
2025-10-17 13:05       ` Stefano Brivio
2025-10-20  1:20   ` David Gibson
2025-10-21 11:52     ` Laurent Vivier
2025-10-22  0:58       ` David Gibson [this message]
2025-10-17 10:31 ` [PATCH v4 3/7] util: Move epoll registration out of sock_l4_sa() Laurent Vivier
2025-10-17 10:31 ` [PATCH v4 4/7] tcp, flow: Replace per-connection in_epoll flag with threadnb in flow_common Laurent Vivier
2025-10-17 17:43   ` Stefano Brivio
2025-10-21 13:13     ` Laurent Vivier
2025-10-20  1:34   ` David Gibson
2025-10-21 12:14     ` Laurent Vivier
2025-10-22  1:00       ` David Gibson
2025-10-17 10:31 ` [PATCH v4 5/7] icmp: Use thread-based epoll management for ICMP flows Laurent Vivier
2025-10-20  1:35   ` David Gibson
2025-10-17 10:31 ` [PATCH v4 6/7] udp: Use thread-based epoll management for UDP flows Laurent Vivier
2025-10-20  1:39   ` David Gibson
2025-10-17 10:31 ` [PATCH v4 7/7] passt: Move main event loop processing into passt_worker() Laurent Vivier
2025-10-17 17:43   ` Stefano Brivio
2025-10-20  1:43   ` David Gibson
2025-10-21  8:00     ` Laurent Vivier
2025-10-22  0:53       ` David Gibson
2025-10-22  6:49         ` Laurent Vivier
2025-10-23  1:24           ` David Gibson

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=aPgsSL1ock3NrPk6@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).