From: Geliang Tang <geliang@kernel.org>
To: Matthieu Baerts <matttbe@kernel.org>,
Mat Martineau <martineau@kernel.org>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH bpf-next v4 3/3] selftests/bpf: Support nonblock for send_recv_data
Date: Thu, 11 Apr 2024 14:52:44 +0800 [thread overview]
Message-ID: <bec7ade6bfc99f6340fa231cf68f0f4459625dbe.camel@kernel.org> (raw)
In-Reply-To: <12aab271-da72-49b4-ac91-2091b6889856@linux.dev>
mptcp-only
Hi Matt & Mat,
On Wed, 2024-04-10 at 14:34 -0700, Martin KaFai Lau wrote:
> On 4/9/24 11:13 PM, Geliang Tang wrote:
> > From: Geliang Tang <tanggeliang@kylinos.cn>
> >
> > Some tests, such as the MPTCP bpf tests, require send_recv_data
> > helper
> > to run in nonblock mode.
> >
> > This patch adds nonblock support for send_recv_data(). Check if it
> > is
> > currently in nonblock mode, and if so, ignore EWOULDBLOCK to
> > continue
> > sending and receiving.
> >
> > Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> > ---
> > tools/testing/selftests/bpf/network_helpers.c | 9 ++++++++-
> > 1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/bpf/network_helpers.c
> > b/tools/testing/selftests/bpf/network_helpers.c
> > index 137cd18ef3f2..ca16ef2b648e 100644
> > --- a/tools/testing/selftests/bpf/network_helpers.c
> > +++ b/tools/testing/selftests/bpf/network_helpers.c
> > @@ -555,6 +555,7 @@ struct send_recv_arg {
> > static void *send_recv_server(void *arg)
> > {
> > struct send_recv_arg *a = (struct send_recv_arg *)arg;
> > + int flags = fcntl(a->fd, F_GETFL);
> > ssize_t nr_sent = 0, bytes = 0;
> > char batch[1500];
> > int err = 0, fd;
> > @@ -578,6 +579,8 @@ static void *send_recv_server(void *arg)
> > if (nr_sent == -1 && errno == EINTR)
> > continue;
> > if (nr_sent == -1) {
> > + if (flags & O_NONBLOCK && errno ==
> > EWOULDBLOCK)
>
> I still don't see why it needs to be a non blocking IO. mptcp should
> work
> with blocking IO also, no? Does it really need non blocking IO to
> make
> mptcp test work? I would rather stay with blocking IO in selftest as
> much as
> possible for simplicity reason.
I need some help here.
This issue is reported by Matt in "CI: MPTCP BPF tests are now
validated", and my fixes ([1] and this patch) aren't accepted by
Martin. Is it normal to get EAGAINs in this case? Please give some
suggestions.
[1]
https://patchwork.kernel.org/project/mptcp/patch/311e074a3ca0465bdc5e4c2283e334bae5ccd306.1711296000.git.tanggeliang@kylinos.cn/
Thanks,
-Geliang
>
> I am afraid the root cause of the EAGAIN thread has not been figured
> out yet:
> https://lore.kernel.org/all/b3943f9a8bf595212b00e96ba850bf32893312cc.camel@kernel.org/
>
> Lets drop patch 3 until it is understood why mptcp needs EAGAIN or
> non-blocking IO.
> It feels like there is some flakiness and it should be understood and
> avoided.
>
> Other than the comment in patch 2, the first two patches lgtm. Please
> respin with
> the first two patches.
>
> > + continue;
> > err = -errno;
> > break;
> > }
> > @@ -599,6 +602,7 @@ static void *send_recv_server(void *arg)
> >
> > int send_recv_data(int lfd, int fd, uint32_t total_bytes)
> > {
> > + int flags = fcntl(lfd, F_GETFL);
> > ssize_t nr_recv = 0, bytes = 0;
> > struct send_recv_arg arg = {
> > .fd = lfd,
> > @@ -622,8 +626,11 @@ int send_recv_data(int lfd, int fd, uint32_t
> > total_bytes)
> > MIN(total_bytes - bytes,
> > sizeof(batch)), 0);
> > if (nr_recv == -1 && errno == EINTR)
> > continue;
> > - if (nr_recv == -1)
> > + if (nr_recv == -1) {
> > + if (flags & O_NONBLOCK && errno ==
> > EWOULDBLOCK)
> > + continue;
> > break;
> > + }
> > bytes += nr_recv;
> > }
> >
>
>
next prev parent reply other threads:[~2024-04-11 6:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 6:13 [PATCH bpf-next v4 0/3] export send_recv_data Geliang Tang
2024-04-10 6:13 ` [PATCH bpf-next v4 1/3] selftests/bpf: Add struct send_recv_arg Geliang Tang
2024-04-10 6:13 ` [PATCH bpf-next v4 2/3] selftests/bpf: Export send_recv_data helper Geliang Tang
2024-04-10 21:20 ` Martin KaFai Lau
2024-04-10 6:13 ` [PATCH bpf-next v4 3/3] selftests/bpf: Support nonblock for send_recv_data Geliang Tang
2024-04-10 21:34 ` Martin KaFai Lau
2024-04-11 6:52 ` Geliang Tang [this message]
2024-04-22 6:50 ` Geliang Tang
2024-04-22 9:45 ` Matthieu Baerts
2024-04-22 10:04 ` Geliang Tang
2024-04-22 10:31 ` Matthieu Baerts
2024-04-22 10:34 ` Geliang Tang
2024-04-22 10:39 ` Matthieu Baerts
2024-04-23 2:58 ` Geliang Tang
2024-05-07 4:04 ` Geliang Tang
2024-04-10 17:53 ` [PATCH bpf-next v4 0/3] export send_recv_data MPTCP CI
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=bec7ade6bfc99f6340fa231cf68f0f4459625dbe.camel@kernel.org \
--to=geliang@kernel.org \
--cc=martineau@kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.