From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 48E8A5A026D for ; Tue, 5 Sep 2023 04:56:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1693882566; bh=1nAAJ54jzRf9+n0EzuLBXDs4YtBThBVtiwzwbSqKbqU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ERIhFHMTi59zNAev/gS78xxT0ADBFvLZQydjYxpYWcRXHmO8iaYA+OBntsPn+02Vc Q1DVVY2pKNy3VXHRIwZS8Wk0NhxcpXE6h0Ryj0mfIso5eD51LGPzxhcen9GBfXh8Og S1FGenQYVjHAKeA2U9jrfJ0RHaNHSH9xQnXUTuqI= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Rfqrk72P6z4wy8; Tue, 5 Sep 2023 12:56:06 +1000 (AEST) Date: Tue, 5 Sep 2023 12:16:11 +1000 From: David Gibson To: Jon Maloy Subject: Re: [RFC v2] tcp: add support for read with offset when using MSG_PEEK Message-ID: References: <20230623021227.2625490-1-jmaloy@redhat.com> <20230623130106.68d0e058@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="u4ot024W+VqXPqpx" Content-Disposition: inline In-Reply-To: Message-ID-Hash: RMNTMJ2HPDZ3C2YPH7MMH7QGC5BNQ5GM X-Message-ID-Hash: RMNTMJ2HPDZ3C2YPH7MMH7QGC5BNQ5GM 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: Stefano Brivio , lvivier@redhat.com, dgibson@redhat.com, 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: --u4ot024W+VqXPqpx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 04, 2023 at 01:14:17PM -0400, Jon Maloy wrote: >=20 >=20 > On 2023-06-23 07:02, Stefano Brivio wrote: > > On Thu, 22 Jun 2023 22:12:27 -0400 > > Jon Maloy wrote: > >=20 > > > When reading received messages with MSG_PEEK, we sometines have to re= ad > > > the leading bytes of the stream several times, only to reach the bytes > > > we really want. This is clearly non-optimal. > > >=20 > > > What we would want is something similar to pread/preadv(), but working > > > even for tcp sockets. At the same time, we obviously don't want to add > > > any new arguments to the recv/recvmsg() calls. > > >=20 > > > In this commit, we allow the user to set iovec.iov_base in the first > > > vector entry to NULL. This tells the socket to skip the first entry, > > > hence making the iov_len field of that entry indicate the offset valu= e. > > > This way, there is no need to add any new arguments. > > Ah-ha! I'm glad you found an acceptable way to pass a NULL pointer > > there. :) > >=20 > > > This change is simple and non-intrusive, and should be safe addition = to > > > the socket API. We have measured it to give a throughput improvement = of > > ...it would be nice to also do a bit of profiling with perf(1) -- > > that's where I originally noticed we were wasting cycles on filling up > > tcp_buf_discard. Plus, sure, there's also some value in dropping a > > useless 16 MiB buffer. > >=20 > > If you need examples/inspiration: the pasta (automated) demo shows > > that, skip at 9:20 in: https://passt.top/passt/about/#pasta_2 (the one > > on the left) > >=20 > > and that's simply done like this: > > https://passt.top/passt/tree/test/demo/pasta#n163 > This looks like a script language, but I don't recognize it. How do I run > it? It's the hand rolled script language of the passt tests. The interpreter is in test/lib/test. Easiest way to run it is probably to "make check" in test/ of the passt tree. If you want to selectively run certain things, edit test/run. --=20 David Gibson | 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 --u4ot024W+VqXPqpx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmT2j2MACgkQzQJF27ox 2Gct/xAAioVE8qC5FkjnG5Vvedu52Mo4AgY3n+wa+ZGasYidzJvrA9NcCK14WB84 IlI2MxVvKCpcjvMndcrLqMrtFQlL/FTexpLtavrCyUfla4P5M7DizkCp2w/M38Ij 5Gt1WpDHPEf9H9IBXN0yXvYr99spUhquolwvD5GA4hMU60XIcnqDdKhwTITvEHJf wojEQHxgtobxHtnjvVQCP0aZOTGPYW2nWEzwTOCJbPF61+JskMlrkXXWnP72Hl99 Uven+JSkYl5zTKn9bqJmifMICw1MRhe8BPfz2w/d5ihGsUhJZFzUcXHDiiR+edHH 85QvtFKmO7uM5Akkkb9iTRtBtWVONybVnN3/nrt48Lm68NkmlKdHZ5hUYQbWyLzf lHbLr+7DqhCiQ2lWuxTCcwvXLGDm4LDESKPp35RzqvRZ9ofEzZ6Dn4h36pBu9x83 1I9peNZ86D3ysT9WdxJzHCtl+Rg1qatyvANvSgfeV1ZV2OheDJvBHzKsmw0B7cDl fFEnibKIfqEQzZkvxxW4k9kGj4wCyXMT3Uq5DF6fVNCxmVwmqyeoJobv21C4Y4Yb Mx3KMNfMRjP8GR3n2vSC4WnD4FPGN2ET0gG3CaZQKmgqddJ9V1zW8AwHbgN6BaB+ KRb5a0xK6qJdr+wt7HRFmDKpiBpfdGoMsKgzYZig6TIF/vQSD4Y= =sVdn -----END PGP SIGNATURE----- --u4ot024W+VqXPqpx--