* [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use
@ 2022-11-22 3:49 menglong8.dong
2022-11-22 3:49 ` [PATCH mptcp-next v7 1/4] mptcp: introduce 'sk' to replace 'sock->sk' in mptcp_listen() menglong8.dong
` (5 more replies)
0 siblings, 6 replies; 27+ messages in thread
From: menglong8.dong @ 2022-11-22 3:49 UTC (permalink / raw)
To: mathew.j.martineau, matthieu.baerts; +Cc: mptcp, Menglong Dong
From: Menglong Dong <imagedong@tencent.com>
In the 1th patch, we do some code cleanup with replease 'sock->sk'
with 'sk'. In the 2th patch, we add statistics for mptcp socket in
use. In the 3th patch, we make mptcp_connect can exit when receive
'SIGUSR1' with '-r' flag. And in the 4th patch, we add the testing
for this commit.
With the commit e8695e504942("mptcp: don't orphan ssk in mptcp_close()"),
I belive that the testing of diag.sh can pass now. In fallback and
simultaneous close case, the msk can't release normal (sometimes?) without
that commit, and makes the testing fail. Enn...let's just see that the
CI is saying~
Changes since v6:
- check all processes exit in flush_pids() in the 4th patch
Changes since v5:
- introduce MPTCP_INUSE flag to store if msk is in use, as I find
that it's not correct to check is a msk is in use by
!sk_unhashed(sk) in mptcp_destroy_common(), because the token
can be release in mptcp_check_fastclose()
- add the 3th patch
- reuse __chk_nr in 4th patch
Changes since v4:
- rebase to solve merge conflict
Changes since v3:
- rename MPTCP_DESTROIED to MPTCP_DESTROYED in the 2th patch
Changes since v2:
- add testing
Changes since v1:
- split the code cleanup into the 1th patch.
- decrease the statistics for listening mptcp socket inuse with
mptcp_listen_inuse_dec()
- add MPTCP_DESTROIED flags to store if mptcp_destroy_common() was
called on the msk. For fallback case, we need to decrease the
statistics only once, and mptcp_destroy_common() can be called
more than once.
Menglong Dong (4):
mptcp: introduce 'sk' to replace 'sock->sk' in mptcp_listen()
mptcp: add statistics for mptcp socket in use
selftest: mptcp: exit from copyfd_io_poll() when receive SIGUSR1
selftest: mptcp: add test for mptcp socket in use
net/mptcp/protocol.c | 21 +++++---
net/mptcp/protocol.h | 13 +++++
net/mptcp/subflow.c | 1 +
tools/testing/selftests/net/mptcp/diag.sh | 54 +++++++++++++++++--
.../selftests/net/mptcp/mptcp_connect.c | 4 +-
5 files changed, 79 insertions(+), 14 deletions(-)
--
2.37.2
^ permalink raw reply [flat|nested] 27+ messages in thread* [PATCH mptcp-next v7 1/4] mptcp: introduce 'sk' to replace 'sock->sk' in mptcp_listen()
2022-11-22 3:49 [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use menglong8.dong
@ 2022-11-22 3:49 ` menglong8.dong
2022-11-22 3:49 ` [PATCH mptcp-next v7 2/4] mptcp: add statistics for mptcp socket in use menglong8.dong
` (4 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: menglong8.dong @ 2022-11-22 3:49 UTC (permalink / raw)
To: mathew.j.martineau, matthieu.baerts; +Cc: mptcp, Menglong Dong
From: Menglong Dong <imagedong@tencent.com>
'sock->sk' is used frequently in mptcp_listen(). Therefore, we can
introduce the 'sk' and replace 'sock->sk' with it.
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
net/mptcp/protocol.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index a4fd971a7aa4..f9bcc724d9e2 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3655,12 +3655,13 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,
static int mptcp_listen(struct socket *sock, int backlog)
{
struct mptcp_sock *msk = mptcp_sk(sock->sk);
+ struct sock *sk = sock->sk;
struct socket *ssock;
int err;
pr_debug("msk=%p", msk);
- lock_sock(sock->sk);
+ lock_sock(sk);
ssock = __mptcp_nmpc_socket(msk);
if (!ssock) {
err = -EINVAL;
@@ -3668,16 +3669,16 @@ static int mptcp_listen(struct socket *sock, int backlog)
}
mptcp_token_destroy(msk);
- inet_sk_state_store(sock->sk, TCP_LISTEN);
- sock_set_flag(sock->sk, SOCK_RCU_FREE);
+ inet_sk_state_store(sk, TCP_LISTEN);
+ sock_set_flag(sk, SOCK_RCU_FREE);
err = ssock->ops->listen(ssock, backlog);
- inet_sk_state_store(sock->sk, inet_sk_state_load(ssock->sk));
+ inet_sk_state_store(sk, inet_sk_state_load(ssock->sk));
if (!err)
- mptcp_copy_inaddrs(sock->sk, ssock->sk);
+ mptcp_copy_inaddrs(sk, ssock->sk);
unlock:
- release_sock(sock->sk);
+ release_sock(sk);
return err;
}
--
2.37.2
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH mptcp-next v7 2/4] mptcp: add statistics for mptcp socket in use
2022-11-22 3:49 [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use menglong8.dong
2022-11-22 3:49 ` [PATCH mptcp-next v7 1/4] mptcp: introduce 'sk' to replace 'sock->sk' in mptcp_listen() menglong8.dong
@ 2022-11-22 3:49 ` menglong8.dong
2022-12-02 12:37 ` Paolo Abeni
2022-11-22 3:49 ` [PATCH mptcp-next v7 3/4] selftest: mptcp: exit from copyfd_io_poll() when receive SIGUSR1 menglong8.dong
` (3 subsequent siblings)
5 siblings, 1 reply; 27+ messages in thread
From: menglong8.dong @ 2022-11-22 3:49 UTC (permalink / raw)
To: mathew.j.martineau, matthieu.baerts; +Cc: mptcp, Menglong Dong
From: Menglong Dong <imagedong@tencent.com>
Do the statistics of mptcp socket in use with sock_prot_inuse_add().
Therefore, we can get the count of used mptcp socket from
/proc/net/protocols:
& cat /proc/net/protocols
protocol size sockets memory press maxhdr slab module cl co di ac io in de sh ss gs se re sp bi br ha uh gp em
MPTCPv6 2048 0 0 no 0 yes kernel y n y y y y y y y y y y n n n y y y n
MPTCP 1896 1 0 no 0 yes kernel y n y y y y y y y y y y n n n y y y n
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
v6:
- introduce the 'MPTCP_INUSE' flag and check if msk is in use by it
v5:
- rebase to solve merge conflict
v4:
- rename MPTCP_DESTROIED to MPTCP_DESTROYED
v2:
- decrease the statistics for listening mptcp socket inuse with
mptcp_listen_inuse_dec()
- add MPTCP_DESTROIED flags to store if mptcp_destroy_common() was
called on the msk. For fallback case, we need to decrease the
statistics only once, and mptcp_destroy_common() can be called
more than once.
---
net/mptcp/protocol.c | 8 +++++++-
net/mptcp/protocol.h | 13 +++++++++++++
net/mptcp/subflow.c | 1 +
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index f9bcc724d9e2..9c1152e16005 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3073,6 +3073,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk,
msk->snd_una = msk->write_seq;
msk->wnd_end = msk->snd_nxt + req->rsk_rcv_wnd;
msk->setsockopt_seq = mptcp_sk(sk)->setsockopt_seq;
+ clear_bit(MPTCP_INUSE, &msk->flags);
if (mp_opt->suboptions & OPTIONS_MPTCP_MPC) {
msk->can_ack = true;
@@ -3179,6 +3180,8 @@ void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags)
skb_rbtree_purge(&msk->out_of_order_queue);
mptcp_data_unlock(sk);
+ mptcp_inuse_dec(sk);
+
/* move all the rx fwd alloc into the sk_mem_reclaim_final in
* inet_sock_destruct() will dispose it
*/
@@ -3542,6 +3545,7 @@ static int mptcp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
mptcp_token_destroy(msk);
inet_sk_state_store(sk, TCP_SYN_SENT);
+ mptcp_inuse_inc(sk);
subflow = mptcp_subflow_ctx(ssock->sk);
#ifdef CONFIG_TCP_MD5SIG
/* no MPTCP if MD5SIG is enabled on this socket or we may run out of
@@ -3674,8 +3678,10 @@ static int mptcp_listen(struct socket *sock, int backlog)
err = ssock->ops->listen(ssock, backlog);
inet_sk_state_store(sk, inet_sk_state_load(ssock->sk));
- if (!err)
+ if (!err) {
+ mptcp_inuse_inc(sk);
mptcp_copy_inaddrs(sk, ssock->sk);
+ }
unlock:
release_sock(sk);
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 6a09ab99a12d..441bbd77ae8e 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -116,6 +116,7 @@
#define MPTCP_WORK_EOF 3
#define MPTCP_FALLBACK_DONE 4
#define MPTCP_WORK_CLOSE_SUBFLOW 5
+#define MPTCP_INUSE 6
/* MPTCP socket release cb flags */
#define MPTCP_PUSH_PENDING 1
@@ -382,6 +383,18 @@ static inline struct mptcp_data_frag *mptcp_rtx_head(const struct sock *sk)
return list_first_entry_or_null(&msk->rtx_queue, struct mptcp_data_frag, list);
}
+static inline void mptcp_inuse_inc(const struct sock *sk)
+{
+ if (!test_and_set_bit(MPTCP_INUSE, &mptcp_sk(sk)->flags))
+ sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
+}
+
+static inline void mptcp_inuse_dec(const struct sock *sk)
+{
+ if (test_and_clear_bit(MPTCP_INUSE, &mptcp_sk(sk)->flags))
+ sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
+}
+
struct csum_pseudo_header {
__be64 data_seq;
__be32 subflow_seq;
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 437a283ba6ea..2e3bf29b4006 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -749,6 +749,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
mptcp_sk(new_msk)->setsockopt_seq = ctx->setsockopt_seq;
mptcp_pm_new_connection(mptcp_sk(new_msk), child, 1);
mptcp_token_accept(subflow_req, mptcp_sk(new_msk));
+ mptcp_inuse_inc(new_msk);
ctx->conn = new_msk;
new_msk = NULL;
--
2.37.2
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: [PATCH mptcp-next v7 2/4] mptcp: add statistics for mptcp socket in use
2022-11-22 3:49 ` [PATCH mptcp-next v7 2/4] mptcp: add statistics for mptcp socket in use menglong8.dong
@ 2022-12-02 12:37 ` Paolo Abeni
2022-12-07 13:09 ` Menglong Dong
0 siblings, 1 reply; 27+ messages in thread
From: Paolo Abeni @ 2022-12-02 12:37 UTC (permalink / raw)
To: menglong8.dong, mathew.j.martineau, matthieu.baerts; +Cc: mptcp, Menglong Dong
Hello,
I'm sorry for the long delay with my reply.
On Tue, 2022-11-22 at 11:49 +0800, menglong8.dong@gmail.com wrote:
> @@ -382,6 +383,18 @@ static inline struct mptcp_data_frag *mptcp_rtx_head(const struct sock *sk)
> return list_first_entry_or_null(&msk->rtx_queue, struct mptcp_data_frag, list);
> }
>
> +static inline void mptcp_inuse_inc(const struct sock *sk)
> +{
> + if (!test_and_set_bit(MPTCP_INUSE, &mptcp_sk(sk)->flags))
> + sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
> +}
> +
> +static inline void mptcp_inuse_dec(const struct sock *sk)
> +{
> + if (test_and_clear_bit(MPTCP_INUSE, &mptcp_sk(sk)->flags))
> + sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
> +}
What concern me most with this patch, is the need for an additional
msk flag and the related atomic operations.
If tracking non fallback sockets is good enough for you - that would
probably make sense - you could place the sock_prot_inuse_add() in the
successful path of mptcp_token_new_connect(), mptcp_token_accept() and
mptcp_token_destroy() - the in use decrement.
As the token is unique, it's creation/destruction correspond to the
creation/destruction of a non fallback mptcp socket. Additionally that
somewhat correspond to TCP hash/unhash operation, so it will match more
closely the existing accounting in TCP code.
WDYT?
Thanks!
Paolo
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH mptcp-next v7 2/4] mptcp: add statistics for mptcp socket in use
2022-12-02 12:37 ` Paolo Abeni
@ 2022-12-07 13:09 ` Menglong Dong
0 siblings, 0 replies; 27+ messages in thread
From: Menglong Dong @ 2022-12-07 13:09 UTC (permalink / raw)
To: Paolo Abeni; +Cc: mathew.j.martineau, matthieu.baerts, mptcp, Menglong Dong
Hello,
On Fri, Dec 2, 2022 at 8:37 PM Paolo Abeni <pabeni@redhat.com> wrote:
>
> Hello,
>
> I'm sorry for the long delay with my reply.
>
> On Tue, 2022-11-22 at 11:49 +0800, menglong8.dong@gmail.com wrote:
> > @@ -382,6 +383,18 @@ static inline struct mptcp_data_frag *mptcp_rtx_head(const struct sock *sk)
> > return list_first_entry_or_null(&msk->rtx_queue, struct mptcp_data_frag, list);
> > }
> >
> > +static inline void mptcp_inuse_inc(const struct sock *sk)
> > +{
> > + if (!test_and_set_bit(MPTCP_INUSE, &mptcp_sk(sk)->flags))
> > + sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
> > +}
> > +
> > +static inline void mptcp_inuse_dec(const struct sock *sk)
> > +{
> > + if (test_and_clear_bit(MPTCP_INUSE, &mptcp_sk(sk)->flags))
> > + sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
> > +}
>
> What concern me most with this patch, is the need for an additional
> msk flag and the related atomic operations.
>
> If tracking non fallback sockets is good enough for you - that would
> probably make sense - you could place the sock_prot_inuse_add() in the
> successful path of mptcp_token_new_connect(), mptcp_token_accept() and
> mptcp_token_destroy() - the in use decrement.
>
> As the token is unique, it's creation/destruction correspond to the
> creation/destruction of a non fallback mptcp socket. Additionally that
> somewhat correspond to TCP hash/unhash operation, so it will match more
> closely the existing accounting in TCP code.
>
I think it's a perfect idea. I considered to use mptcp_token_new_connect,
mptcp_token_accept and mptcp_token_destroy before, but I found it's hard to
trace the fallback case, as I thought the fallback in the active connection case
is not hashed. However, the token of the 'msk' in that case is not destroyed.
Therefore, we can now do the statistics according to the token create
and destroy for connection case, as all 'msk' has the token except the
listening msk.
For listening msk, we use the method we used before.
BTW, is it ok to keep the fallback msk in the hash table? Which I think
may have a little impact on the performance.
Thanks!
Menglong Dong
> WDYT?
>
> Thanks!
>
> Paolo
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH mptcp-next v7 3/4] selftest: mptcp: exit from copyfd_io_poll() when receive SIGUSR1
2022-11-22 3:49 [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use menglong8.dong
2022-11-22 3:49 ` [PATCH mptcp-next v7 1/4] mptcp: introduce 'sk' to replace 'sock->sk' in mptcp_listen() menglong8.dong
2022-11-22 3:49 ` [PATCH mptcp-next v7 2/4] mptcp: add statistics for mptcp socket in use menglong8.dong
@ 2022-11-22 3:49 ` menglong8.dong
2022-11-22 3:49 ` [PATCH mptcp-next v7 4/4] selftest: mptcp: add test for mptcp socket in use menglong8.dong
` (2 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: menglong8.dong @ 2022-11-22 3:49 UTC (permalink / raw)
To: mathew.j.martineau, matthieu.baerts; +Cc: mptcp, Menglong Dong
From: Menglong Dong <imagedong@tencent.com>
For now, mptcp_connect won't exit after receiving the 'SIGUSR1' signal
if '-r' is set. Fix this by skipping poll and sleep in copyfd_io_poll()
if 'quit' is set.
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
tools/testing/selftests/net/mptcp/mptcp_connect.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
index e54653ea2ed4..518c6d653c0e 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
@@ -586,7 +586,7 @@ static int copyfd_io_poll(int infd, int peerfd, int outfd, bool *in_closed_after
char rbuf[8192];
ssize_t len;
- if (fds.events == 0)
+ if (fds.events == 0 || quit)
break;
switch (poll(&fds, 1, poll_timeout)) {
@@ -692,7 +692,7 @@ static int copyfd_io_poll(int infd, int peerfd, int outfd, bool *in_closed_after
}
/* leave some time for late join/announce */
- if (cfg_remove)
+ if (cfg_remove && !quit)
usleep(cfg_wait);
return 0;
--
2.37.2
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH mptcp-next v7 4/4] selftest: mptcp: add test for mptcp socket in use
2022-11-22 3:49 [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use menglong8.dong
` (2 preceding siblings ...)
2022-11-22 3:49 ` [PATCH mptcp-next v7 3/4] selftest: mptcp: exit from copyfd_io_poll() when receive SIGUSR1 menglong8.dong
@ 2022-11-22 3:49 ` menglong8.dong
2022-11-23 17:27 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
` (2 more replies)
2022-11-23 15:58 ` [PATCH mptcp-next v7 0/4] mptcp: add statistics " Matthieu Baerts
2022-11-28 16:05 ` Matthieu Baerts
5 siblings, 3 replies; 27+ messages in thread
From: menglong8.dong @ 2022-11-22 3:49 UTC (permalink / raw)
To: mathew.j.martineau, matthieu.baerts; +Cc: mptcp, Menglong Dong
From: Menglong Dong <imagedong@tencent.com>
Add the function chk_msk_inuse() to diag.sh, which is used to check the
statistics of mptcp socket in use. As mptcp socket in listen state will
be closed randomly after 'accept', we need to get the count of listening
mptcp socket through 'ss' command.
All tests pass.
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
v7:
- check all processes exit in flush_pids()
---
tools/testing/selftests/net/mptcp/diag.sh | 54 ++++++++++++++++++++---
1 file changed, 49 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh
index 515859a5168b..4dd5dc1130ca 100755
--- a/tools/testing/selftests/net/mptcp/diag.sh
+++ b/tools/testing/selftests/net/mptcp/diag.sh
@@ -16,6 +16,11 @@ flush_pids()
sleep 1.1
ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGUSR1 &>/dev/null
+
+ for _ in $(seq 10); do
+ [ -z "$(ip netns pids "${ns}")" ] && break
+ sleep 0.1
+ done
}
cleanup()
@@ -36,15 +41,20 @@ if [ $? -ne 0 ];then
exit $ksft_skip
fi
+get_msk_inuse()
+{
+ ip netns exec $ns cat /proc/net/protocols | awk '$1~/^MPTCP$/{print $3}'
+}
+
__chk_nr()
{
- local condition="$1"
+ local command="$1"
local expected=$2
local msg nr
shift 2
msg=$*
- nr=$(ss -inmHMN $ns | $condition)
+ nr=$(eval $command)
printf "%-50s" "$msg"
if [ $nr != $expected ]; then
@@ -56,9 +66,17 @@ __chk_nr()
test_cnt=$((test_cnt+1))
}
+__chk_msk_nr()
+{
+ local condition=$1
+ shift 1
+
+ __chk_nr "ss -inmHMN $ns | $condition" $*
+}
+
chk_msk_nr()
{
- __chk_nr "grep -c token:" $*
+ __chk_msk_nr "grep -c token:" $*
}
wait_msk_nr()
@@ -96,12 +114,12 @@ wait_msk_nr()
chk_msk_fallback_nr()
{
- __chk_nr "grep -c fallback" $*
+ __chk_msk_nr "grep -c fallback" $*
}
chk_msk_remote_key_nr()
{
- __chk_nr "grep -c remote_key" $*
+ __chk_msk_nr "grep -c remote_key" $*
}
__chk_listen()
@@ -141,6 +159,25 @@ chk_msk_listen()
nr=$(ss -Ml $filter | wc -l)
}
+chk_msk_inuse()
+{
+ local expected=$1
+ local listen_nr
+
+ listen_nr=$(ss -N $ns -Ml | grep -c LISTEN)
+ expected=$(($expected+$listen_nr))
+ shift 1
+
+ for i in $(seq 10); do
+ if [ $(get_msk_inuse) -eq $expected ];then
+ break
+ fi
+ sleep 0.1
+ done
+
+ __chk_nr get_msk_inuse $expected $*
+}
+
# $1: ns, $2: port
wait_local_port_listen()
{
@@ -194,8 +231,10 @@ wait_connected $ns 10000
chk_msk_nr 2 "after MPC handshake "
chk_msk_remote_key_nr 2 "....chk remote_key"
chk_msk_fallback_nr 0 "....chk no fallback"
+chk_msk_inuse 2 "....chk 2 msk in use"
flush_pids
+chk_msk_inuse 0 "....chk 0 msk in use after flush"
echo "a" | \
timeout ${timeout_test} \
@@ -212,6 +251,8 @@ wait_connected $ns 10001
chk_msk_fallback_nr 1 "check fallback"
flush_pids
+chk_msk_inuse 0 "....chk 0 msk in use after flush"
+
NR_CLIENTS=100
for I in `seq 1 $NR_CLIENTS`; do
echo "a" | \
@@ -231,6 +272,9 @@ for I in `seq 1 $NR_CLIENTS`; do
done
wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
+chk_msk_inuse $((NR_CLIENTS*2)) "....chk many msk in use"
flush_pids
+chk_msk_inuse 0 "....chk 0 msk in use after flush"
+
exit $ret
--
2.37.2
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: selftest: mptcp: add test for mptcp socket in use: Tests Results
2022-11-22 3:49 ` [PATCH mptcp-next v7 4/4] selftest: mptcp: add test for mptcp socket in use menglong8.dong
@ 2022-11-23 17:27 ` MPTCP CI
2022-11-23 19:14 ` MPTCP CI
2022-11-28 16:05 ` [PATCH mptcp-next v7 4/4] selftest: mptcp: add test for mptcp socket in use Matthieu Baerts
2 siblings, 0 replies; 27+ messages in thread
From: MPTCP CI @ 2022-11-23 17:27 UTC (permalink / raw)
To: Menglong Dong; +Cc: mptcp
Hi Menglong,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal:
- Success! ✅:
- Task: https://cirrus-ci.com/task/6201775137488896
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6201775137488896/summary/summary.txt
- KVM Validation: debug:
- Success! ✅:
- Task: https://cirrus-ci.com/task/4794400253935616
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4794400253935616/summary/summary.txt
Initiator: Matthieu Baerts
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/afd026792ca1
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-debug
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 (Tessares)
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: selftest: mptcp: add test for mptcp socket in use: Tests Results
2022-11-22 3:49 ` [PATCH mptcp-next v7 4/4] selftest: mptcp: add test for mptcp socket in use menglong8.dong
2022-11-23 17:27 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
@ 2022-11-23 19:14 ` MPTCP CI
2022-11-28 16:05 ` [PATCH mptcp-next v7 4/4] selftest: mptcp: add test for mptcp socket in use Matthieu Baerts
2 siblings, 0 replies; 27+ messages in thread
From: MPTCP CI @ 2022-11-23 19:14 UTC (permalink / raw)
To: Menglong Dong; +Cc: mptcp
Hi Menglong,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal:
- Unstable: 1 failed test(s): selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/6563194622181376
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6563194622181376/summary/summary.txt
- KVM Validation: debug:
- Success! ✅:
- Task: https://cirrus-ci.com/task/4733607273562112
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4733607273562112/summary/summary.txt
Initiator: Matthieu Baerts
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/5afcc5ab13e3
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-debug
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 (Tessares)
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH mptcp-next v7 4/4] selftest: mptcp: add test for mptcp socket in use
2022-11-22 3:49 ` [PATCH mptcp-next v7 4/4] selftest: mptcp: add test for mptcp socket in use menglong8.dong
2022-11-23 17:27 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
2022-11-23 19:14 ` MPTCP CI
@ 2022-11-28 16:05 ` Matthieu Baerts
2 siblings, 0 replies; 27+ messages in thread
From: Matthieu Baerts @ 2022-11-28 16:05 UTC (permalink / raw)
To: menglong8.dong, mathew.j.martineau; +Cc: mptcp, Menglong Dong
Hi Menglong Dong,
On 22/11/2022 04:49, menglong8.dong@gmail.com wrote:
> From: Menglong Dong <imagedong@tencent.com>
>
> Add the function chk_msk_inuse() to diag.sh, which is used to check the
> statistics of mptcp socket in use. As mptcp socket in listen state will
> be closed randomly after 'accept', we need to get the count of listening
> mptcp socket through 'ss' command.
>
> All tests pass.
>
> Signed-off-by: Menglong Dong <imagedong@tencent.com>
> ---
> v7:
> - check all processes exit in flush_pids()
> ---
> tools/testing/selftests/net/mptcp/diag.sh | 54 ++++++++++++++++++++---
> 1 file changed, 49 insertions(+), 5 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh
> index 515859a5168b..4dd5dc1130ca 100755
> --- a/tools/testing/selftests/net/mptcp/diag.sh
> +++ b/tools/testing/selftests/net/mptcp/diag.sh
(...)
> @@ -141,6 +159,25 @@ chk_msk_listen()
> nr=$(ss -Ml $filter | wc -l)
> }
>
> +chk_msk_inuse()
> +{
> + local expected=$1
> + local listen_nr
> +
> + listen_nr=$(ss -N $ns -Ml | grep -c LISTEN)
Small detail: it is often recommended to always add {} around variable
names (e.g. ${ns}) and double quotes (e.g. "${ns}"), mainly to avoid
some unexpected behaviours and clearly spot variables.
> + expected=$(($expected+$listen_nr))
Small detail: shellcheck will tell you it is clearer to drop '$' inside
the arithmetic operation, e.g.
expected=$((expected + listen_nr))
> + shift 1
Small detail: probably clearer to move this just after the first block
where you assign parameters given to this function.
> +
> + for i in $(seq 10); do
Small detail: 'i' is declared as local. You can also use '_' if you
don't care about the value of $i
> + if [ $(get_msk_inuse) -eq $expected ];then
> + break
> + fi
> + sleep 0.1
> + done
> +
> + __chk_nr get_msk_inuse $expected $*
> +}
> +
> # $1: ns, $2: port
> wait_local_port_listen()
> {
If you don't need to modify anything else in these commits after Paolo's
review, I can do the modifications myself when applying the different
patches (if I don't forget :) )
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use
2022-11-22 3:49 [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use menglong8.dong
` (3 preceding siblings ...)
2022-11-22 3:49 ` [PATCH mptcp-next v7 4/4] selftest: mptcp: add test for mptcp socket in use menglong8.dong
@ 2022-11-23 15:58 ` Matthieu Baerts
2022-11-24 9:06 ` Menglong Dong
2022-11-28 16:05 ` Matthieu Baerts
5 siblings, 1 reply; 27+ messages in thread
From: Matthieu Baerts @ 2022-11-23 15:58 UTC (permalink / raw)
To: menglong8.dong, mathew.j.martineau; +Cc: mptcp, Menglong Dong
Hi Menglong,
On 22/11/2022 04:49, menglong8.dong@gmail.com wrote:
> From: Menglong Dong <imagedong@tencent.com>
>
> In the 1th patch, we do some code cleanup with replease 'sock->sk'
> with 'sk'. In the 2th patch, we add statistics for mptcp socket in
> use. In the 3th patch, we make mptcp_connect can exit when receive
> 'SIGUSR1' with '-r' flag. And in the 4th patch, we add the testing
> for this commit.
>
> With the commit e8695e504942("mptcp: don't orphan ssk in mptcp_close()"),
> I belive that the testing of diag.sh can pass now. In fallback and
> simultaneous close case, the msk can't release normal (sometimes?) without
> that commit, and makes the testing fail. Enn...let's just see that the
> CI is saying~
Thank you for this new version!
I was waiting the feedback from the CI to start my review but it looks
like the CI was not able to apply your series [1].
I just applied the series manually, fixed the two conflicts I got and
sent it to our repo[2]. We should get the results later on.
Cheers,
Matt
[1]
https://patchew.org/MPTCP/20221122034923.804955-1-imagedong@tencent.com/logs/git/
[2]
https://github.com/multipath-tcp/mptcp_net-next/tree/patchew/20221122034923.804955-1-imagedong@tencent.com
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use
2022-11-23 15:58 ` [PATCH mptcp-next v7 0/4] mptcp: add statistics " Matthieu Baerts
@ 2022-11-24 9:06 ` Menglong Dong
2022-11-24 9:29 ` Matthieu Baerts
0 siblings, 1 reply; 27+ messages in thread
From: Menglong Dong @ 2022-11-24 9:06 UTC (permalink / raw)
To: Matthieu Baerts; +Cc: mathew.j.martineau, mptcp, Menglong Dong
Hello,
On Wed, Nov 23, 2022 at 11:58 PM Matthieu Baerts
<matthieu.baerts@tessares.net> wrote:
>
> Hi Menglong,
>
> On 22/11/2022 04:49, menglong8.dong@gmail.com wrote:
> > From: Menglong Dong <imagedong@tencent.com>
> >
> > In the 1th patch, we do some code cleanup with replease 'sock->sk'
> > with 'sk'. In the 2th patch, we add statistics for mptcp socket in
> > use. In the 3th patch, we make mptcp_connect can exit when receive
> > 'SIGUSR1' with '-r' flag. And in the 4th patch, we add the testing
> > for this commit.
> >
> > With the commit e8695e504942("mptcp: don't orphan ssk in mptcp_close()"),
> > I belive that the testing of diag.sh can pass now. In fallback and
> > simultaneous close case, the msk can't release normal (sometimes?) without
> > that commit, and makes the testing fail. Enn...let's just see that the
> > CI is saying~
>
> Thank you for this new version!
> I was waiting the feedback from the CI to start my review but it looks
> like the CI was not able to apply your series [1].
>
> I just applied the series manually, fixed the two conflicts I got and
> sent it to our repo[2]. We should get the results later on.
>
Thank you for what you do :/
Enn....seems net-next is not a good branch for mptcp works,
I'll rebase to mptcp_net-next branch next time.
I notice that the CI contains some failures, which I am not sure
if it is caused by my commit. Could you please have a look?
Here is the summary:
https://api.cirrus-ci.com/v1/artifact/task/6563194622181376/summary/summary.txt
Thanks!
Menglong Dong
> Cheers,
> Matt
>
> [1]
> https://patchew.org/MPTCP/20221122034923.804955-1-imagedong@tencent.com/logs/git/
> [2]
> https://github.com/multipath-tcp/mptcp_net-next/tree/patchew/20221122034923.804955-1-imagedong@tencent.com
> --
> Tessares | Belgium | Hybrid Access Solutions
> www.tessares.net
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use
2022-11-24 9:06 ` Menglong Dong
@ 2022-11-24 9:29 ` Matthieu Baerts
0 siblings, 0 replies; 27+ messages in thread
From: Matthieu Baerts @ 2022-11-24 9:29 UTC (permalink / raw)
To: Menglong Dong; +Cc: mathew.j.martineau, mptcp, Menglong Dong
Hi Menglong Dong,
On 24/11/2022 10:06, Menglong Dong wrote:
> Hello,
>
> On Wed, Nov 23, 2022 at 11:58 PM Matthieu Baerts
> <matthieu.baerts@tessares.net> wrote:
>>
>> Hi Menglong,
>>
>> On 22/11/2022 04:49, menglong8.dong@gmail.com wrote:
>>> From: Menglong Dong <imagedong@tencent.com>
>>>
>>> In the 1th patch, we do some code cleanup with replease 'sock->sk'
>>> with 'sk'. In the 2th patch, we add statistics for mptcp socket in
>>> use. In the 3th patch, we make mptcp_connect can exit when receive
>>> 'SIGUSR1' with '-r' flag. And in the 4th patch, we add the testing
>>> for this commit.
>>>
>>> With the commit e8695e504942("mptcp: don't orphan ssk in mptcp_close()"),
>>> I belive that the testing of diag.sh can pass now. In fallback and
>>> simultaneous close case, the msk can't release normal (sometimes?) without
>>> that commit, and makes the testing fail. Enn...let's just see that the
>>> CI is saying~
>>
>> Thank you for this new version!
>> I was waiting the feedback from the CI to start my review but it looks
>> like the CI was not able to apply your series [1].
>>
>> I just applied the series manually, fixed the two conflicts I got and
>> sent it to our repo[2]. We should get the results later on.
>>
>
> Thank you for what you do :/
> Enn....seems net-next is not a good branch for mptcp works,
> I'll rebase to mptcp_net-next branch next time.
Yes please. Either 'export' (or export-net) or 'for-review' (or
for-review-net), see:
https://github.com/multipath-tcp/mptcp_net-next/wiki/Git-Branches#which-branch-to-use
> I notice that the CI contains some failures, which I am not sure
> if it is caused by my commit.
Indeed, it doesn't seem to be linked to your modification.
I will try to do a bit more tests on my side just to avoid instabilities
but the last modification you did should help stabilising things.
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use
2022-11-22 3:49 [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use menglong8.dong
` (4 preceding siblings ...)
2022-11-23 15:58 ` [PATCH mptcp-next v7 0/4] mptcp: add statistics " Matthieu Baerts
@ 2022-11-28 16:05 ` Matthieu Baerts
2022-11-30 2:11 ` Menglong Dong
5 siblings, 1 reply; 27+ messages in thread
From: Matthieu Baerts @ 2022-11-28 16:05 UTC (permalink / raw)
To: menglong8.dong, Menglong Dong; +Cc: mptcp, mathew.j.martineau, Paolo Abeni
Hi Menglong Dong,
On 22/11/2022 04:49, menglong8.dong@gmail.com wrote:
> From: Menglong Dong <imagedong@tencent.com>
>
> In the 1th patch, we do some code cleanup with replease 'sock->sk'
> with 'sk'. In the 2th patch, we add statistics for mptcp socket in
> use. In the 3th patch, we make mptcp_connect can exit when receive
> 'SIGUSR1' with '-r' flag. And in the 4th patch, we add the testing
> for this commit.
>
> With the commit e8695e504942("mptcp: don't orphan ssk in mptcp_close()"),
> I belive that the testing of diag.sh can pass now. In fallback and
> simultaneous close case, the msk can't release normal (sometimes?) without
> that commit, and makes the testing fail. Enn...let's just see that the
> CI is saying~
>
>
> Changes since v6:
> - check all processes exit in flush_pids() in the 4th patch
Thank you for the new version!
We discussed about this series at the last weekly meeting we had and
globally, it looks good.
However, Paolo mentioned that it is a bit of a shame we need to increase
the complexity of the code for the stats. I agree with you but during
the meeting, we didn't find obvious better ways to avoid having to add a
new flag. I will let a bit more time for Paolo just in case he has
another brilliant idea :)
Other than that, I have some small suggestions for the patch 4/4 but I
can do the modifications when applying the patches later if no other
modifications are needed.
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use
2022-11-28 16:05 ` Matthieu Baerts
@ 2022-11-30 2:11 ` Menglong Dong
2022-11-30 9:44 ` Matthieu Baerts
0 siblings, 1 reply; 27+ messages in thread
From: Menglong Dong @ 2022-11-30 2:11 UTC (permalink / raw)
To: Matthieu Baerts; +Cc: Menglong Dong, mptcp, mathew.j.martineau, Paolo Abeni
Hello,
On Tue, Nov 29, 2022 at 12:05 AM Matthieu Baerts
<matthieu.baerts@tessares.net> wrote:
>
> Hi Menglong Dong,
>
> On 22/11/2022 04:49, menglong8.dong@gmail.com wrote:
> > From: Menglong Dong <imagedong@tencent.com>
> >
> > In the 1th patch, we do some code cleanup with replease 'sock->sk'
> > with 'sk'. In the 2th patch, we add statistics for mptcp socket in
> > use. In the 3th patch, we make mptcp_connect can exit when receive
> > 'SIGUSR1' with '-r' flag. And in the 4th patch, we add the testing
> > for this commit.
> >
> > With the commit e8695e504942("mptcp: don't orphan ssk in mptcp_close()"),
> > I belive that the testing of diag.sh can pass now. In fallback and
> > simultaneous close case, the msk can't release normal (sometimes?) without
> > that commit, and makes the testing fail. Enn...let's just see that the
> > CI is saying~
> >
> >
> > Changes since v6:
> > - check all processes exit in flush_pids() in the 4th patch
>
> Thank you for the new version!
>
> We discussed about this series at the last weekly meeting we had and
> globally, it looks good.
>
> However, Paolo mentioned that it is a bit of a shame we need to increase
> the complexity of the code for the stats. I agree with you but during
> the meeting, we didn't find obvious better ways to avoid having to add a
> new flag. I will let a bit more time for Paolo just in case he has
> another brilliant idea :)
>
Thanks for your discussion on this topic! It is indeed not a good
idea to add a new flag for such a case. Looking forward to having
a better solution from Paolo.
(BTW, it's all right to reject this series if it's not good enough :/ )
> Other than that, I have some small suggestions for the patch 4/4 but I
> can do the modifications when applying the patches later if no other
> modifications are needed.
>
Yeah, thanks! I can send a v8 too if you prefer :/
Thanks!
Menglong Dong
> Cheers,
> Matt
> --
> Tessares | Belgium | Hybrid Access Solutions
> www.tessares.net
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use
2022-11-30 2:11 ` Menglong Dong
@ 2022-11-30 9:44 ` Matthieu Baerts
0 siblings, 0 replies; 27+ messages in thread
From: Matthieu Baerts @ 2022-11-30 9:44 UTC (permalink / raw)
To: Menglong Dong; +Cc: Menglong Dong, mptcp, mathew.j.martineau, Paolo Abeni
Hi,
On 30/11/2022 03:11, Menglong Dong wrote:
> Hello,
>
> On Tue, Nov 29, 2022 at 12:05 AM Matthieu Baerts
> <matthieu.baerts@tessares.net> wrote:
>>
>> Hi Menglong Dong,
>>
>> On 22/11/2022 04:49, menglong8.dong@gmail.com wrote:
>>> From: Menglong Dong <imagedong@tencent.com>
>>>
>>> In the 1th patch, we do some code cleanup with replease 'sock->sk'
>>> with 'sk'. In the 2th patch, we add statistics for mptcp socket in
>>> use. In the 3th patch, we make mptcp_connect can exit when receive
>>> 'SIGUSR1' with '-r' flag. And in the 4th patch, we add the testing
>>> for this commit.
>>>
>>> With the commit e8695e504942("mptcp: don't orphan ssk in mptcp_close()"),
>>> I belive that the testing of diag.sh can pass now. In fallback and
>>> simultaneous close case, the msk can't release normal (sometimes?) without
>>> that commit, and makes the testing fail. Enn...let's just see that the
>>> CI is saying~
>>>
>>>
>>> Changes since v6:
>>> - check all processes exit in flush_pids() in the 4th patch
>>
>> Thank you for the new version!
>>
>> We discussed about this series at the last weekly meeting we had and
>> globally, it looks good.
>>
>> However, Paolo mentioned that it is a bit of a shame we need to increase
>> the complexity of the code for the stats. I agree with you but during
>> the meeting, we didn't find obvious better ways to avoid having to add a
>> new flag. I will let a bit more time for Paolo just in case he has
>> another brilliant idea :)
>>
>
> Thanks for your discussion on this topic! It is indeed not a good
> idea to add a new flag for such a case. Looking forward to having
> a better solution from Paolo.
>
> (BTW, it's all right to reject this series if it's not good enough :/ )
These stats can be very useful to monitor and debug stuffs around MPTCP!
But yes, if there is a "cleaner" way to do so, that would be better.
Let's not rush things and think a bit more about how this could be done.
>> Other than that, I have some small suggestions for the patch 4/4 but I
>> can do the modifications when applying the patches later if no other
>> modifications are needed.
>>
>
> Yeah, thanks! I can send a v8 too if you prefer :/
Thank you but for the moment, that's fine. We will probably talk about
this series at the meeting tomorrow.
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH mptcp-next v10 6/6] selftest: mptcp: add test for mptcp socket in use
@ 2022-12-19 10:23 menglong8.dong
2022-12-19 12:01 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
2022-12-19 13:50 ` MPTCP CI
0 siblings, 2 replies; 27+ messages in thread
From: menglong8.dong @ 2022-12-19 10:23 UTC (permalink / raw)
To: pabeni, mathew.j.martineau, matthieu.baerts; +Cc: mptcp, Menglong Dong
From: Menglong Dong <imagedong@tencent.com>
Add the function chk_msk_inuse() to diag.sh, which is used to check the
statistics of mptcp socket in use. As mptcp socket in listen state will
be closed randomly after 'accept', we need to get the count of listening
mptcp socket through 'ss' command.
All tests pass.
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
v7:
- check all processes exit in flush_pids()
---
tools/testing/selftests/net/mptcp/diag.sh | 56 +++++++++++++++++++++--
1 file changed, 51 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh
index 24bcd7b9bdb2..ef628b16fe9b 100755
--- a/tools/testing/selftests/net/mptcp/diag.sh
+++ b/tools/testing/selftests/net/mptcp/diag.sh
@@ -17,6 +17,11 @@ flush_pids()
sleep 1.1
ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGUSR1 &>/dev/null
+
+ for _ in $(seq 10); do
+ [ -z "$(ip netns pids "${ns}")" ] && break
+ sleep 0.1
+ done
}
cleanup()
@@ -37,15 +42,20 @@ if [ $? -ne 0 ];then
exit $ksft_skip
fi
+get_msk_inuse()
+{
+ ip netns exec $ns cat /proc/net/protocols | awk '$1~/^MPTCP$/{print $3}'
+}
+
__chk_nr()
{
- local condition="$1"
+ local command="$1"
local expected=$2
local msg nr
shift 2
msg=$*
- nr=$(ss -inmHMN $ns | $condition)
+ nr=$(eval $command)
printf "%-50s" "$msg"
if [ $nr != $expected ]; then
@@ -57,9 +67,17 @@ __chk_nr()
test_cnt=$((test_cnt+1))
}
+__chk_msk_nr()
+{
+ local condition=$1
+ shift 1
+
+ __chk_nr "ss -inmHMN $ns | $condition" $*
+}
+
chk_msk_nr()
{
- __chk_nr "grep -c token:" $*
+ __chk_msk_nr "grep -c token:" $*
}
wait_msk_nr()
@@ -97,12 +115,12 @@ wait_msk_nr()
chk_msk_fallback_nr()
{
- __chk_nr "grep -c fallback" $*
+ __chk_msk_nr "grep -c fallback" $*
}
chk_msk_remote_key_nr()
{
- __chk_nr "grep -c remote_key" $*
+ __chk_msk_nr "grep -c remote_key" $*
}
__chk_listen()
@@ -142,6 +160,26 @@ chk_msk_listen()
nr=$(ss -Ml $filter | wc -l)
}
+chk_msk_inuse()
+{
+ local expected=$1
+ local listen_nr
+
+ shift 1
+
+ listen_nr=$(ss -N "${ns}" -Ml | grep -c LISTEN)
+ expected=$((expected + listen_nr))
+
+ for _ in $(seq 10); do
+ if [ $(get_msk_inuse) -eq $expected ];then
+ break
+ fi
+ sleep 0.1
+ done
+
+ __chk_nr get_msk_inuse $expected $*
+}
+
# $1: ns, $2: port
wait_local_port_listen()
{
@@ -195,8 +233,10 @@ wait_connected $ns 10000
chk_msk_nr 2 "after MPC handshake "
chk_msk_remote_key_nr 2 "....chk remote_key"
chk_msk_fallback_nr 0 "....chk no fallback"
+chk_msk_inuse 2 "....chk 2 msk in use"
flush_pids
+chk_msk_inuse 0 "....chk 0 msk in use after flush"
echo "a" | \
timeout ${timeout_test} \
@@ -211,8 +251,11 @@ echo "b" | \
127.0.0.1 >/dev/null &
wait_connected $ns 10001
chk_msk_fallback_nr 1 "check fallback"
+chk_msk_inuse 1 "....chk 1 msk in use"
flush_pids
+chk_msk_inuse 0 "....chk 0 msk in use after flush"
+
NR_CLIENTS=100
for I in `seq 1 $NR_CLIENTS`; do
echo "a" | \
@@ -232,6 +275,9 @@ for I in `seq 1 $NR_CLIENTS`; do
done
wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
+chk_msk_inuse $((NR_CLIENTS*2)) "....chk many msk in use"
flush_pids
+chk_msk_inuse 0 "....chk 0 msk in use after flush"
+
exit $ret
--
2.37.2
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: selftest: mptcp: add test for mptcp socket in use: Tests Results
2022-12-19 10:23 [PATCH mptcp-next v10 6/6] selftest: mptcp: add test " menglong8.dong
@ 2022-12-19 12:01 ` MPTCP CI
2022-12-19 13:50 ` MPTCP CI
1 sibling, 0 replies; 27+ messages in thread
From: MPTCP CI @ 2022-12-19 12:01 UTC (permalink / raw)
To: Menglong Dong; +Cc: mptcp
Hi Menglong,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5688095572492288
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5688095572492288/summary/summary.txt
- KVM Validation: normal (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5125145619070976
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5125145619070976/summary/summary.txt
- KVM Validation: debug (only selftest_mptcp_join):
- Unstable: 1 failed test(s): selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/5447656726593536
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5447656726593536/summary/summary.txt
- KVM Validation: debug (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/6251045525913600
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6251045525913600/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/c88d4cb39174
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-debug
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 (Tessares)
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: selftest: mptcp: add test for mptcp socket in use: Tests Results
2022-12-19 10:23 [PATCH mptcp-next v10 6/6] selftest: mptcp: add test " menglong8.dong
2022-12-19 12:01 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
@ 2022-12-19 13:50 ` MPTCP CI
1 sibling, 0 replies; 27+ messages in thread
From: MPTCP CI @ 2022-12-19 13:50 UTC (permalink / raw)
To: Menglong Dong; +Cc: mptcp
Hi Menglong,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join):
- Unstable: 1 failed test(s): selftest_simult_flows 🔴:
- Task: https://cirrus-ci.com/task/5235989799501824
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5235989799501824/summary/summary.txt
- KVM Validation: debug (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/4954514822791168
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4954514822791168/summary/summary.txt
- KVM Validation: normal (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/6361889706344448
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6361889706344448/summary/summary.txt
- KVM Validation: debug (only selftest_mptcp_join):
- Unstable: 1 failed test(s): selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/6080414729633792
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6080414729633792/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/7683ddc9684a
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-debug
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 (Tessares)
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH mptcp-next v9 6/6] selftest: mptcp: add test for mptcp socket in use
@ 2022-12-19 7:50 menglong8.dong
2022-12-19 8:57 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
0 siblings, 1 reply; 27+ messages in thread
From: menglong8.dong @ 2022-12-19 7:50 UTC (permalink / raw)
To: pabeni, mathew.j.martineau, matthieu.baerts; +Cc: mptcp, Menglong Dong
From: Menglong Dong <imagedong@tencent.com>
Add the function chk_msk_inuse() to diag.sh, which is used to check the
statistics of mptcp socket in use. As mptcp socket in listen state will
be closed randomly after 'accept', we need to get the count of listening
mptcp socket through 'ss' command.
All tests pass.
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
v7:
- check all processes exit in flush_pids()
---
tools/testing/selftests/net/mptcp/diag.sh | 56 +++++++++++++++++++++--
1 file changed, 51 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh
index 24bcd7b9bdb2..ef628b16fe9b 100755
--- a/tools/testing/selftests/net/mptcp/diag.sh
+++ b/tools/testing/selftests/net/mptcp/diag.sh
@@ -17,6 +17,11 @@ flush_pids()
sleep 1.1
ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGUSR1 &>/dev/null
+
+ for _ in $(seq 10); do
+ [ -z "$(ip netns pids "${ns}")" ] && break
+ sleep 0.1
+ done
}
cleanup()
@@ -37,15 +42,20 @@ if [ $? -ne 0 ];then
exit $ksft_skip
fi
+get_msk_inuse()
+{
+ ip netns exec $ns cat /proc/net/protocols | awk '$1~/^MPTCP$/{print $3}'
+}
+
__chk_nr()
{
- local condition="$1"
+ local command="$1"
local expected=$2
local msg nr
shift 2
msg=$*
- nr=$(ss -inmHMN $ns | $condition)
+ nr=$(eval $command)
printf "%-50s" "$msg"
if [ $nr != $expected ]; then
@@ -57,9 +67,17 @@ __chk_nr()
test_cnt=$((test_cnt+1))
}
+__chk_msk_nr()
+{
+ local condition=$1
+ shift 1
+
+ __chk_nr "ss -inmHMN $ns | $condition" $*
+}
+
chk_msk_nr()
{
- __chk_nr "grep -c token:" $*
+ __chk_msk_nr "grep -c token:" $*
}
wait_msk_nr()
@@ -97,12 +115,12 @@ wait_msk_nr()
chk_msk_fallback_nr()
{
- __chk_nr "grep -c fallback" $*
+ __chk_msk_nr "grep -c fallback" $*
}
chk_msk_remote_key_nr()
{
- __chk_nr "grep -c remote_key" $*
+ __chk_msk_nr "grep -c remote_key" $*
}
__chk_listen()
@@ -142,6 +160,26 @@ chk_msk_listen()
nr=$(ss -Ml $filter | wc -l)
}
+chk_msk_inuse()
+{
+ local expected=$1
+ local listen_nr
+
+ shift 1
+
+ listen_nr=$(ss -N "${ns}" -Ml | grep -c LISTEN)
+ expected=$((expected + listen_nr))
+
+ for _ in $(seq 10); do
+ if [ $(get_msk_inuse) -eq $expected ];then
+ break
+ fi
+ sleep 0.1
+ done
+
+ __chk_nr get_msk_inuse $expected $*
+}
+
# $1: ns, $2: port
wait_local_port_listen()
{
@@ -195,8 +233,10 @@ wait_connected $ns 10000
chk_msk_nr 2 "after MPC handshake "
chk_msk_remote_key_nr 2 "....chk remote_key"
chk_msk_fallback_nr 0 "....chk no fallback"
+chk_msk_inuse 2 "....chk 2 msk in use"
flush_pids
+chk_msk_inuse 0 "....chk 0 msk in use after flush"
echo "a" | \
timeout ${timeout_test} \
@@ -211,8 +251,11 @@ echo "b" | \
127.0.0.1 >/dev/null &
wait_connected $ns 10001
chk_msk_fallback_nr 1 "check fallback"
+chk_msk_inuse 1 "....chk 1 msk in use"
flush_pids
+chk_msk_inuse 0 "....chk 0 msk in use after flush"
+
NR_CLIENTS=100
for I in `seq 1 $NR_CLIENTS`; do
echo "a" | \
@@ -232,6 +275,9 @@ for I in `seq 1 $NR_CLIENTS`; do
done
wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
+chk_msk_inuse $((NR_CLIENTS*2)) "....chk many msk in use"
flush_pids
+chk_msk_inuse 0 "....chk 0 msk in use after flush"
+
exit $ret
--
2.37.2
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH mptcp-next v8 4/4] selftest: mptcp: add test for mptcp socket in use
@ 2022-12-08 2:45 menglong8.dong
2022-12-08 4:51 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
0 siblings, 1 reply; 27+ messages in thread
From: menglong8.dong @ 2022-12-08 2:45 UTC (permalink / raw)
To: pabeni, mathew.j.martineau, matthieu.baerts; +Cc: mptcp, Menglong Dong
From: Menglong Dong <imagedong@tencent.com>
Add the function chk_msk_inuse() to diag.sh, which is used to check the
statistics of mptcp socket in use. As mptcp socket in listen state will
be closed randomly after 'accept', we need to get the count of listening
mptcp socket through 'ss' command.
All tests pass.
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
v7:
- check all processes exit in flush_pids()
---
tools/testing/selftests/net/mptcp/diag.sh | 56 +++++++++++++++++++++--
1 file changed, 51 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh
index 24bcd7b9bdb2..ef628b16fe9b 100755
--- a/tools/testing/selftests/net/mptcp/diag.sh
+++ b/tools/testing/selftests/net/mptcp/diag.sh
@@ -17,6 +17,11 @@ flush_pids()
sleep 1.1
ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGUSR1 &>/dev/null
+
+ for _ in $(seq 10); do
+ [ -z "$(ip netns pids "${ns}")" ] && break
+ sleep 0.1
+ done
}
cleanup()
@@ -37,15 +42,20 @@ if [ $? -ne 0 ];then
exit $ksft_skip
fi
+get_msk_inuse()
+{
+ ip netns exec $ns cat /proc/net/protocols | awk '$1~/^MPTCP$/{print $3}'
+}
+
__chk_nr()
{
- local condition="$1"
+ local command="$1"
local expected=$2
local msg nr
shift 2
msg=$*
- nr=$(ss -inmHMN $ns | $condition)
+ nr=$(eval $command)
printf "%-50s" "$msg"
if [ $nr != $expected ]; then
@@ -57,9 +67,17 @@ __chk_nr()
test_cnt=$((test_cnt+1))
}
+__chk_msk_nr()
+{
+ local condition=$1
+ shift 1
+
+ __chk_nr "ss -inmHMN $ns | $condition" $*
+}
+
chk_msk_nr()
{
- __chk_nr "grep -c token:" $*
+ __chk_msk_nr "grep -c token:" $*
}
wait_msk_nr()
@@ -97,12 +115,12 @@ wait_msk_nr()
chk_msk_fallback_nr()
{
- __chk_nr "grep -c fallback" $*
+ __chk_msk_nr "grep -c fallback" $*
}
chk_msk_remote_key_nr()
{
- __chk_nr "grep -c remote_key" $*
+ __chk_msk_nr "grep -c remote_key" $*
}
__chk_listen()
@@ -142,6 +160,26 @@ chk_msk_listen()
nr=$(ss -Ml $filter | wc -l)
}
+chk_msk_inuse()
+{
+ local expected=$1
+ local listen_nr
+
+ shift 1
+
+ listen_nr=$(ss -N "${ns}" -Ml | grep -c LISTEN)
+ expected=$((expected + listen_nr))
+
+ for _ in $(seq 10); do
+ if [ $(get_msk_inuse) -eq $expected ];then
+ break
+ fi
+ sleep 0.1
+ done
+
+ __chk_nr get_msk_inuse $expected $*
+}
+
# $1: ns, $2: port
wait_local_port_listen()
{
@@ -195,8 +233,10 @@ wait_connected $ns 10000
chk_msk_nr 2 "after MPC handshake "
chk_msk_remote_key_nr 2 "....chk remote_key"
chk_msk_fallback_nr 0 "....chk no fallback"
+chk_msk_inuse 2 "....chk 2 msk in use"
flush_pids
+chk_msk_inuse 0 "....chk 0 msk in use after flush"
echo "a" | \
timeout ${timeout_test} \
@@ -211,8 +251,11 @@ echo "b" | \
127.0.0.1 >/dev/null &
wait_connected $ns 10001
chk_msk_fallback_nr 1 "check fallback"
+chk_msk_inuse 1 "....chk 1 msk in use"
flush_pids
+chk_msk_inuse 0 "....chk 0 msk in use after flush"
+
NR_CLIENTS=100
for I in `seq 1 $NR_CLIENTS`; do
echo "a" | \
@@ -232,6 +275,9 @@ for I in `seq 1 $NR_CLIENTS`; do
done
wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
+chk_msk_inuse $((NR_CLIENTS*2)) "....chk many msk in use"
flush_pids
+chk_msk_inuse 0 "....chk 0 msk in use after flush"
+
exit $ret
--
2.37.2
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH mptcp-next v6 4/4] selftest: mptcp: add test for mptcp socket in use
@ 2022-11-03 11:06 menglong8.dong
2022-11-03 13:21 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
0 siblings, 1 reply; 27+ messages in thread
From: menglong8.dong @ 2022-11-03 11:06 UTC (permalink / raw)
To: mathew.j.martineau, matthieu.baerts; +Cc: mptcp, Menglong Dong
From: Menglong Dong <imagedong@tencent.com>
Add the function chk_msk_inuse() to diag.sh, which is used to check the
statistics of mptcp socket in use. As mptcp socket in listen state will
be closed randomly after 'accept', we need to get the count of listening
mptcp socket through 'ss' command.
All tests pass.
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
v6:
- reuse __chk_nr to check the number of msk in use
---
tools/testing/selftests/net/mptcp/diag.sh | 47 ++++++++++++++++++++---
1 file changed, 42 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh
index 515859a5168b..9994cb23f8a0 100755
--- a/tools/testing/selftests/net/mptcp/diag.sh
+++ b/tools/testing/selftests/net/mptcp/diag.sh
@@ -36,15 +36,20 @@ if [ $? -ne 0 ];then
exit $ksft_skip
fi
+get_msk_inuse()
+{
+ ip netns exec $ns cat /proc/net/protocols | awk '$1~/^MPTCP$/{print $3}'
+}
+
__chk_nr()
{
- local condition="$1"
+ local command="$1"
local expected=$2
local msg nr
shift 2
msg=$*
- nr=$(ss -inmHMN $ns | $condition)
+ nr=$(eval $command)
printf "%-50s" "$msg"
if [ $nr != $expected ]; then
@@ -56,9 +61,17 @@ __chk_nr()
test_cnt=$((test_cnt+1))
}
+__chk_msk_nr()
+{
+ local condition=$1
+ shift 1
+
+ __chk_nr "ss -inmHMN $ns | $condition" $*
+}
+
chk_msk_nr()
{
- __chk_nr "grep -c token:" $*
+ __chk_msk_nr "grep -c token:" $*
}
wait_msk_nr()
@@ -96,12 +109,12 @@ wait_msk_nr()
chk_msk_fallback_nr()
{
- __chk_nr "grep -c fallback" $*
+ __chk_msk_nr "grep -c fallback" $*
}
chk_msk_remote_key_nr()
{
- __chk_nr "grep -c remote_key" $*
+ __chk_msk_nr "grep -c remote_key" $*
}
__chk_listen()
@@ -141,6 +154,25 @@ chk_msk_listen()
nr=$(ss -Ml $filter | wc -l)
}
+chk_msk_inuse()
+{
+ local expected=$1
+ local listen_nr
+
+ listen_nr=$(ss -N $ns -Ml | grep -c LISTEN)
+ expected=$(($expected+$listen_nr))
+ shift 1
+
+ for i in $(seq 10); do
+ if [ $(get_msk_inuse) -eq $expected ];then
+ break
+ fi
+ sleep 0.1
+ done
+
+ __chk_nr get_msk_inuse $expected $*
+}
+
# $1: ns, $2: port
wait_local_port_listen()
{
@@ -194,8 +226,10 @@ wait_connected $ns 10000
chk_msk_nr 2 "after MPC handshake "
chk_msk_remote_key_nr 2 "....chk remote_key"
chk_msk_fallback_nr 0 "....chk no fallback"
+chk_msk_inuse 2 "chk 2 msk in use"
flush_pids
+chk_msk_inuse 0 "chk 0 msk in use after flush"
echo "a" | \
timeout ${timeout_test} \
@@ -231,6 +265,9 @@ for I in `seq 1 $NR_CLIENTS`; do
done
wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
+chk_msk_inuse $((NR_CLIENTS*2)) "chk many msk in use"
flush_pids
+chk_msk_inuse 0 "chk 0 msk in use after flush"
+
exit $ret
--
2.37.2
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: selftest: mptcp: add test for mptcp socket in use: Tests Results
2022-11-03 11:06 [PATCH mptcp-next v6 4/4] selftest: mptcp: add test for mptcp socket in use menglong8.dong
@ 2022-11-03 13:21 ` MPTCP CI
2022-11-03 17:34 ` Matthieu Baerts
0 siblings, 1 reply; 27+ messages in thread
From: MPTCP CI @ 2022-11-03 13:21 UTC (permalink / raw)
To: Menglong Dong; +Cc: mptcp
Hi Menglong,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal:
- Success! ✅:
- Task: https://cirrus-ci.com/task/4909154062565376
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4909154062565376/summary/summary.txt
- KVM Validation: debug:
- Unstable: 1 failed test(s): selftest_diag 🔴:
- Task: https://cirrus-ci.com/task/6035053969408000
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6035053969408000/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/aa327877c6f9
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-debug
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 (Tessares)
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: selftest: mptcp: add test for mptcp socket in use: Tests Results
2022-11-03 13:21 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
@ 2022-11-03 17:34 ` Matthieu Baerts
2022-11-04 0:04 ` Mat Martineau
0 siblings, 1 reply; 27+ messages in thread
From: Matthieu Baerts @ 2022-11-03 17:34 UTC (permalink / raw)
To: Menglong Dong; +Cc: mptcp
Hi Menglong,
Thank you for the v6!
It looks like the CI is not happy with it:
On 03/11/2022 14:21, MPTCP CI wrote:
> Hi Menglong,
>
> Thank you for your modifications, that's great!
>
> Our CI did some validations and here is its report:
>
> - KVM Validation: normal:
> - Success! ✅:
> - Task: https://cirrus-ci.com/task/4909154062565376
> - Summary: https://api.cirrus-ci.com/v1/artifact/task/4909154062565376/summary/summary.txt
>
> - KVM Validation: debug:
> - Unstable: 1 failed test(s): selftest_diag 🔴:
> - Task: https://cirrus-ci.com/task/6035053969408000
> - Summary: https://api.cirrus-ci.com/v1/artifact/task/6035053969408000/summary/summary.txt
As you can see:
----------------------------
(...)
# all listen sockets [ ok ]
# after MPC handshake [ ok ]
# ....chk remote_key [ ok ]
# ....chk no fallback [ ok ]
# chk 2 msk in use [ ok ]
# chk 0 msk in use after flush [ ok ]
# check fallback [ ok ]
# many msk socket present [ fail ] timeout
while expecting 200 max 201 last 1
# chk many msk in use [ fail ] expected
200 found 0
# chk 0 msk in use after flush [ ok ]
----------------------------
I guess one socket is still present after the 'check fallback': you
probably need to modify flush_pids() to wait for the processes to be
over, as suggested on a comment in your v5, no?
https://lore.kernel.org/all/b3f3c01e-4010-d5ce-970d-394711bcd0e1@tessares.net/
I don't think it is a good idea to wait for >= 200 except if it takes a
very long time to have the previous socket terminated. If it does, maybe
we should re-order the test or re-create the netns instead of re-using it.
About the patch 3/4, note that the SIGUSR1 is probably stopping the test
earlier than expected because the interrupt will cause some actions to
stop but still good to check for the 'quit' variable.
Also, one small detail for patch 4/4: can you add "...." at the
beginning of the new lines you print in the selftest, similar to
"....chk no fallback"?
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: selftest: mptcp: add test for mptcp socket in use: Tests Results
2022-11-03 17:34 ` Matthieu Baerts
@ 2022-11-04 0:04 ` Mat Martineau
0 siblings, 0 replies; 27+ messages in thread
From: Mat Martineau @ 2022-11-04 0:04 UTC (permalink / raw)
To: Menglong Dong; +Cc: Matthieu Baerts, mptcp
[-- Attachment #1: Type: text/plain, Size: 2703 bytes --]
On Thu, 3 Nov 2022, Matthieu Baerts wrote:
> Hi Menglong,
>
> Thank you for the v6!
>
> It looks like the CI is not happy with it:
>
> On 03/11/2022 14:21, MPTCP CI wrote:
>> Hi Menglong,
>>
>> Thank you for your modifications, that's great!
>>
>> Our CI did some validations and here is its report:
>>
>> - KVM Validation: normal:
>> - Success! ✅:
>> - Task: https://cirrus-ci.com/task/4909154062565376
>> - Summary: https://api.cirrus-ci.com/v1/artifact/task/4909154062565376/summary/summary.txt
>>
>> - KVM Validation: debug:
>> - Unstable: 1 failed test(s): selftest_diag 🔴:
>> - Task: https://cirrus-ci.com/task/6035053969408000
>> - Summary: https://api.cirrus-ci.com/v1/artifact/task/6035053969408000/summary/summary.txt
>
> As you can see:
>
> ----------------------------
> (...)
> # all listen sockets [ ok ]
> # after MPC handshake [ ok ]
> # ....chk remote_key [ ok ]
> # ....chk no fallback [ ok ]
> # chk 2 msk in use [ ok ]
> # chk 0 msk in use after flush [ ok ]
> # check fallback [ ok ]
> # many msk socket present [ fail ] timeout
> while expecting 200 max 201 last 1
> # chk many msk in use [ fail ] expected
> 200 found 0
> # chk 0 msk in use after flush [ ok ]
> ----------------------------
>
> I guess one socket is still present after the 'check fallback': you
> probably need to modify flush_pids() to wait for the processes to be
> over, as suggested on a comment in your v5, no?
>
> https://lore.kernel.org/all/b3f3c01e-4010-d5ce-970d-394711bcd0e1@tessares.net/
>
> I don't think it is a good idea to wait for >= 200 except if it takes a
> very long time to have the previous socket terminated. If it does, maybe
> we should re-order the test or re-create the netns instead of re-using it.
>
>
> About the patch 3/4, note that the SIGUSR1 is probably stopping the test
> earlier than expected because the interrupt will cause some actions to
> stop but still good to check for the 'quit' variable.
>
>
> Also, one small detail for patch 4/4: can you add "...." at the
> beginning of the new lines you print in the selftest, similar to
> "....chk no fallback"?
>
Menglong -
Thanks for the updated patches. The test ran ok on my local system, but
the CI is slow on the debug build which makes the timing trickier. I don't
have anything to add to Matthieu's comments above, seems like his
suggestions will resolve the CI issue.
--
Mat Martineau
Intel
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH mptcp-next v5 3/3] selftest: mptcp: add test for mptcp socket in use
@ 2022-10-07 9:29 menglong8.dong
2022-10-07 10:57 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
2022-10-12 2:24 ` MPTCP CI
0 siblings, 2 replies; 27+ messages in thread
From: menglong8.dong @ 2022-10-07 9:29 UTC (permalink / raw)
To: mathew.j.martineau; +Cc: mptcp, Menglong Dong
From: Menglong Dong <imagedong@tencent.com>
Add the function chk_msk_inuse() to diag.sh, which is used to check the
statistics of mptcp socket in use. As mptcp socket in listen state will
be closed randomly after 'accept', we need to get the count of listening
mptcp socket through 'ss' command.
mptcp_connect command with '-r' flag seems won't exit after flush_pids,
therefore we need consider this additional statistics. But after the
second flush_pids, it will exit.
All tests pass.
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
tools/testing/selftests/net/mptcp/diag.sh | 28 +++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh
index 515859a5168b..d969cb45b8a9 100755
--- a/tools/testing/selftests/net/mptcp/diag.sh
+++ b/tools/testing/selftests/net/mptcp/diag.sh
@@ -141,6 +141,28 @@ chk_msk_listen()
nr=$(ss -Ml $filter | wc -l)
}
+chk_msk_inuse()
+{
+ local nr listen_nr
+ local expected=$1
+
+ shift 1
+ msg=$*
+
+ nr=$(ip netns exec $ns awk '$1~/^MPTCP$/{print $3}' /proc/net/protocols)
+ listen_nr=$(ss -N $ns -Ml | grep -c LISTEN)
+ expected=$(($expected+$listen_nr))
+
+ printf "%-50s" "$msg"
+
+ if [ $nr != $expected ]; then
+ echo "[ fail ] expected $expected found $nr"
+ ret=$test_cnt
+ else
+ echo "[ ok ]"
+ fi
+}
+
# $1: ns, $2: port
wait_local_port_listen()
{
@@ -194,8 +216,11 @@ wait_connected $ns 10000
chk_msk_nr 2 "after MPC handshake "
chk_msk_remote_key_nr 2 "....chk remote_key"
chk_msk_fallback_nr 0 "....chk no fallback"
+chk_msk_inuse 2 "msk in use statistics"
flush_pids
+# with '-r' flag, client won't exit after flush_pids
+chk_msk_inuse 1 "msk in use statistics"
echo "a" | \
timeout ${timeout_test} \
@@ -231,6 +256,9 @@ for I in `seq 1 $NR_CLIENTS`; do
done
wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
+chk_msk_inuse $((NR_CLIENTS*2+1)) "msk in use statistics"
flush_pids
+chk_msk_inuse 0 "msk in use statistics"
+
exit $ret
--
2.37.2
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: selftest: mptcp: add test for mptcp socket in use: Tests Results
2022-10-07 9:29 [PATCH mptcp-next v5 3/3] selftest: mptcp: add test for mptcp socket in use menglong8.dong
@ 2022-10-07 10:57 ` MPTCP CI
2022-10-12 2:24 ` MPTCP CI
1 sibling, 0 replies; 27+ messages in thread
From: MPTCP CI @ 2022-10-07 10:57 UTC (permalink / raw)
To: Menglong Dong; +Cc: mptcp
Hi Menglong,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal:
- Unstable: 2 failed test(s): selftest_mptcp_join selftest_simult_flows 🔴:
- Task: https://cirrus-ci.com/task/6562201610747904
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6562201610747904/summary/summary.txt
- KVM Validation: debug:
- Success! ✅:
- Task: https://cirrus-ci.com/task/4732614262128640
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4732614262128640/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/83a72b913f3a
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-debug
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 (Tessares)
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: selftest: mptcp: add test for mptcp socket in use: Tests Results
2022-10-07 9:29 [PATCH mptcp-next v5 3/3] selftest: mptcp: add test for mptcp socket in use menglong8.dong
2022-10-07 10:57 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
@ 2022-10-12 2:24 ` MPTCP CI
1 sibling, 0 replies; 27+ messages in thread
From: MPTCP CI @ 2022-10-12 2:24 UTC (permalink / raw)
To: Menglong Dong; +Cc: mptcp
Hi Menglong,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal:
- Unstable: 1 failed test(s): packetdrill_add_addr 🔴:
- Task: https://cirrus-ci.com/task/5412647641284608
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5412647641284608/summary/summary.txt
- KVM Validation: debug:
- Unstable: 2 failed test(s): selftest_diag selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/6538547548127232
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6538547548127232/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/ebf2e7e28f93
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-debug
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 (Tessares)
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH mptcp-next v4 3/3] selftest: mptcp: add test for mptcp socket in use
@ 2022-10-06 6:11 menglong8.dong
2022-10-06 13:59 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
0 siblings, 1 reply; 27+ messages in thread
From: menglong8.dong @ 2022-10-06 6:11 UTC (permalink / raw)
To: mathew.j.martineau; +Cc: mptcp, Menglong Dong
From: Menglong Dong <imagedong@tencent.com>
Add the function chk_msk_inuse() to diag.sh, which is used to check the
statistics of mptcp socket in use. As mptcp socket in listen state will
be closed randomly after 'accept', we need to get the count of listening
mptcp socket through 'ss' command.
mptcp_connect command with '-r' flag seems won't exit after flush_pids,
therefore we need consider this additional statistics. But after the
second flush_pids, it will exit.
All tests pass.
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
tools/testing/selftests/net/mptcp/diag.sh | 28 +++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh
index 515859a5168b..d969cb45b8a9 100755
--- a/tools/testing/selftests/net/mptcp/diag.sh
+++ b/tools/testing/selftests/net/mptcp/diag.sh
@@ -141,6 +141,28 @@ chk_msk_listen()
nr=$(ss -Ml $filter | wc -l)
}
+chk_msk_inuse()
+{
+ local nr listen_nr
+ local expected=$1
+
+ shift 1
+ msg=$*
+
+ nr=$(ip netns exec $ns awk '$1~/^MPTCP$/{print $3}' /proc/net/protocols)
+ listen_nr=$(ss -N $ns -Ml | grep -c LISTEN)
+ expected=$(($expected+$listen_nr))
+
+ printf "%-50s" "$msg"
+
+ if [ $nr != $expected ]; then
+ echo "[ fail ] expected $expected found $nr"
+ ret=$test_cnt
+ else
+ echo "[ ok ]"
+ fi
+}
+
# $1: ns, $2: port
wait_local_port_listen()
{
@@ -194,8 +216,11 @@ wait_connected $ns 10000
chk_msk_nr 2 "after MPC handshake "
chk_msk_remote_key_nr 2 "....chk remote_key"
chk_msk_fallback_nr 0 "....chk no fallback"
+chk_msk_inuse 2 "msk in use statistics"
flush_pids
+# with '-r' flag, client won't exit after flush_pids
+chk_msk_inuse 1 "msk in use statistics"
echo "a" | \
timeout ${timeout_test} \
@@ -231,6 +256,9 @@ for I in `seq 1 $NR_CLIENTS`; do
done
wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
+chk_msk_inuse $((NR_CLIENTS*2+1)) "msk in use statistics"
flush_pids
+chk_msk_inuse 0 "msk in use statistics"
+
exit $ret
--
2.37.2
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH mptcp-next v3 3/3] selftest: mptcp: add test for mptcp socket in use
@ 2022-09-30 2:46 menglong8.dong
2022-10-06 17:25 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
0 siblings, 1 reply; 27+ messages in thread
From: menglong8.dong @ 2022-09-30 2:46 UTC (permalink / raw)
To: mathew.j.martineau; +Cc: mptcp, Menglong Dong
From: Menglong Dong <imagedong@tencent.com>
Add the function chk_msk_inuse() to diag.sh, which is used to check the
statistics of mptcp socket in use. As mptcp socket in listen state will
be closed randomly after 'accept', we need to get the count of listening
mptcp socket through 'ss' command.
mptcp_connect command with '-r' flag seems won't exit after flush_pids,
therefore we need consider this additional statistics. But after the
second flush_pids, it will exit.
All tests pass.
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
tools/testing/selftests/net/mptcp/diag.sh | 28 +++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh
index 515859a5168b..d969cb45b8a9 100755
--- a/tools/testing/selftests/net/mptcp/diag.sh
+++ b/tools/testing/selftests/net/mptcp/diag.sh
@@ -141,6 +141,28 @@ chk_msk_listen()
nr=$(ss -Ml $filter | wc -l)
}
+chk_msk_inuse()
+{
+ local nr listen_nr
+ local expected=$1
+
+ shift 1
+ msg=$*
+
+ nr=$(ip netns exec $ns awk '$1~/^MPTCP$/{print $3}' /proc/net/protocols)
+ listen_nr=$(ss -N $ns -Ml | grep -c LISTEN)
+ expected=$(($expected+$listen_nr))
+
+ printf "%-50s" "$msg"
+
+ if [ $nr != $expected ]; then
+ echo "[ fail ] expected $expected found $nr"
+ ret=$test_cnt
+ else
+ echo "[ ok ]"
+ fi
+}
+
# $1: ns, $2: port
wait_local_port_listen()
{
@@ -194,8 +216,11 @@ wait_connected $ns 10000
chk_msk_nr 2 "after MPC handshake "
chk_msk_remote_key_nr 2 "....chk remote_key"
chk_msk_fallback_nr 0 "....chk no fallback"
+chk_msk_inuse 2 "msk in use statistics"
flush_pids
+# with '-r' flag, client won't exit after flush_pids
+chk_msk_inuse 1 "msk in use statistics"
echo "a" | \
timeout ${timeout_test} \
@@ -231,6 +256,9 @@ for I in `seq 1 $NR_CLIENTS`; do
done
wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
+chk_msk_inuse $((NR_CLIENTS*2+1)) "msk in use statistics"
flush_pids
+chk_msk_inuse 0 "msk in use statistics"
+
exit $ret
--
2.37.2
^ permalink raw reply related [flat|nested] 27+ messages in thread
end of thread, other threads:[~2022-12-19 13:50 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-22 3:49 [PATCH mptcp-next v7 0/4] mptcp: add statistics for mptcp socket in use menglong8.dong
2022-11-22 3:49 ` [PATCH mptcp-next v7 1/4] mptcp: introduce 'sk' to replace 'sock->sk' in mptcp_listen() menglong8.dong
2022-11-22 3:49 ` [PATCH mptcp-next v7 2/4] mptcp: add statistics for mptcp socket in use menglong8.dong
2022-12-02 12:37 ` Paolo Abeni
2022-12-07 13:09 ` Menglong Dong
2022-11-22 3:49 ` [PATCH mptcp-next v7 3/4] selftest: mptcp: exit from copyfd_io_poll() when receive SIGUSR1 menglong8.dong
2022-11-22 3:49 ` [PATCH mptcp-next v7 4/4] selftest: mptcp: add test for mptcp socket in use menglong8.dong
2022-11-23 17:27 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
2022-11-23 19:14 ` MPTCP CI
2022-11-28 16:05 ` [PATCH mptcp-next v7 4/4] selftest: mptcp: add test for mptcp socket in use Matthieu Baerts
2022-11-23 15:58 ` [PATCH mptcp-next v7 0/4] mptcp: add statistics " Matthieu Baerts
2022-11-24 9:06 ` Menglong Dong
2022-11-24 9:29 ` Matthieu Baerts
2022-11-28 16:05 ` Matthieu Baerts
2022-11-30 2:11 ` Menglong Dong
2022-11-30 9:44 ` Matthieu Baerts
-- strict thread matches above, loose matches on Subject: below --
2022-12-19 10:23 [PATCH mptcp-next v10 6/6] selftest: mptcp: add test " menglong8.dong
2022-12-19 12:01 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
2022-12-19 13:50 ` MPTCP CI
2022-12-19 7:50 [PATCH mptcp-next v9 6/6] selftest: mptcp: add test for mptcp socket in use menglong8.dong
2022-12-19 8:57 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
2022-12-08 2:45 [PATCH mptcp-next v8 4/4] selftest: mptcp: add test for mptcp socket in use menglong8.dong
2022-12-08 4:51 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
2022-11-03 11:06 [PATCH mptcp-next v6 4/4] selftest: mptcp: add test for mptcp socket in use menglong8.dong
2022-11-03 13:21 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
2022-11-03 17:34 ` Matthieu Baerts
2022-11-04 0:04 ` Mat Martineau
2022-10-07 9:29 [PATCH mptcp-next v5 3/3] selftest: mptcp: add test for mptcp socket in use menglong8.dong
2022-10-07 10:57 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
2022-10-12 2:24 ` MPTCP CI
2022-10-06 6:11 [PATCH mptcp-next v4 3/3] selftest: mptcp: add test for mptcp socket in use menglong8.dong
2022-10-06 13:59 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
2022-09-30 2:46 [PATCH mptcp-next v3 3/3] selftest: mptcp: add test for mptcp socket in use menglong8.dong
2022-10-06 17:25 ` selftest: mptcp: add test for mptcp socket in use: Tests Results MPTCP CI
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 NNTP newsgroup(s).