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 AD3B95A005E for ; Mon, 13 Feb 2023 11:46:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676285175; 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=XPuK28wwy//xWZBeeEkzRv6rD2bUKYMt3oAcABIAex8=; b=PzWF5RCbgcKKFqLipn8W1Y9mAptyegR2XtwqnPpJRzdpsNAtkG0OUBzXicY3m2/lAuW6+U tgFxzf8YhxlePpw8K20H26Y7yYKubVFZWYQ3cjlbk7Y8Hqca9OMc5peye1XKjJN9Fa6tpo 4yfdKqj3YIb7r7cQtMRfHM5Wiz9ycRI= 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-597-eV_I38U1PF-7kcCoqbt0sA-1; Mon, 13 Feb 2023 05:46:12 -0500 X-MC-Unique: eV_I38U1PF-7kcCoqbt0sA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2D42418A6462; Mon, 13 Feb 2023 10:46:12 +0000 (UTC) Received: from maya.cloud.tilaa.com (unknown [10.33.32.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CCF12026D76; Mon, 13 Feb 2023 10:46:11 +0000 (UTC) Date: Mon, 13 Feb 2023 11:46:09 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH] tap: Send frames after the first one in tap_send_frames_pasta() Message-ID: <20230213114609.0f88cc31@elisabeth> In-Reply-To: References: <20230213011211.1198729-1-sbrivio@redhat.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: FSI5HAX5VFI6BSRFBGWDFMMILTOPRKCI X-Message-ID-Hash: FSI5HAX5VFI6BSRFBGWDFMMILTOPRKCI 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: passt-dev@passt.top X-Mailman-Version: 3.3.3 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 Mon, 13 Feb 2023 13:24:58 +1100 David Gibson wrote: > On Mon, Feb 13, 2023 at 02:12:11AM +0100, Stefano Brivio wrote: > > ...instead of repeatedly sending out the first one in iov. > > > > Fixes: e21ee41ac35a ("tcp: Combine two parts of pasta tap send path together") > > Signed-off-by: Stefano Brivio > > --- > > I just applied this, to unblock a series by David which was pending > > for way too long. The commit reference in Fixes: refers to a commit > > from said series which I'm pushing out together with this patch. > > Huh... how did this ever work even slightly. From that point of view, > > Reviewed-by: David Gibson > > > Posting anyway for reviews. > > That said.. > > > > > tap.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/tap.c b/tap.c > > index af9bc15..716d887 100644 > > --- a/tap.c > > +++ b/tap.c > > @@ -316,12 +316,13 @@ static void tap_send_frames_pasta(struct ctx *c, > > { > > size_t i; > > > > - for (i = 0; i < n; i++) { > > + for (i = 0; i < n; i++, iov++) { > > I quite dislike having multiple "counters" that need to be updated for > each loop iteration (manual strength reduction. It's really easy to > make a mistake in later changes and let the two values get out of sync > - which is exactly what I did with the earlier change that introduced > this bug. Um, yes. I try, whenever possible, to use just one "iterator", which would be iov, but the price of doing that "cleanly" here is wasting a struct iovec just to have a zero iov_len at the end, which makes little sense. > W.r.t. performance, I generally trust the compiler's automatic > strength reduction to have a better idea of whether it will be worth > it or not than my own guess. > > > if (write(c->fd_tap, (char *)iov->iov_base, iov->iov_len) < 0) { > > So, my *intention* on the older patch was to replace 'iov->' above > with 'iov[i].' That would also be consistent with tap_send_frames_passt(), so sure, let's change it. I can submit a patch too. -- Stefano