From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Tf+3T1kb; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 905635A0623 for ; Wed, 12 Feb 2025 20:44:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1739389495; 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=e71K7COucjxzKoAc5QJMl6OQKjBPG+/Tvbb8IPnY/3k=; b=Tf+3T1kbI561eDZPZcNSxpMYETuyJeHAtBEnyBhTqdYERPPRWnJ16NJHY/81Vry3hzgveb cWZ3eTB9djy1aRbd2Kyri5pwwEaqrgRXudPDm26QsdfYEeh7NsK0asUqrhbH2SaKzoSJpg VIOZ9dKgeM+s0TbSMEVnfRjd5gipigg= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-Tt2luuYrMEOD7jJG7WH1dQ-1; Wed, 12 Feb 2025 14:44:54 -0500 X-MC-Unique: Tt2luuYrMEOD7jJG7WH1dQ-1 X-Mimecast-MFC-AGG-ID: Tt2luuYrMEOD7jJG7WH1dQ Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-38de0201875so38519f8f.0 for ; Wed, 12 Feb 2025 11:44:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739389493; x=1739994293; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=e71K7COucjxzKoAc5QJMl6OQKjBPG+/Tvbb8IPnY/3k=; b=dqsjVs8Gn7UCX9X7TPpsSBIlBcj1pGWEl8+MXjHu4IE64mvNUo+FR7EO4EmWoZIZQr ECGdjUpD6R5D7+ClvvcDjI0pH93sjCph+C+0KlRZRFCya6FqKY2Pc9jOJFygiSOCKEx4 p6fqH7L8cT1hTNLretJw49K7mqSXZVddk6IyVsZ1bt0A7O/WUeYLKA5E0ZupPY8HTxZ6 FF0qTGLg39Fwq/SyFesplwTobYC01YJd+afY2O2FKXRDm7kkQ7FvKfYSEv5ov/eLeShv 4ylJww4YTXaFZCCWMpQB2gbNMy/soCmuqy71lkie7x1dWYUMPtKsVaRyEJFupAZv3FkC TjgA== X-Gm-Message-State: AOJu0YyMihKn1JDz3QihG8uN6zubU5pbV6/eJxDdmoqkZf1mZ3vghx/a WJg0Qp6/Xpib4adndo62MI7whN+183u9areCBGp/qcKRHGxGLy3ZrBU6LGsRgjl31XEfNLfZbyP s9OgHAJOnfRwU9SnX+k1JP0mrlyWFiWG5XYfYeDFJ3vRCWNCQGQ== X-Gm-Gg: ASbGnctoo3B9ZQWwiee2jVFLulY0/kIkWKhvLr2jO3eyedzCEL4relq7pworNB6ackL /o4TdHIjIVPjNKhM/+EFlmy+4RVZEF8vDzydALXS05cBNQ0DgxcE5D02H+p5RNjpPPEekAaOL3d OS3g5yRFAgF42JjgsKQUcCuo8b4dI2UdWzbnLMHf7NgQAukjeDg9vFYYf8Hw82T0zWVYgLPwTjh qAnXCxYTo5r1q2CDZvc25GoXXfxtkUnLHqwj9ctQAVzYtBiCGgTu6nxSaMu4VSaXYEZmjV/zt9Y ypadOG3UYKN+f9b7cxKhFFyaEhbXlXyAfA== X-Received: by 2002:a5d:5846:0:b0:38f:2065:3f20 with SMTP id ffacd0b85a97d-38f244deeb2mr528661f8f.17.1739389492989; Wed, 12 Feb 2025 11:44:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvxw2OO+X90q0Sc2eKcxJuB4VlvNWXzBN6Uk4SU96zCBibYSoZAv1e0xXt/Gn7slha5reDEg== X-Received: by 2002:a5d:5846:0:b0:38f:2065:3f20 with SMTP id ffacd0b85a97d-38f244deeb2mr528644f8f.17.1739389492577; Wed, 12 Feb 2025 11:44:52 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38e6ccc8c1dsm2334796f8f.101.2025.02.12.11.44.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2025 11:44:52 -0800 (PST) Date: Wed, 12 Feb 2025 20:44:50 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH] tcp_vu: Fix off-by one in header count array adjustment Message-ID: <20250212204450.6f09c320@elisabeth> In-Reply-To: References: <20250211195133.198082-1-sbrivio@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: vq7MacwFYWOnzQ_E8D8BhCZfNxNzca4ce7HEHhFW45E_1739389493 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: JOTIG6Z6OUIWDTVYNDM43GKMCDBE7YXK X-Message-ID-Hash: JOTIG6Z6OUIWDTVYNDM43GKMCDBE7YXK 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, Laurent Vivier 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 Wed, 12 Feb 2025 11:57:10 +1100 David Gibson wrote: > On Tue, Feb 11, 2025 at 08:51:33PM +0100, Stefano Brivio wrote: > > From: Laurent Vivier > > > > Not entirely clear to me why, but Laurent proposed this patch to fix > > an issue were we would end up with a zero buf_cnt in > > tcp_vu_data_from_sock() and all sorts of weirdnesses. > > > > Reported-by: David Gibson > > [sbrivio: commit message, albeit not really descriptive] > > Signed-off-by: Stefano Brivio > > I think I've understood the surrounding code enough to say, > > Reviewed-by: David Gibson > > and offer this possible description if we don't hear from Laurent in > time. > > ### > > head_cnt represents the number of frames we're going to forward to the > guest in tcp_vu_sock_recv(), each of which could require multiple > buffers ("elements"). We initialise it with as many frames as we can > find space for in vu buffers, and we then need to adjust it down to > the number of frames we actually (partially) filled. > > We adjust it down based on number of individual buffers used by the > data from recvmsg(). At this point 'i' is *one greater than* that > number of buffers, so we need to discard all (unused) frames with a > buffer index >= i, instead of > i. > > ### Ah, great, that starts making sense. Applied with this commit message. -- Stefano