* [PATCH bpf v4 0/2] Two fixes for test_sockmap
@ 2024-04-09 5:18 Geliang Tang
2024-04-09 5:18 ` [PATCH bpf v4 1/2] selftests/bpf: Add F_SETFL for fcntl in test_sockmap Geliang Tang
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Geliang Tang @ 2024-04-09 5:18 UTC (permalink / raw)
To: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Jakub Sitnicki
Cc: Geliang Tang, bpf, mptcp
From: Geliang Tang <tanggeliang@kylinos.cn>
v4:
- address Martin's comments for v3. (thanks.)
- add Yonghong's "Acked-by" tags. (thanks.)
- update subject-prefix from "bpf-next" to "bpf".
Patch 1, v3 of "selftests/bpf: Add F_SETFL for fcntl":
- detect nonblock flag automaticly, then test_sockmap can run in both
block and nonblock modes.
- use continue instead of again in v2.
Patch 2, fix for umount cgroup2 error.
Geliang Tang (2):
selftests/bpf: Add F_SETFL for fcntl in test_sockmap
selftests/bpf: Fix umount cgroup2 error in test_sockmap
tools/testing/selftests/bpf/test_sockmap.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH bpf v4 1/2] selftests/bpf: Add F_SETFL for fcntl in test_sockmap
2024-04-09 5:18 [PATCH bpf v4 0/2] Two fixes for test_sockmap Geliang Tang
@ 2024-04-09 5:18 ` Geliang Tang
2024-04-11 18:10 ` Martin KaFai Lau
2024-04-09 5:18 ` [PATCH bpf v4 2/2] selftests/bpf: Fix umount cgroup2 error " Geliang Tang
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Geliang Tang @ 2024-04-09 5:18 UTC (permalink / raw)
To: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Jakub Sitnicki
Cc: Geliang Tang, bpf, mptcp
From: Geliang Tang <tanggeliang@kylinos.cn>
Incorrect arguments are passed to fcntl() in test_sockmap.c when invoking
it to set file status flags. If O_NONBLOCK is used as 2nd argument and
passed into fcntl, -EINVAL will be returned (See do_fcntl() in fs/fcntl.c).
The correct approach is to use F_SETFL as 2nd argument, and O_NONBLOCK as
3rd one.
In nonblock mode, if EWOULDBLOCK is received, continue receiving, otherwise
some subtests of test_sockmap fail.
Fixes: 16962b2404ac ("bpf: sockmap, add selftests")
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
---
tools/testing/selftests/bpf/test_sockmap.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
index 024a0faafb3b..4feed253fca2 100644
--- a/tools/testing/selftests/bpf/test_sockmap.c
+++ b/tools/testing/selftests/bpf/test_sockmap.c
@@ -603,7 +603,9 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
struct timeval timeout;
fd_set w;
- fcntl(fd, fd_flags);
+ if (fcntl(fd, F_SETFL, fd_flags))
+ goto out_errno;
+
/* Account for pop bytes noting each iteration of apply will
* call msg_pop_data helper so we need to account for this
* by calculating the number of apply iterations. Note user
@@ -678,6 +680,7 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
perror("recv failed()");
goto out_errno;
}
+ continue;
}
s->bytes_recvd += recv;
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH bpf v4 2/2] selftests/bpf: Fix umount cgroup2 error in test_sockmap
2024-04-09 5:18 [PATCH bpf v4 0/2] Two fixes for test_sockmap Geliang Tang
2024-04-09 5:18 ` [PATCH bpf v4 1/2] selftests/bpf: Add F_SETFL for fcntl in test_sockmap Geliang Tang
@ 2024-04-09 5:18 ` Geliang Tang
2024-04-09 6:07 ` [PATCH bpf v4 0/2] Two fixes for test_sockmap MPTCP CI
2024-04-11 18:10 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: Geliang Tang @ 2024-04-09 5:18 UTC (permalink / raw)
To: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Jakub Sitnicki
Cc: Geliang Tang, bpf, mptcp
From: Geliang Tang <tanggeliang@kylinos.cn>
This patch fixes the following "umount cgroup2" error in test_sockmap.c:
(cgroup_helpers.c:353: errno: Device or resource busy) umount cgroup2
Cgroup fd cg_fd should be closed before cleanup_cgroup_environment().
Fixes: 13a5f3ffd202 ("bpf: Selftests, sockmap test prog run without setting cgroup")
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
---
tools/testing/selftests/bpf/test_sockmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
index 4feed253fca2..efb4f34bf703 100644
--- a/tools/testing/selftests/bpf/test_sockmap.c
+++ b/tools/testing/selftests/bpf/test_sockmap.c
@@ -2107,9 +2107,9 @@ int main(int argc, char **argv)
free(options.whitelist);
if (options.blacklist)
free(options.blacklist);
+ close(cg_fd);
if (cg_created)
cleanup_cgroup_environment();
- close(cg_fd);
return err;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH bpf v4 0/2] Two fixes for test_sockmap
2024-04-09 5:18 [PATCH bpf v4 0/2] Two fixes for test_sockmap Geliang Tang
2024-04-09 5:18 ` [PATCH bpf v4 1/2] selftests/bpf: Add F_SETFL for fcntl in test_sockmap Geliang Tang
2024-04-09 5:18 ` [PATCH bpf v4 2/2] selftests/bpf: Fix umount cgroup2 error " Geliang Tang
@ 2024-04-09 6:07 ` MPTCP CI
2024-04-11 18:10 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: MPTCP CI @ 2024-04-09 6:07 UTC (permalink / raw)
To: Geliang Tang; +Cc: mptcp
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/8610829214
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/cc8f1e4c2ba4
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=842664
If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normal
For more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf v4 0/2] Two fixes for test_sockmap
2024-04-09 5:18 [PATCH bpf v4 0/2] Two fixes for test_sockmap Geliang Tang
` (2 preceding siblings ...)
2024-04-09 6:07 ` [PATCH bpf v4 0/2] Two fixes for test_sockmap MPTCP CI
@ 2024-04-11 18:10 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-11 18:10 UTC (permalink / raw)
To: Geliang Tang
Cc: andrii, eddyz87, mykolal, ast, daniel, martin.lau, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah,
jakub, tanggeliang, bpf, mptcp
Hello:
This series was applied to bpf/bpf-next.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:
On Tue, 9 Apr 2024 13:18:38 +0800 you wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> v4:
> - address Martin's comments for v3. (thanks.)
> - add Yonghong's "Acked-by" tags. (thanks.)
> - update subject-prefix from "bpf-next" to "bpf".
>
> [...]
Here is the summary with links:
- [bpf,v4,1/2] selftests/bpf: Add F_SETFL for fcntl in test_sockmap
(no matching commit)
- [bpf,v4,2/2] selftests/bpf: Fix umount cgroup2 error in test_sockmap
https://git.kernel.org/bpf/bpf-next/c/d75142dbeb2b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf v4 1/2] selftests/bpf: Add F_SETFL for fcntl in test_sockmap
2024-04-09 5:18 ` [PATCH bpf v4 1/2] selftests/bpf: Add F_SETFL for fcntl in test_sockmap Geliang Tang
@ 2024-04-11 18:10 ` Martin KaFai Lau
0 siblings, 0 replies; 6+ messages in thread
From: Martin KaFai Lau @ 2024-04-11 18:10 UTC (permalink / raw)
To: Geliang Tang
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Alexei Starovoitov, Daniel Borkmann, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Shuah Khan, Jakub Sitnicki, Geliang Tang, bpf, mptcp
On 4/8/24 10:18 PM, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> Incorrect arguments are passed to fcntl() in test_sockmap.c when invoking
> it to set file status flags. If O_NONBLOCK is used as 2nd argument and
> passed into fcntl, -EINVAL will be returned (See do_fcntl() in fs/fcntl.c).
> The correct approach is to use F_SETFL as 2nd argument, and O_NONBLOCK as
> 3rd one.
>
> In nonblock mode, if EWOULDBLOCK is received, continue receiving, otherwise
> some subtests of test_sockmap fail.
>
> Fixes: 16962b2404ac ("bpf: sockmap, add selftests")
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> Acked-by: Yonghong Song <yonghong.song@linux.dev>
> ---
> tools/testing/selftests/bpf/test_sockmap.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
> index 024a0faafb3b..4feed253fca2 100644
> --- a/tools/testing/selftests/bpf/test_sockmap.c
> +++ b/tools/testing/selftests/bpf/test_sockmap.c
> @@ -603,7 +603,9 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
> struct timeval timeout;
> fd_set w;
>
> - fcntl(fd, fd_flags);
> + if (fcntl(fd, F_SETFL, fd_flags))
> + goto out_errno;
> +
> /* Account for pop bytes noting each iteration of apply will
> * call msg_pop_data helper so we need to account for this
> * by calculating the number of apply iterations. Note user
> @@ -678,6 +680,7 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
> perror("recv failed()");
> goto out_errno;
> }
> + continue;
From looking at it again, there is a select() earlier, so it should not hit
EWOULDBLOCK.
Patch 2 looks good. Only patch 2 is applied. Thanks.
> }
>
> s->bytes_recvd += recv;
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-04-11 18:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-09 5:18 [PATCH bpf v4 0/2] Two fixes for test_sockmap Geliang Tang
2024-04-09 5:18 ` [PATCH bpf v4 1/2] selftests/bpf: Add F_SETFL for fcntl in test_sockmap Geliang Tang
2024-04-11 18:10 ` Martin KaFai Lau
2024-04-09 5:18 ` [PATCH bpf v4 2/2] selftests/bpf: Fix umount cgroup2 error " Geliang Tang
2024-04-09 6:07 ` [PATCH bpf v4 0/2] Two fixes for test_sockmap MPTCP CI
2024-04-11 18:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox