From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202506 header.b=Y3oBi1/X; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 9CF125A0271 for ; Wed, 30 Jul 2025 02:32:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202506; t=1753835337; bh=O7kbFQTlMkf4ntqOTsh1E0POgaueIalHL3052q0Of14=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Y3oBi1/XU8nu3DX0BtfpP0jqGbYryALeEQB/Yyx0kx5C6n3WZvmJOhBQg9gJrWoiX XaTFXjcEQwvsHC6lsqp18ME4ykMGwRlfMB50jeDrd84Vryry8iUuWgHOx4p3R3O4gH jZ6KyAlpkfTiwRtH47G/7RmSXicggjeYyPmaFsWZUsdu2NLcu+uG3vW6qTzKwR5rNG KffmCpHb78/E8amAd76OhJWF5cmh3Q4cOSpOj1CwMV/xVZJksLEERxAPq7IBenu1jP jpkKqKQKXv51UYoGU3c7yR+pMzziIJy+kW+pqhf9YudH6NZi4dQH+uQ8bbBYFWc4Zn VltL8iINn1V4Q== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4bsCkd26xDz4wcn; Wed, 30 Jul 2025 10:28:57 +1000 (AEST) Date: Wed, 30 Jul 2025 10:32:01 +1000 From: David Gibson To: Eugenio Perez Martin Subject: Re: [RFC v2 10/11] tap: add poll(2) to used_idx Message-ID: References: <20250709174748.3514693-1-eperezma@redhat.com> <20250709174748.3514693-11-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="YgbSUmWFBVYM66G1" Content-Disposition: inline In-Reply-To: Message-ID-Hash: HGTQ44E3KB5LXANYSJ7YN72OM5LGRZ6G X-Message-ID-Hash: HGTQ44E3KB5LXANYSJ7YN72OM5LGRZ6G 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, jasowang@redhat.com 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: --YgbSUmWFBVYM66G1 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 29, 2025 at 09:04:19AM +0200, Eugenio Perez Martin wrote: > On Tue, Jul 29, 2025 at 2:33=E2=80=AFAM David Gibson > wrote: > > > > On Mon, Jul 28, 2025 at 07:03:12PM +0200, Eugenio Perez Martin wrote: > > > On Thu, Jul 24, 2025 at 3:21=E2=80=AFAM David Gibson > > > wrote: > > > > > > > > On Wed, Jul 09, 2025 at 07:47:47PM +0200, Eugenio P=C3=A9rez wrote: > > > > > From ~13Gbit/s to ~11.5Gbit/s. > > > > > > > > Again, I really don't know what you're comparing to what here. > > > > > > > > > > When the buffer is full I'm using poll() to wait until vhost free some > > > buffers, instead of actively checking the used index. This is the cost > > > of the syscall. > > > > Ah, right. So.. I'm not sure if it's so much the cost of the syscall > > itself, as the fact that you're actively waiting for free buffers, > > rather than returning to the main epoll loop so you can maybe make > > progress on something else before returning to the Tx path. > > >=20 > Previous patch also wait for free buffers, but it does it burning a > CPU for that. Ah, ok. Hrm. I still find it hard to believe that it's the cost of the syscall per se that's causing the slowdown. My guess is that the cost is because having the poll() leads to a higher latency between the buffer being released and us detecting it and re-using. > The next patch is the one that allows to continue progress as long as > there are enough free buffers, instead of always wait until all the > buffer has been sent. But there are situations where this conversion > needs other code changes. In particular, all the calls to > tcp_payload_flush after checking that we have enough buffers like: >=20 > if (tcp_payload_sock_used > TCP_FRAMES_MEM - 2) { > tcp_buf_free_old_tap_xmit(c, 2); > tcp_payload_flush(c); > ... > } >=20 > Seems like coroutines would be a good fix here, but maybe there are > simpler ways to go back to the main loop while keeping the tcp socket > "ready to read" by epoll POV. Out of curiosity, what do you think > about setjmp()? :). I think it has its uses, but deciding to go with it is a big architectural decision not to be entered into likely. --=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 --YgbSUmWFBVYM66G1 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmiJZ/MACgkQzQJF27ox 2Gehdw/8D0lXTN2BitCPLnE5IeiwGt57hzXvp8nRl8d5VM+5njXcox8JZbdUQAjl BFY6o0L4lOMHkwTnDkuz5a40LQIYmjMWKq8d7NkCS1JrwvEIWlmC0y4Jo+EcEHiA GJdvmCdwxQ381eYYLszB2ykQ33DN+9c1FRWwjtcjRAzNC3EHkm2sTHBph0L0RLBQ L8UjSVwY9WtDQZpLb/Q4LHemVRROff2JMIbVkLtnGzwiga4+hRQRsYN4PDGhzHwB VwldDXBxAr7B73t+GzF5mKoO9Gh4hLbKxxqYCFUxTsVehvoabAJYGktQMUD/nsF9 uMZn6fDG+F5VHhnS0AEEUEoW48JBWKI2XrZNTYO3DskpVolAD8wXTwZx3jCZ9oDc Oil0ozJuo9aisFUdXhAb9yAraieyll+8iWxSZv4FR4Nn+mcsbAEBFmdmienLy87q 6+OrNIiG/ZUvom/ftvAHXck/TroQsZzzSrD7x2TeCOUqj35TakYrl7hronF1qpfs 4vGS5tC7ggA3FfOVu6HOKGTVv9gp02pdvfo6GGHDySBDfvLEtJbDJZbPv364Y2jY XHHPEvLRPTpY609zMXteS39D3A+F/cUy8jaeOxAVwLnl7ZeiK3jUtlm29v/geetA JOwQ7D4na4YPRcdqLGinGnPDmRRH5ogAD0rSQftWGpKO7f2h6Gg= =4l5t -----END PGP SIGNATURE----- --YgbSUmWFBVYM66G1--