From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id E8FF85A026F for ; Tue, 5 Sep 2023 08:19:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693894775; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3GcYD93kUnlfmJhyMIj8XqKCE6xIbvV2w9lizx7t3B8=; b=OoHOijguLD2tATSIF4oHWfGFdNlLJ4BUqHK1Y2rnUE4Gvi92JXS25lR9owfGMxhIW1Bnfr u5p4wMtNfi1+IEK+ovmk2zwVfh0WtwmduosvcPmYef3zvpiHJUWypnbx/j6ugBo13dJDLe OI30dbLxigpFkh+0+sjGu7z12FWPHhY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-623-tlW5Q89FNFa0lF_M1R0K7w-1; Tue, 05 Sep 2023 02:19:32 -0400 X-MC-Unique: tlW5Q89FNFa0lF_M1R0K7w-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 816A99423CF; Tue, 5 Sep 2023 06:19:32 +0000 (UTC) Received: from elisabeth (unknown [10.39.208.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 50A06568FF; Tue, 5 Sep 2023 06:19:31 +0000 (UTC) Date: Tue, 5 Sep 2023 08:19:29 +0200 From: Stefano Brivio To: Jon Maloy Subject: Re: [RFC v2] tcp: add support for read with offset when using MSG_PEEK Message-ID: <20230905081929.000e8a7b@elisabeth> In-Reply-To: References: <20230623021227.2625490-1-jmaloy@redhat.com> <20230623130106.68d0e058@elisabeth> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: Z622EAGYAML4VFEG3G74V6MODSC72YD6 X-Message-ID-Hash: Z622EAGYAML4VFEG3G74V6MODSC72YD6 X-MailFrom: sbrivio@redhat.com 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: David Gibson , 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: On Tue, 5 Sep 2023 12:16:11 +1000 David Gibson wrote: > On Mon, Sep 04, 2023 at 01:14:17PM -0400, Jon Maloy wrote: > > > > > > On 2023-06-23 07:02, Stefano Brivio wrote: > > > On Thu, 22 Jun 2023 22:12:27 -0400 > > > Jon Maloy wrote: > > > > > > > When reading received messages with MSG_PEEK, we sometines have to read > > > > the leading bytes of the stream several times, only to reach the bytes > > > > we really want. This is clearly non-optimal. > > > > > > > > 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. > > > > > > > > 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 value. > > > > 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. :) > > > > > > > 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. > > > > > > 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) > > > > > > 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. ...some more details at test/README.md. -- Stefano