From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top, Laurent Vivier <lvivier@redhat.com>
Subject: Re: [PATCH] tcp_vu: Fix off-by one in header count array adjustment
Date: Wed, 12 Feb 2025 20:44:50 +0100 [thread overview]
Message-ID: <20250212204450.6f09c320@elisabeth> (raw)
In-Reply-To: <Z6vx5tj4gr004rFr@zatzit>
On Wed, 12 Feb 2025 11:57:10 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:
> On Tue, Feb 11, 2025 at 08:51:33PM +0100, Stefano Brivio wrote:
> > From: Laurent Vivier <lvivier@redhat.com>
> >
> > 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 <david@gibson.dropbear.id.au>
> > [sbrivio: commit message, albeit not really descriptive]
> > Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
>
> I think I've understood the surrounding code enough to say,
>
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
>
> 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
prev parent reply other threads:[~2025-02-12 19:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 19:51 [PATCH] tcp_vu: Fix off-by one in header count array adjustment Stefano Brivio
2025-02-12 0:57 ` David Gibson
2025-02-12 19:44 ` Stefano Brivio [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250212204450.6f09c320@elisabeth \
--to=sbrivio@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).