From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 5E1CE5A004F for ; Mon, 29 Jul 2024 03:16:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1722215760; bh=jg1FyvACLOuoQKeQianvDmqNZHrCH2EXKK8F7Uvw4m4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oxSl7+mzFhfB/+SaysBqfiwkfD4ZJHtqHSz4MX/+P2gsGB8nG4LKfEK2PZQA3Bkgk BUXPTVxlbAmPwFNcGx/hCr3Zoxlq8oM7YB12Op6DlhW9He/j0g85ztaX7R1rir4n0T DaprZRfgALHHaMP9TER0FVdqG2jIHA4z/uwQF9iOtEbm2joe//hxNbtA+L5PKUvdAl HAXwZvOmlHZVKPUgn1tEvNkvy64bWeraFw1+bUc9kcTGg44QA9q/2a2fetsLKNMu2d EDo174MlKw9mjKeI60fOH1ErZSkWhDk/gin+zkAv2x1FFhCxBC8GklrO2wulzGnxtf o6hTQ0gWN+4BQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4WXL5r6SWQz4wc1; Mon, 29 Jul 2024 11:16:00 +1000 (AEST) Date: Mon, 29 Jul 2024 11:15:41 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 3/5] tap: Don't use EPOLLET on Qemu sockets Message-ID: References: <20240726072031.3941305-1-david@gibson.dropbear.id.au> <20240726072031.3941305-4-david@gibson.dropbear.id.au> <20240726100056.235b65de@elisabeth> <20240726152518.7daab5bc@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jB0x821vqlCM0QIE" Content-Disposition: inline In-Reply-To: <20240726152518.7daab5bc@elisabeth> Message-ID-Hash: WKDWXD5UOXAKKPJ7W6PT356DPBD3HCYT X-Message-ID-Hash: WKDWXD5UOXAKKPJ7W6PT356DPBD3HCYT X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --jB0x821vqlCM0QIE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 26, 2024 at 03:25:38PM +0200, Stefano Brivio wrote: > On Fri, 26 Jul 2024 22:12:27 +1000 > David Gibson wrote: >=20 > > On Fri, Jul 26, 2024 at 10:00:56AM +0200, Stefano Brivio wrote: > > > On Fri, 26 Jul 2024 17:20:29 +1000 > > > David Gibson wrote: > > > =20 > > > > Currently we set EPOLLET (edge trigger) on the epoll flags for the > > > > connected Qemu Unix socket. It's not clear that there's a reason f= or > > > > doing this: for TCP sockets we need to use EPOLLET, because we leav= e data > > > > in the socket buffers for our flow control handling. That consider= ation > > > > doesn't apply to the way we handle the qemu socket however. =20 > > >=20 > > > It significantly decreases epoll_wait() overhead on sustained data > > > transfers, because we can read multiple TAP_BUF_SIZE buffers at a time > > > instead of just one. =20 > >=20 > > That's a reason to keep the loop, but not EPOLLET itself, AFAICT. I'd > > be happy enough to put the loop back in as an optimization (although, > > I'd prefer to avoid the goto). >=20 > True, we could actually have that loop back without EPOLLET. >=20 > But the reason why I added EPOLLET, despite the resulting complexity, > was surely increased overhead without it. > > I can't remember (and unfortunately I didn't write this in that commit > message from 2021) exactly how that looked like, if we had spurious or > more frequent wake-ups or what else. Maybe that was a side effect of > something that's fixed or otherwise changed now, but still we should > give this a pass with perf(1) before we try to optimise this again (if > it even needs to be optimised, that is). I think we need to understand if and why that's still the case before putting this back in. I can see an obvious reason why the loop might reduce overhead, but not why the EPOLLET flag itself would. If anything I'd expect level triggered events to more accurately give us wakeups only exactly when we need them. Note also that even looping withouth EPOLLET does have its own cost here: it potentially allows a heavy burst of traffic from qemu to starve processing of events on other sockets. --=20 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 --jB0x821vqlCM0QIE Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmam7TwACgkQzQJF27ox 2GfV9w//aMDUnu132Ft4oCanm8noEG/Q5gs59EpDos2A7evoNoKYzZtsDVxnheb/ uvp89EXmw9xwm7Iz8PpR+7eTINeAC2szNPDjM+IEBWwg3jmgFYLGZU1O/4yhAj3c FwuU/Oso6un0Tjgq75mlm2+wgk9DMO1SCweeaMeg7jtlS1WR7ORF/SD4352BQWO2 3Btf6WEEQHVnrnff58zpJvrvSAVN6k9evp5jPy9WjzjoEXBRo9epWZiWsel25pDe uxrl+/GjWm/cSWv7TqntOhZkSmek6DV2nhsyROd2kIfNZuokT+knJsrYDNznq8+D f9AeXRyO3GHJ/OKnXk+0MxML8YCYrZ59XRKBKa3unJz0j3Cboxy3sOWRN1HfOXa9 6ADYdDDM9+1/vDTD0CgytedoaDyX4RRv2QSb1Z0gHtyYezZRZbtBteCG0eNCn7xT TGS7nQp3D/KaB+Xxkdh/+kAdjhh0lqQqaaW6B3J7ISk3yE5FLWuQnm+2bv3QEiD/ cpbAdzuUC0TpAjUiiMCWWBVXlB9WoAu28DHt9wYyRQMSfaCr7TXIqFuC7WUmJ1TZ kvlsnuiYQoJSdWFQXuYuZZjvpw6neMqS4g/Zo5eui5TuYiY/DY3YfZBfpZV4g4mn dJ0EafTazSxRXh4mGNkjMG1WSpXnHukUwDZlVz9DYPCUm/UQEXw= =ZenE -----END PGP SIGNATURE----- --jB0x821vqlCM0QIE--