All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	John Fastabend <john.fastabend@gmail.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Qiao Ma <mqaio@linux.alibaba.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jakub Sitnicki <jakub@cloudflare.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Shuah Khan <shuah@kernel.org>, Mykola Lysenko <mykolal@fb.com>,
	LKML <linux-kernel@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2] selftests/bpf: fix incorrect fcntl call (test_sockmap.c)
Date: Thu, 22 Sep 2022 11:46:49 -0700	[thread overview]
Message-ID: <632cad99e05c2_3c2b22088@john.notmuch> (raw)
In-Reply-To: <CAEf4BzbqdDUY-1mpGUBk-CpMLAC7jvgRV7rNbgvxr=5nMOsj2Q@mail.gmail.com>

Andrii Nakryiko wrote:
> On Fri, Aug 26, 2022 at 9:24 AM John Fastabend <john.fastabend@gmail.com> wrote:
> >
> > Alexei Starovoitov wrote:
> > > On Wed, Aug 24, 2022 at 7:11 PM Qiao Ma <mqaio@linux.alibaba.com> wrote:
> > > >
> > > > In test_sockmap.c, the testcase sets socket nonblock first, and then
> > > > calls select() and recvmsg() to receive data.
> > > > If some error occur, nonblock setting will make recvmsg() return
> > > > immediately, rather than blocking forever.
> > > >
> > > > However, the way to call fcntl() to set nonblock is wrong.
> > > > To set socket noblock, we need to use
> > > > > fcntl(fd, F_SETFL, O_NONBLOCK);
> > > > rather than:
> > > > > fcntl(fd, O_NONBLOCK);
> > > >
> > > > Signed-off-by: Qiao Ma <mqaio@linux.alibaba.com>
> > > > ---
> > > >  tools/testing/selftests/bpf/test_sockmap.c | 7 ++++++-
> > > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
> > > > index 0fbaccdc8861..abb4102f33b0 100644
> > > > --- a/tools/testing/selftests/bpf/test_sockmap.c
> > > > +++ b/tools/testing/selftests/bpf/test_sockmap.c
> > > > @@ -598,7 +598,12 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
> > > >                 struct timeval timeout;
> > > >                 fd_set w;
> > > >
> > > > -               fcntl(fd, fd_flags);
> > > > +               err = fcntl(fd, F_SETFL, fd_flags);
> > > > +               if (err < 0) {
> > > > +                       perror("fcntl failed");
> > > > +                       goto out_errno;
> > > > +               }
> > > > +
> > >
> > > John, Jakub,
> > >
> > > Please review this.
> > > Unfortunately test_sockmap (and sockmap kernel) is broken
> > > before and after this patch,
> > > so I'm hesitant to apply it not to make thing harder to debug.
> > > Here is what I see:
> > > # ./test_sockmap

[...]

> > > and test_sockmap 'hangs' (or doing something for long time) after
> > > #31/ 6 sockhash:ktls:txmsg test drop:OK
> >
> > Thanks for spotting I'll take a look.
> 
> Friendly ping. John, did you get a chance to look at this? This patch
> is still marked as "Needs ACK" in Patchworks.


Yep thanks. We are tracking a couple fixes internally around this so should
have something pop out soon. I think we want the fix and test to go in at
the same time.

.John

  reply	other threads:[~2022-09-22 18:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25  2:11 [PATCH bpf-next v2] selftests/bpf: fix incorrect fcntl call (test_sockmap.c) Qiao Ma
2022-08-26  2:07 ` Alexei Starovoitov
2022-08-26 16:23   ` John Fastabend
2022-09-21 20:37     ` Andrii Nakryiko
2022-09-22 18:46       ` John Fastabend [this message]
2022-09-26 15:54         ` Daniel Borkmann

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=632cad99e05c2_3c2b22088@john.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jakub@cloudflare.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mqaio@linux.alibaba.com \
    --cc=mykolal@fb.com \
    --cc=shuah@kernel.org \
    /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.