Skip to contentSkip to conversation

add MPTCP_MIB_CURRESTAB

PATCH Superseded Geliang Tang 4 participants 11 messages Nov 29, 2023

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover add MPTCP_MIB_CURRESTAB

v2:
- use ftrace_regs_get_argument instead of regs_get_kernel_argument to fix build warnings reported kernel test robot.

Geliang Tang (4):
mptcp: add mib counter dec helper
mptcp: add a current established counter
mptcp: add a ftrace callback for tcp_set_state
selftests: mptcp: join: check CURRESTAB counters

 net/mptcp/Makefile                            |  1 +
 net/mptcp/mib.c                               |  1 +
 net/mptcp/mib.h                               |  8 +++
 net/mptcp/trace.c                             | 64 +++++++++++++++++++
 .../testing/selftests/net/mptcp/mptcp_join.sh | 58 +++++++++++++++--
 5 files changed, 127 insertions(+), 5 deletions(-)
 create mode 100644 net/mptcp/trace.c
Signature · 1 line
2.35.3
#1 lore raw

PATCH v2 1/4 mptcp: add mib counter dec helper

Similar to MPTCP_INC_STATS() helper, this patch adds a new helper named MPTCP_DEC_STATS() to decrement a MIB counter.

---
 net/mptcp/mib.h | 7 +++++++
 1 file changed, 7 insertions(+)
net/mptcp/mib.h +7 -0
index cae71d947252..9b7c366675ec 100644
@@ -95,4 +95,11 @@ static inline void __MPTCP_INC_STATS(struct net *net,
 		__SNMP_INC_STATS(net->mib.mptcp_statistics, field);
 }
 
+static inline void MPTCP_DEC_STATS(struct net *net,
+				   enum linux_mptcp_mib_field field)
+{
+	if (likely(net->mib.mptcp_statistics))
+		SNMP_DEC_STATS(net->mib.mptcp_statistics, field);
+}
+
 bool mptcp_mib_alloc(struct net *net);
Signature · 1 line
2.35.3
#2 lore raw

PATCH v2 2/4 mptcp: add a current established counter

In reply to Geliang Tang

This patch adds a new MIB counter named MPTCP_MIB_CURRESTAB to count current established MPTCP connections.

---
 net/mptcp/mib.c | 1 +
 net/mptcp/mib.h | 1 +
 2 files changed, 2 insertions(+)
net/mptcp/mib.c +1 -0
index a0990c365a2e..c30405e76833 100644
@@ -66,6 +66,7 @@ static const struct snmp_mib mptcp_snmp_list[] = {
 	SNMP_MIB_ITEM("RcvWndShared", MPTCP_MIB_RCVWNDSHARED),
 	SNMP_MIB_ITEM("RcvWndConflictUpdate", MPTCP_MIB_RCVWNDCONFLICTUPDATE),
 	SNMP_MIB_ITEM("RcvWndConflict", MPTCP_MIB_RCVWNDCONFLICT),
+	SNMP_MIB_ITEM("MPCurrEstab", MPTCP_MIB_CURRESTAB),
 	SNMP_MIB_SENTINEL
 };
 
net/mptcp/mib.h +1 -0
index 9b7c366675ec..dd7fd1f246b5 100644
@@ -65,6 +65,7 @@ enum linux_mptcp_mib_field {
 					 * conflict with another subflow while updating msk rcv wnd
 					 */
 	MPTCP_MIB_RCVWNDCONFLICT,	/* Conflict with while updating msk rcv wnd */
+	MPTCP_MIB_CURRESTAB,		/* Current established MPTCP connections */
 	__MPTCP_MIB_MAX
 };
 
Signature · 1 line
2.35.3
#3 lore raw

PATCH v2 3/4 mptcp: add a ftrace callback for tcp_set_state

In reply to Geliang Tang

This patch adds a new function mptcp_check_state(), in it if switch from or to ESTABLISH state, increment or decrement the newly added counter MPTCP_MIB_CURRESTAB.

Instead of invoking mptcp_check_state() in tcp_set_state() directly, here add a new file trace.c, in it use ftrace to hook a callback function to tcp_set_state(), named mptcp_state_callback(). mptcp_check_state() is invoked in the callback function.

---
 net/mptcp/Makefile |  1 +
 net/mptcp/trace.c  | 64 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 net/mptcp/trace.c
net/mptcp/Makefile +1 -0
index 67cd565bb321..bf88bdb222b3 100644
@@ -14,3 +14,4 @@ mptcp_token_test-objs := token_test.o
 obj-$(CONFIG_MPTCP_KUNIT_TEST) += mptcp_crypto_test.o mptcp_token_test.o
 
 obj-$(CONFIG_BPF_SYSCALL) += bpf.o
+obj-$(CONFIG_FUNCTION_TRACER) += trace.o
net/mptcp/trace.c new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
2.35.3
#8 lore raw

PATCH v2 4/4 selftests: mptcp: join: check CURRESTAB counters

In reply to Geliang Tang

This patch adds a new helper chk_cestab_nr() to check the current established connections counter MIB_CURRESTAB. Set the newly added variables cestab_ns1 and cestab_ns2 to indicate how many connections are expected in ns1 or ns2. These checks are embedded in add_tests().

---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 58 +++++++++++++++++--
 1 file changed, 53 insertions(+), 5 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +53 -5
index 87590a43b50d..826c2af6ab27 100755
@@ -56,6 +56,8 @@ unset FAILING_LINKS
 unset test_linkfail
 unset addr_nr_ns1
 unset addr_nr_ns2
+unset cestab_ns1
+unset cestab_ns2
 unset sflags
 unset fastclose
 unset fullmesh
@@ -976,6 +978,46 @@ pm_nl_set_endpoint()
 	fi
 }
 
+chk_cestab_nr()
+{
+	local ns=$1
+	local cestab=$2
+	local count
+
+	print_check "current establish"
+	count=$(mptcp_lib_get_counter ${ns} "MPTcpExtMPCurrEstab")
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$cestab" ]; then
+		fail_test "got $count current establish[s] expected $cestab"
+	else
+		print_ok
+	fi
+}
+
+check_cestab()
+{
+	local cestab_ns1=${cestab_ns1:-0}
+	local cestab_ns2=${cestab_ns2:-0}
+
+	if ! mptcp_lib_kallsyms_has "register_ftrace_function"; then
+		return
+	fi
+
+	if [ $cestab_ns1 -gt 0 ]; then
+		if mptcp_lib_is_v6 $3; then
+			sleep 2
+		fi
+		chk_cestab_nr $1 $cestab_ns1
+	fi
+	if [ $cestab_ns2 -gt 0 ]; then
+		if mptcp_lib_is_v6 $3; then
+			sleep 2
+		fi
+		chk_cestab_nr $2 $cestab_ns2
+	fi
+}
+
 do_transfer()
 {
 	local listener_ns="$1"
@@ -1089,6 +1131,7 @@ do_transfer()
 	local cpid=$!
 
 	pm_nl_set_endpoint $listener_ns $connector_ns $connect_addr
+	check_cestab $listener_ns $connector_ns $connect_addr
 
 	wait $cpid
 	local retc=$?
@@ -2477,47 +2520,52 @@ add_tests()
 	if reset "add single subflow"; then
 		pm_nl_set_limits $ns1 0 1
 		pm_nl_set_limits $ns2 0 1
-		addr_nr_ns2=1 speed=slow \
+		addr_nr_ns2=1 speed=slow cestab_ns2=2 \
 			run_tests $ns1 $ns2 10.0.1.1
 		chk_join_nr 1 1 1
+		chk_cestab_nr $ns2 0
 	fi
 
 	# add signal address
 	if reset "add signal address"; then
 		pm_nl_set_limits $ns1 0 1
 		pm_nl_set_limits $ns2 1 1
-		addr_nr_ns1=1 speed=slow \
+		addr_nr_ns1=1 speed=slow cestab_ns1=2 \
 			run_tests $ns1 $ns2 10.0.1.1
 		chk_join_nr 1 1 1
 		chk_add_nr 1 1
+		chk_cestab_nr $ns1 0
 	fi
 
 	# add multiple subflows
 	if reset "add multiple subflows"; then
 		pm_nl_set_limits $ns1 0 2
 		pm_nl_set_limits $ns2 0 2
-		addr_nr_ns2=2 speed=slow \
+		addr_nr_ns2=2 speed=slow cestab_ns2=3 \
 			run_tests $ns1 $ns2 10.0.1.1
 		chk_join_nr 2 2 2
+		chk_cestab_nr $ns2 0
 	fi
 
 	# add multiple subflows IPv6
 	if reset "add multiple subflows IPv6"; then
 		pm_nl_set_limits $ns1 0 2
 		pm_nl_set_limits $ns2 0 2
-		addr_nr_ns2=2 speed=slow \
+		addr_nr_ns2=2 speed=slow cestab_ns2=3 \
 			run_tests $ns1 $ns2 dead:beef:1::1
 		chk_join_nr 2 2 2
+		chk_cestab_nr $ns2 0
 	fi
 
 	# add multiple addresses IPv6
 	if reset "add multiple addresses IPv6"; then
 		pm_nl_set_limits $ns1 0 2
 		pm_nl_set_limits $ns2 2 2
-		addr_nr_ns1=2 speed=slow \
+		addr_nr_ns1=2 speed=slow cestab_ns1=3 \
 			run_tests $ns1 $ns2 dead:beef:1::1
 		chk_join_nr 2 2 2
 		chk_add_nr 2 2
+		chk_cestab_nr $ns1 0
 	fi
 }
 
Signature · 1 line
2.35.3
#9 lore raw

Re: selftests: mptcp: join: check CURRESTAB counters: Tests Results

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- {"code":404,"message":
- "Can't find artifacts containing file conclusion.txt"}:
- Task: https://cirrus-ci.com/task/4926830960967680
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4926830960967680/summary/summary.txt

- {"code":404,"message":
- "Can't find artifacts containing file conclusion.txt"}:
- Task: https://cirrus-ci.com/task/6052730867810304
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6052730867810304/summary/summary.txt

- {"code":404,"message":
- "Can't find artifacts containing file conclusion.txt"}:
- Task: https://cirrus-ci.com/task/5489780914388992
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5489780914388992/summary/summary.txt

- {"code":404,"message":
- "Can't find artifacts containing file conclusion.txt"}:
- Task: https://cirrus-ci.com/task/6615680821231616
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6615680821231616/summary/summary.txt

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/bd08b7494cbb

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 (NGI0 Core)

#10 lore raw

Re: selftests: mptcp: join: check CURRESTAB counters: Build Failure

In reply to Geliang Tang

Hi Geliang,

Thank you for your modifications, that's great!

But sadly, our CI spotted some issues with it when trying to build it.

You can find more details there:

https://patchwork.kernel.org/project/mptcp/patch/bfe28bf33329bf157f8b8f9ff49b398003c487cb.1701230012.git.geliang.tang@suse.com/
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/7027998325

Status: failure
Initiator: MPTCPimporter
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/bd08b7494cbb

Feel free to reply to this email if you cannot access logs, if you need some support to fix the error, if this doesn't seem to be caused by your modifications or if the error is a false positive one.

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)

maintainer
#4 lore raw

Re: [PATCH mptcp-next v2 3/4] mptcp: add a ftrace callback for tcp_set_state

In reply to Geliang Tang
Quoted 86 lines · Geliang Tang

This patch adds a new function mptcp_check_state(), in it if switch from or to ESTABLISH state, increment or decrement the newly added counter MPTCP_MIB_CURRESTAB.

Instead of invoking mptcp_check_state() in tcp_set_state() directly, here add a new file trace.c, in it use ftrace to hook a callback function to tcp_set_state(), named mptcp_state_callback(). mptcp_check_state() is invoked in the callback function.

---
 net/mptcp/Makefile |  1 +
 net/mptcp/trace.c  | 64 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 net/mptcp/trace.c
net/mptcp/Makefile +1 -0
index 67cd565bb321..bf88bdb222b3 100644
@@ -14,3 +14,4 @@ mptcp_token_test-objs := token_test.o
 obj-$(CONFIG_MPTCP_KUNIT_TEST) += mptcp_crypto_test.o mptcp_token_test.o
 
 obj-$(CONFIG_BPF_SYSCALL) += bpf.o
+obj-$(CONFIG_FUNCTION_TRACER) += trace.o
net/mptcp/trace.c new file +54 -0
new file mode 100644
index 000000000000..7dc33ff88813
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Multipath TCP
+ *
+ * Copyright (c) 2023, SUSE.
+ */
+
+#define pr_fmt(fmt) "MPTCP: " fmt
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/ftrace.h>
+#include <net/sock.h>
+#include <net/mptcp.h>
+#include "protocol.h"
+#include "mib.h"
+
+static void mptcp_check_state(struct sock *sk, int oldstate, int state)
+{
+	switch (state) {
+	case TCP_ESTABLISHED:
+		if (oldstate != TCP_ESTABLISHED)
+			MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB);
+		break;
+
+	default:
+		if (oldstate == TCP_ESTABLISHED)
+			MPTCP_DEC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB);
+	}
+}
+
+static void mptcp_state_callback(unsigned long ip,
+				 unsigned long parent_ip,
+				 struct ftrace_ops *op,
+				 struct ftrace_regs *fregs)
+{
+	int oldstate, state;
+	struct sock *sk;
+
+	sk = (struct sock *)ftrace_regs_get_argument(fregs, 0);
+	if (!sk)
+		return;
+
+	oldstate = sk->sk_state;
+	state = (int)ftrace_regs_get_argument(fregs, 1);
+
+	if (sk_is_mptcp(sk))
+		mptcp_check_state(sk, oldstate, state);
+}
+
+static struct ftrace_ops mptcp_state_ops = {
+	.func		= mptcp_state_callback,
+	.flags		= FTRACE_OPS_FL_SAVE_REGS,
+};
+

net/mptcp/trace.c line 64

Quoted 10 lines
net/mptcp/trace.c new file +10 -0
+static __init int mptcp_ftrace_init(void)
+{
+	char *func_name = "tcp_set_state";
+	int ret;
+
+	ret = ftrace_set_filter(&mptcp_state_ops, func_name,
+				strlen(func_name), 0);
+	return ret ?: register_ftrace_function(&mptcp_state_ops);
+}
+late_initcall(mptcp_ftrace_init);

I think this is not the correct approach.

I think we must avoid using ftrace to plug an hook from a builtin feature into another builtin kernel feature.

Additionally this is tracing tcp socket state change, not mptcp sockets.

A cleaner solution would be adding in protocol.c a mptcp_set_state() helper that does set the msk state to the provided value and does the MPTCP_MIB_CURRESTAB accounting.

Then replacing all the 'inet_sk_state_store()' calls under net/mptcp with the new helper call. I already checked all of them are under the msk socket lock, so such substitution is safe.

There is only one exception:

	inet_sk_state_store(newsk, TCP_LISTEN);

in mptcp_pm_nl_create_listen_socket(). You can either:

* avoid replacing such call with the new helper, as the old status is known to be TCP_CLOSE, hence will not affect the count (just drop a comment there)

* (possibly better) do the replace even there, adding the relevant msk socket lock around such call.

Cheers,

Paolo

#5 lore raw

Re: [PATCH mptcp-next v2 3/4] mptcp: add a ftrace callback for tcp_set_state

In reply to Geliang Tang
kernel test robot noticed the following build warnings:

Hi Geliang,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mptcp/export]
[also build test WARNING on mptcp/export-net linus/master v6.7-rc3 next-20231129] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Geliang-Tang/mptcp-add-a-current-established-counter/20231129-131030
base:   https://github.com/multipath-tcp/mptcp_net-next.git export
patch link:    https://lore.kernel.org/r/4323a04943500dce8c072c49ce50b21591357876.1701230012.git.geliang.tang%40suse.com
patch subject: [PATCH mptcp-next v2 3/4] mptcp: add a ftrace callback for tcp_set_state
config: x86_64-randconfig-005-20231129 (https://download.01.org/0day-ci/archive/20231129/[email protected]/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231129/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> net/mptcp/trace.c:57:8: warning: unused variable 'func_name' [-Wunused-variable]
           char *func_name = "tcp_set_state";
                 ^

1 warning generated.

vim +/func_name +57 net/mptcp/trace.c

    54	
    55	static __init int mptcp_ftrace_init(void)
    56	{
  > 57		char *func_name = "tcp_set_state";
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#6 lore raw

Re: [PATCH mptcp-next v2 3/4] mptcp: add a ftrace callback for tcp_set_state

In reply to Geliang Tang
kernel test robot noticed the following build errors:

Hi Geliang,

kernel test robot noticed the following build errors:

[auto build test ERROR on mptcp/export]
[also build test ERROR on mptcp/export-net linus/master v6.7-rc3 next-20231129] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Geliang-Tang/mptcp-add-a-current-established-counter/20231129-131030
base:   https://github.com/multipath-tcp/mptcp_net-next.git export
patch link:    https://lore.kernel.org/r/4323a04943500dce8c072c49ce50b21591357876.1701230012.git.geliang.tang%40suse.com
patch subject: [PATCH mptcp-next v2 3/4] mptcp: add a ftrace callback for tcp_set_state
config: sh-allyesconfig (https://download.01.org/0day-ci/archive/20231130/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231130/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from net/mptcp/trace.c:11:
net/mptcp/trace.c: In function 'mptcp_state_callback':

>> include/linux/ftrace.h:158:9: error: implicit declaration of function 'regs_get_kernel_argument'; did you mean 'regs_get_kernel_stack_nth'? [-Werror=implicit-function-declaration]
     158 |         regs_get_kernel_argument(ftrace_get_regs(fregs), n)
         |         ^~~~~~~~~~~~~~~~~~~~~~~~
   net/mptcp/trace.c:39:29: note: in expansion of macro 'ftrace_regs_get_argument'
      39 |         sk = (struct sock *)ftrace_regs_get_argument(fregs, 0);
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +158 include/linux/ftrace.h

94d095ffa0e16b Mark Rutland 2022-11-03  153  
94d095ffa0e16b Mark Rutland 2022-11-03  154  #ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
94d095ffa0e16b Mark Rutland 2022-11-03  155  #define ftrace_regs_get_instruction_pointer(fregs) \
94d095ffa0e16b Mark Rutland 2022-11-03  156  	instruction_pointer(ftrace_get_regs(fregs))
94d095ffa0e16b Mark Rutland 2022-11-03  157  #define ftrace_regs_get_argument(fregs, n) \
94d095ffa0e16b Mark Rutland 2022-11-03 @158  	regs_get_kernel_argument(ftrace_get_regs(fregs), n)
94d095ffa0e16b Mark Rutland 2022-11-03  159  #define ftrace_regs_get_stack_pointer(fregs) \
94d095ffa0e16b Mark Rutland 2022-11-03  160  	kernel_stack_pointer(ftrace_get_regs(fregs))
94d095ffa0e16b Mark Rutland 2022-11-03  161  #define ftrace_regs_return_value(fregs) \
94d095ffa0e16b Mark Rutland 2022-11-03  162  	regs_return_value(ftrace_get_regs(fregs))
94d095ffa0e16b Mark Rutland 2022-11-03  163  #define ftrace_regs_set_return_value(fregs, ret) \
94d095ffa0e16b Mark Rutland 2022-11-03  164  	regs_set_return_value(ftrace_get_regs(fregs), ret)
94d095ffa0e16b Mark Rutland 2022-11-03  165  #define ftrace_override_function_with_return(fregs) \
94d095ffa0e16b Mark Rutland 2022-11-03  166  	override_function_with_return(ftrace_get_regs(fregs))
94d095ffa0e16b Mark Rutland 2022-11-03  167  #define ftrace_regs_query_register_offset(name) \
94d095ffa0e16b Mark Rutland 2022-11-03  168  	regs_query_register_offset(name)
94d095ffa0e16b Mark Rutland 2022-11-03  169  #endif

94d095ffa0e16b Mark Rutland 2022-11-03 170

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#7 lore raw

Re: [PATCH mptcp-next v2 3/4] mptcp: add a ftrace callback for tcp_set_state

In reply to Geliang Tang
kernel test robot noticed the following build errors:

Hi Geliang,

kernel test robot noticed the following build errors:

[auto build test ERROR on mptcp/export]
[also build test ERROR on mptcp/export-net linus/master v6.7-rc3 next-20231129] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Geliang-Tang/mptcp-add-a-current-established-counter/20231129-131030
base:   https://github.com/multipath-tcp/mptcp_net-next.git export
patch link:    https://lore.kernel.org/r/4323a04943500dce8c072c49ce50b21591357876.1701230012.git.geliang.tang%40suse.com
patch subject: [PATCH mptcp-next v2 3/4] mptcp: add a ftrace callback for tcp_set_state
config: arm-randconfig-r111-20231129 (https://download.01.org/0day-ci/archive/20231130/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20231130/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> net/mptcp/trace.c:39:22: error: call to undeclared function 'regs_get_kernel_argument'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      39 |         sk = (struct sock *)ftrace_regs_get_argument(fregs, 0);
         |                             ^
   include/linux/ftrace.h:158:2: note: expanded from macro 'ftrace_regs_get_argument'
     158 |         regs_get_kernel_argument(ftrace_get_regs(fregs), n)
         |         ^
   net/mptcp/trace.c:39:22: note: did you mean 'regs_get_kernel_stack_nth'?
   include/linux/ftrace.h:158:2: note: expanded from macro 'ftrace_regs_get_argument'
     158 |         regs_get_kernel_argument(ftrace_get_regs(fregs), n)
         |         ^

arch/arm/include/asm/ptrace.h:131:22: note: 'regs_get_kernel_stack_nth' declared here
131 | extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
| ^
1 error generated.

vim +/regs_get_kernel_argument +39 net/mptcp/trace.c

    30	
    31	static void mptcp_state_callback(unsigned long ip,
    32					 unsigned long parent_ip,
    33					 struct ftrace_ops *op,
    34					 struct ftrace_regs *fregs)
    35	{
    36		int oldstate, state;
    37		struct sock *sk;
    38	
  > 39		sk = (struct sock *)ftrace_regs_get_argument(fregs, 0);
    40		if (!sk)
    41			return;
    42	
    43		oldstate = sk->sk_state;
    44		state = (int)ftrace_regs_get_argument(fregs, 1);
    45	
    46		if (sk_is_mptcp(sk))
    47			mptcp_check_state(sk, oldstate, state);
    48	}
    49	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki