All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/3] io_uring zerocopy receive
@ 2022-01-24  9:43 Hao Xu
  2022-01-24  9:43 ` [PATCH 1/3] net-zerocopy: split zerocopy receive to several parts Hao Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Hao Xu @ 2022-01-24  9:43 UTC (permalink / raw)
  To: netdev, io-uring
  Cc: Jens Axboe, Pavel Begunkov, Eric Dumazet, David S . Miller,
	Jakub Kicinski, Hideaki YOSHIFUJI, David Ahern, Joseph Qi

Integrate the current zerocopy receive solution to io_uring for eazier
use. The current calling process is:
  1) mmap a range of virtual address
  2) poll() to wait for data ready of the sockfd
  3) call getsockopt() to map the address in 1) to physical pages
  4) access the data.

By integrating it to io_uring, 2) and 3) can be merged:
  1) mmap a range of virtual address
  2) prepare a sqe and submit
  3) get a cqe which indicates data is ready and mapped
  4) access the data

which reduce one system call and make users be unaware of 3)

Also provide a test case which basically reuses
tools/testing/selftests/net/tcp_mmap.c:
https://github.com/HowHsu/liburing/tree/zc_receive

server side:
taskset -c 1-2 ./zc_receive -s -4 -z -M $((4096+12))

client side:
taskset -c 3 ./tcp_mmap -H '127.0.0.1' -z -4 -M $((4096+12))

no much difference of the result since no functionality change.


Hao Xu (3):
  net-zerocopy: split zerocopy receive to several parts
  net-zerocopy: remove static for tcp_zerocopy_receive()
  io_uring: zerocopy receive

 fs/io_uring.c                 |  72 ++++++++++++++++++
 include/net/tcp.h             |   8 ++
 include/uapi/linux/io_uring.h |   1 +
 net/ipv4/tcp.c                | 134 ++++++++++++++++++++--------------
 4 files changed, 159 insertions(+), 56 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/3] net-zerocopy: split zerocopy receive to several parts
  2022-01-24  9:43 [RFC 0/3] io_uring zerocopy receive Hao Xu
@ 2022-01-24  9:43 ` Hao Xu
  2022-01-24 14:09     ` kernel test robot
  2022-01-24  9:43 ` [PATCH 2/3] net-zerocopy: remove static for tcp_zerocopy_receive() Hao Xu
  2022-01-24  9:43 ` [PATCH 3/3] io_uring: zerocopy receive Hao Xu
  2 siblings, 1 reply; 11+ messages in thread
From: Hao Xu @ 2022-01-24  9:43 UTC (permalink / raw)
  To: netdev, io-uring
  Cc: Jens Axboe, Pavel Begunkov, Eric Dumazet, David S . Miller,
	Jakub Kicinski, Hideaki YOSHIFUJI, David Ahern, Joseph Qi

Split the zerocopy receive code to several parts so that we can use them
easily in other places like io_uring.

Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
---
 include/net/tcp.h |   5 ++
 net/ipv4/tcp.c    | 128 +++++++++++++++++++++++++++-------------------
 2 files changed, 80 insertions(+), 53 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 44e442bf23f9..ba0e7957bdfb 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -419,6 +419,11 @@ void tcp_data_ready(struct sock *sk);
 #ifdef CONFIG_MMU
 int tcp_mmap(struct file *file, struct socket *sock,
 	     struct vm_area_struct *vma);
+int zc_receive_check(struct tcp_zerocopy_receive *zc, int *lenp,
+		     char __user *optval, int __user *optlen);
+int zc_receive_update(struct sock *sk, struct tcp_zerocopy_receive *zc, int len,
+		      char __user *optval, struct scm_timestamping_internal *tss,
+		      int err);
 #endif
 void tcp_parse_options(const struct net *net, const struct sk_buff *skb,
 		       struct tcp_options_received *opt_rx,
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 3b75836db19b..d47e3ccf7cdb 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3936,6 +3936,76 @@ struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk,
 	return stats;
 }
 
+int zc_receive_check(struct tcp_zerocopy_receive *zc, int *lenp,
+		     char __user *optval, int __user *optlen)
+{
+	int len = *lenp, err;
+
+	if (get_user(len, optlen))
+		return -EFAULT;
+	if (len < 0 ||
+	    len < offsetofend(struct tcp_zerocopy_receive, length))
+		return -EINVAL;
+	if (unlikely(len > sizeof(*zc))) {
+		err = check_zeroed_user(optval + sizeof(*zc),
+					len - sizeof(*zc));
+		if (err < 1)
+			return err == 0 ? -EINVAL : err;
+		len = sizeof(*zc);
+		if (put_user(len, optlen))
+			return -EFAULT;
+	}
+	if (copy_from_user(zc, optval, len))
+		return -EFAULT;
+
+	if (zc->reserved)
+		return -EINVAL;
+	if (zc->msg_flags & ~(TCP_VALID_ZC_MSG_FLAGS))
+		return -EINVAL;
+
+	*lenp = len;
+	return 0;
+}
+
+int zc_receive_update(struct sock *sk, struct tcp_zerocopy_receive *zc, int len,
+		      char __user *optval, struct scm_timestamping_internal *tss,
+		      int err)
+{
+	sk_defer_free_flush(sk);
+	if (len >= offsetofend(struct tcp_zerocopy_receive, msg_flags))
+		goto zerocopy_rcv_cmsg;
+	switch (len) {
+	case offsetofend(struct tcp_zerocopy_receive, msg_flags):
+		goto zerocopy_rcv_cmsg;
+	case offsetofend(struct tcp_zerocopy_receive, msg_controllen):
+	case offsetofend(struct tcp_zerocopy_receive, msg_control):
+	case offsetofend(struct tcp_zerocopy_receive, flags):
+	case offsetofend(struct tcp_zerocopy_receive, copybuf_len):
+	case offsetofend(struct tcp_zerocopy_receive, copybuf_address):
+	case offsetofend(struct tcp_zerocopy_receive, err):
+		goto zerocopy_rcv_sk_err;
+	case offsetofend(struct tcp_zerocopy_receive, inq):
+		goto zerocopy_rcv_inq;
+	case offsetofend(struct tcp_zerocopy_receive, length):
+	default:
+		goto zerocopy_rcv_out;
+	}
+zerocopy_rcv_cmsg:
+	if (zc->msg_flags & TCP_CMSG_TS)
+		tcp_zc_finalize_rx_tstamp(sk, zc, tss);
+	else
+		zc->msg_flags = 0;
+zerocopy_rcv_sk_err:
+	if (!err)
+		zc->err = sock_error(sk);
+zerocopy_rcv_inq:
+	zc->inq = tcp_inq_hint(sk);
+zerocopy_rcv_out:
+	if (!err && copy_to_user(optval, zc, len))
+		err = -EFAULT;
+	return err;
+}
+
 static int do_tcp_getsockopt(struct sock *sk, int level,
 		int optname, char __user *optval, int __user *optlen)
 {
@@ -4192,64 +4262,16 @@ static int do_tcp_getsockopt(struct sock *sk, int level,
 		struct tcp_zerocopy_receive zc = {};
 		int err;
 
-		if (get_user(len, optlen))
-			return -EFAULT;
-		if (len < 0 ||
-		    len < offsetofend(struct tcp_zerocopy_receive, length))
-			return -EINVAL;
-		if (unlikely(len > sizeof(zc))) {
-			err = check_zeroed_user(optval + sizeof(zc),
-						len - sizeof(zc));
-			if (err < 1)
-				return err == 0 ? -EINVAL : err;
-			len = sizeof(zc);
-			if (put_user(len, optlen))
-				return -EFAULT;
-		}
-		if (copy_from_user(&zc, optval, len))
-			return -EFAULT;
-		if (zc.reserved)
-			return -EINVAL;
-		if (zc.msg_flags &  ~(TCP_VALID_ZC_MSG_FLAGS))
-			return -EINVAL;
+		err = zc_receive_check(&zc, &len, optval, optlen);
+		if (err)
+			return err;
+
 		lock_sock(sk);
 		err = tcp_zerocopy_receive(sk, &zc, &tss);
 		err = BPF_CGROUP_RUN_PROG_GETSOCKOPT_KERN(sk, level, optname,
 							  &zc, &len, err);
 		release_sock(sk);
-		sk_defer_free_flush(sk);
-		if (len >= offsetofend(struct tcp_zerocopy_receive, msg_flags))
-			goto zerocopy_rcv_cmsg;
-		switch (len) {
-		case offsetofend(struct tcp_zerocopy_receive, msg_flags):
-			goto zerocopy_rcv_cmsg;
-		case offsetofend(struct tcp_zerocopy_receive, msg_controllen):
-		case offsetofend(struct tcp_zerocopy_receive, msg_control):
-		case offsetofend(struct tcp_zerocopy_receive, flags):
-		case offsetofend(struct tcp_zerocopy_receive, copybuf_len):
-		case offsetofend(struct tcp_zerocopy_receive, copybuf_address):
-		case offsetofend(struct tcp_zerocopy_receive, err):
-			goto zerocopy_rcv_sk_err;
-		case offsetofend(struct tcp_zerocopy_receive, inq):
-			goto zerocopy_rcv_inq;
-		case offsetofend(struct tcp_zerocopy_receive, length):
-		default:
-			goto zerocopy_rcv_out;
-		}
-zerocopy_rcv_cmsg:
-		if (zc.msg_flags & TCP_CMSG_TS)
-			tcp_zc_finalize_rx_tstamp(sk, &zc, &tss);
-		else
-			zc.msg_flags = 0;
-zerocopy_rcv_sk_err:
-		if (!err)
-			zc.err = sock_error(sk);
-zerocopy_rcv_inq:
-		zc.inq = tcp_inq_hint(sk);
-zerocopy_rcv_out:
-		if (!err && copy_to_user(optval, &zc, len))
-			err = -EFAULT;
-		return err;
+		return zc_receive_update(sk, &zc, len, optval, &tss, err);
 	}
 #endif
 	default:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/3] net-zerocopy: remove static for tcp_zerocopy_receive()
  2022-01-24  9:43 [RFC 0/3] io_uring zerocopy receive Hao Xu
  2022-01-24  9:43 ` [PATCH 1/3] net-zerocopy: split zerocopy receive to several parts Hao Xu
@ 2022-01-24  9:43 ` Hao Xu
  2022-01-24  9:43 ` [PATCH 3/3] io_uring: zerocopy receive Hao Xu
  2 siblings, 0 replies; 11+ messages in thread
From: Hao Xu @ 2022-01-24  9:43 UTC (permalink / raw)
  To: netdev, io-uring
  Cc: Jens Axboe, Pavel Begunkov, Eric Dumazet, David S . Miller,
	Jakub Kicinski, Hideaki YOSHIFUJI, David Ahern, Joseph Qi

Remove static for tcp_zerocopy_receive() since we are going to
reference it in io_uring.

Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
---
 include/net/tcp.h | 3 +++
 net/ipv4/tcp.c    | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index ba0e7957bdfb..f4108dea6a82 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -424,6 +424,9 @@ int zc_receive_check(struct tcp_zerocopy_receive *zc, int *lenp,
 int zc_receive_update(struct sock *sk, struct tcp_zerocopy_receive *zc, int len,
 		      char __user *optval, struct scm_timestamping_internal *tss,
 		      int err);
+int tcp_zerocopy_receive(struct sock *sk,
+			 struct tcp_zerocopy_receive *zc,
+			 struct scm_timestamping_internal *tss);
 #endif
 void tcp_parse_options(const struct net *net, const struct sk_buff *skb,
 		       struct tcp_options_received *opt_rx,
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index d47e3ccf7cdb..b08a04f58b42 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2066,9 +2066,9 @@ static void tcp_zc_finalize_rx_tstamp(struct sock *sk,
 }
 
 #define TCP_ZEROCOPY_PAGE_BATCH_SIZE 32
-static int tcp_zerocopy_receive(struct sock *sk,
-				struct tcp_zerocopy_receive *zc,
-				struct scm_timestamping_internal *tss)
+int tcp_zerocopy_receive(struct sock *sk,
+			 struct tcp_zerocopy_receive *zc,
+			 struct scm_timestamping_internal *tss)
 {
 	u32 length = 0, offset, vma_len, avail_len, copylen = 0;
 	unsigned long address = (unsigned long)zc->address;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/3] io_uring: zerocopy receive
  2022-01-24  9:43 [RFC 0/3] io_uring zerocopy receive Hao Xu
  2022-01-24  9:43 ` [PATCH 1/3] net-zerocopy: split zerocopy receive to several parts Hao Xu
  2022-01-24  9:43 ` [PATCH 2/3] net-zerocopy: remove static for tcp_zerocopy_receive() Hao Xu
@ 2022-01-24  9:43 ` Hao Xu
  2022-01-24 15:01     ` kernel test robot
  2022-01-24 15:42     ` kernel test robot
  2 siblings, 2 replies; 11+ messages in thread
From: Hao Xu @ 2022-01-24  9:43 UTC (permalink / raw)
  To: netdev, io-uring
  Cc: Jens Axboe, Pavel Begunkov, Eric Dumazet, David S . Miller,
	Jakub Kicinski, Hideaki YOSHIFUJI, David Ahern, Joseph Qi

Integrate the current zerocopy receive solution to io_uring for eazier
use. The current calling process is:
  1) mmap a range of virtual address
  2) poll() to wait for data ready of the sockfd
  3) call getsockopt() to map the address in 1) to physical pages
  4) access the data.

By integrating it to io_uring, 2) and 3) can be merged:
  1) mmap a range of virtual address
  2) prepare a sqe and submit
  3) get a cqe which indicates data is ready and mapped
  4) access the data

which reduce one system call and make users be unaware of 3)

Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
---
 fs/io_uring.c                 | 72 +++++++++++++++++++++++++++++++++++
 include/uapi/linux/io_uring.h |  1 +
 2 files changed, 73 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 422d6de48688..5826d84400f6 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -81,6 +81,7 @@
 #include <linux/tracehook.h>
 #include <linux/audit.h>
 #include <linux/security.h>
+#include <net/tcp.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/io_uring.h>
@@ -581,6 +582,12 @@ struct io_sr_msg {
 	size_t				len;
 };
 
+struct io_recvzc {
+	struct file			*file;
+	char __user			*u_zc;
+	int __user			*u_len;
+};
+
 struct io_open {
 	struct file			*file;
 	int				dfd;
@@ -855,6 +862,7 @@ struct io_kiocb {
 		struct io_mkdir		mkdir;
 		struct io_symlink	symlink;
 		struct io_hardlink	hardlink;
+		struct io_recvzc	recvzc;
 	};
 
 	u8				opcode;
@@ -1105,6 +1113,12 @@ static const struct io_op_def io_op_defs[] = {
 	[IORING_OP_MKDIRAT] = {},
 	[IORING_OP_SYMLINKAT] = {},
 	[IORING_OP_LINKAT] = {},
+	[IORING_OP_RECVZC] = {
+		.needs_file		= 1,
+		.unbound_nonreg_file	= 1,
+		.pollin			= 1,
+		.audit_skip		= 1,
+	},
 };
 
 /* requests with any of those set should undergo io_disarm_next() */
@@ -5243,6 +5257,59 @@ static int io_recv(struct io_kiocb *req, unsigned int issue_flags)
 	return 0;
 }
 
+static int io_recvzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
+{
+	struct io_recvzc *recvzc = &req->recvzc;
+
+#ifndef CONFIG_MMU
+	return -EOPNOTSUPP;
+#endif
+	if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
+		return -EINVAL;
+	if (sqe->ioprio || sqe->len || sqe->buf_index)
+		return -EINVAL;
+
+	recvzc->u_zc = u64_to_user_ptr(READ_ONCE(sqe->addr));
+	recvzc->u_len = u64_to_user_ptr(READ_ONCE(sqe->off));
+
+	return 0;
+}
+
+static int io_recvzc(struct io_kiocb *req, unsigned int issue_flags)
+{
+	struct scm_timestamping_internal tss;
+	struct io_recvzc *recvzc = &req->recvzc;
+	struct tcp_zerocopy_receive zc;
+	char __user *u_zc = recvzc->u_zc;
+	int __user *u_len = recvzc->u_len;
+	int len = 0;
+	struct socket *sock;
+	struct sock *sk;
+	int err;
+
+	if (!(req->flags & REQ_F_POLLED))
+		return -EAGAIN;
+
+	err = zc_receive_check(&zc, &len, u_zc, u_len);
+	if (err)
+		goto out;
+
+	sock = sock_from_file(req->file);
+	if (unlikely(!sock))
+		return -ENOTSOCK;
+
+	sk = sock->sk;
+	lock_sock(sk);
+	err = tcp_zerocopy_receive(sk, &zc, &tss);
+	release_sock(sk);
+	err = zc_receive_update(sk, &zc, len, u_zc, &tss, err);
+
+out:
+	__io_req_complete(req, issue_flags, err, 0);
+
+	return 0;
+}
+
 static int io_accept_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 {
 	struct io_accept *accept = &req->accept;
@@ -6563,6 +6630,8 @@ static int io_req_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 		return io_symlinkat_prep(req, sqe);
 	case IORING_OP_LINKAT:
 		return io_linkat_prep(req, sqe);
+	case IORING_OP_RECVZC:
+		return io_recvzc_prep(req, sqe);
 	}
 
 	printk_once(KERN_WARNING "io_uring: unhandled opcode %d\n",
@@ -6846,6 +6915,9 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags)
 	case IORING_OP_LINKAT:
 		ret = io_linkat(req, issue_flags);
 		break;
+	case IORING_OP_RECVZC:
+		ret = io_recvzc(req, issue_flags);
+		break;
 	default:
 		ret = -EINVAL;
 		break;
diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
index 787f491f0d2a..79eb43c64da2 100644
--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -143,6 +143,7 @@ enum {
 	IORING_OP_MKDIRAT,
 	IORING_OP_SYMLINKAT,
 	IORING_OP_LINKAT,
+	IORING_OP_RECVZC,
 
 	/* this goes last, obviously */
 	IORING_OP_LAST,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] net-zerocopy: split zerocopy receive to several parts
  2022-01-24  9:43 ` [PATCH 1/3] net-zerocopy: split zerocopy receive to several parts Hao Xu
@ 2022-01-24 14:09     ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2022-01-24 14:09 UTC (permalink / raw)
  To: Hao Xu, netdev, io-uring
  Cc: kbuild-all, Jens Axboe, Pavel Begunkov, Eric Dumazet,
	David S . Miller, Jakub Kicinski, Hideaki YOSHIFUJI, David Ahern,
	Joseph Qi

Hi Hao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.17-rc1 next-20220124]
[cannot apply to horms-ipvs/master]
[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]

url:    https://github.com/0day-ci/linux/commits/Hao-Xu/io_uring-zerocopy-receive/20220124-174546
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0
config: sh-randconfig-r012-20220124 (https://download.01.org/0day-ci/archive/20220124/202201242135.NjNu33RA-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/8ed32d9a0fe79a5a05e30772afda62dc96232764
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hao-Xu/io_uring-zerocopy-receive/20220124-174546
        git checkout 8ed32d9a0fe79a5a05e30772afda62dc96232764
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sh SHELL=/bin/bash fs/ net/ipv4/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

>> net/ipv4/tcp.c:3939:5: warning: no previous prototype for 'zc_receive_check' [-Wmissing-prototypes]
    3939 | int zc_receive_check(struct tcp_zerocopy_receive *zc, int *lenp,
         |     ^~~~~~~~~~~~~~~~
   net/ipv4/tcp.c: In function 'zc_receive_check':
>> net/ipv4/tcp.c:3963:31: error: 'TCP_VALID_ZC_MSG_FLAGS' undeclared (first use in this function)
    3963 |         if (zc->msg_flags & ~(TCP_VALID_ZC_MSG_FLAGS))
         |                               ^~~~~~~~~~~~~~~~~~~~~~
   net/ipv4/tcp.c:3963:31: note: each undeclared identifier is reported only once for each function it appears in
   net/ipv4/tcp.c: At top level:
>> net/ipv4/tcp.c:3970:5: warning: no previous prototype for 'zc_receive_update' [-Wmissing-prototypes]
    3970 | int zc_receive_update(struct sock *sk, struct tcp_zerocopy_receive *zc, int len,
         |     ^~~~~~~~~~~~~~~~~
   net/ipv4/tcp.c: In function 'zc_receive_update':
>> net/ipv4/tcp.c:3995:17: error: implicit declaration of function 'tcp_zc_finalize_rx_tstamp' [-Werror=implicit-function-declaration]
    3995 |                 tcp_zc_finalize_rx_tstamp(sk, zc, tss);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/TCP_VALID_ZC_MSG_FLAGS +3963 net/ipv4/tcp.c

  3938	
> 3939	int zc_receive_check(struct tcp_zerocopy_receive *zc, int *lenp,
  3940			     char __user *optval, int __user *optlen)
  3941	{
  3942		int len = *lenp, err;
  3943	
  3944		if (get_user(len, optlen))
  3945			return -EFAULT;
  3946		if (len < 0 ||
  3947		    len < offsetofend(struct tcp_zerocopy_receive, length))
  3948			return -EINVAL;
  3949		if (unlikely(len > sizeof(*zc))) {
  3950			err = check_zeroed_user(optval + sizeof(*zc),
  3951						len - sizeof(*zc));
  3952			if (err < 1)
  3953				return err == 0 ? -EINVAL : err;
  3954			len = sizeof(*zc);
  3955			if (put_user(len, optlen))
  3956				return -EFAULT;
  3957		}
  3958		if (copy_from_user(zc, optval, len))
  3959			return -EFAULT;
  3960	
  3961		if (zc->reserved)
  3962			return -EINVAL;
> 3963		if (zc->msg_flags & ~(TCP_VALID_ZC_MSG_FLAGS))
  3964			return -EINVAL;
  3965	
  3966		*lenp = len;
  3967		return 0;
  3968	}
  3969	
> 3970	int zc_receive_update(struct sock *sk, struct tcp_zerocopy_receive *zc, int len,
  3971			      char __user *optval, struct scm_timestamping_internal *tss,
  3972			      int err)
  3973	{
  3974		sk_defer_free_flush(sk);
  3975		if (len >= offsetofend(struct tcp_zerocopy_receive, msg_flags))
  3976			goto zerocopy_rcv_cmsg;
  3977		switch (len) {
  3978		case offsetofend(struct tcp_zerocopy_receive, msg_flags):
  3979			goto zerocopy_rcv_cmsg;
  3980		case offsetofend(struct tcp_zerocopy_receive, msg_controllen):
  3981		case offsetofend(struct tcp_zerocopy_receive, msg_control):
  3982		case offsetofend(struct tcp_zerocopy_receive, flags):
  3983		case offsetofend(struct tcp_zerocopy_receive, copybuf_len):
  3984		case offsetofend(struct tcp_zerocopy_receive, copybuf_address):
  3985		case offsetofend(struct tcp_zerocopy_receive, err):
  3986			goto zerocopy_rcv_sk_err;
  3987		case offsetofend(struct tcp_zerocopy_receive, inq):
  3988			goto zerocopy_rcv_inq;
  3989		case offsetofend(struct tcp_zerocopy_receive, length):
  3990		default:
  3991			goto zerocopy_rcv_out;
  3992		}
  3993	zerocopy_rcv_cmsg:
  3994		if (zc->msg_flags & TCP_CMSG_TS)
> 3995			tcp_zc_finalize_rx_tstamp(sk, zc, tss);
  3996		else
  3997			zc->msg_flags = 0;
  3998	zerocopy_rcv_sk_err:
  3999		if (!err)
  4000			zc->err = sock_error(sk);
  4001	zerocopy_rcv_inq:
  4002		zc->inq = tcp_inq_hint(sk);
  4003	zerocopy_rcv_out:
  4004		if (!err && copy_to_user(optval, zc, len))
  4005			err = -EFAULT;
  4006		return err;
  4007	}
  4008	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] net-zerocopy: split zerocopy receive to several parts
@ 2022-01-24 14:09     ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2022-01-24 14:09 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5580 bytes --]

Hi Hao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.17-rc1 next-20220124]
[cannot apply to horms-ipvs/master]
[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]

url:    https://github.com/0day-ci/linux/commits/Hao-Xu/io_uring-zerocopy-receive/20220124-174546
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0
config: sh-randconfig-r012-20220124 (https://download.01.org/0day-ci/archive/20220124/202201242135.NjNu33RA-lkp(a)intel.com/config)
compiler: sh4-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/8ed32d9a0fe79a5a05e30772afda62dc96232764
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hao-Xu/io_uring-zerocopy-receive/20220124-174546
        git checkout 8ed32d9a0fe79a5a05e30772afda62dc96232764
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sh SHELL=/bin/bash fs/ net/ipv4/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

>> net/ipv4/tcp.c:3939:5: warning: no previous prototype for 'zc_receive_check' [-Wmissing-prototypes]
    3939 | int zc_receive_check(struct tcp_zerocopy_receive *zc, int *lenp,
         |     ^~~~~~~~~~~~~~~~
   net/ipv4/tcp.c: In function 'zc_receive_check':
>> net/ipv4/tcp.c:3963:31: error: 'TCP_VALID_ZC_MSG_FLAGS' undeclared (first use in this function)
    3963 |         if (zc->msg_flags & ~(TCP_VALID_ZC_MSG_FLAGS))
         |                               ^~~~~~~~~~~~~~~~~~~~~~
   net/ipv4/tcp.c:3963:31: note: each undeclared identifier is reported only once for each function it appears in
   net/ipv4/tcp.c: At top level:
>> net/ipv4/tcp.c:3970:5: warning: no previous prototype for 'zc_receive_update' [-Wmissing-prototypes]
    3970 | int zc_receive_update(struct sock *sk, struct tcp_zerocopy_receive *zc, int len,
         |     ^~~~~~~~~~~~~~~~~
   net/ipv4/tcp.c: In function 'zc_receive_update':
>> net/ipv4/tcp.c:3995:17: error: implicit declaration of function 'tcp_zc_finalize_rx_tstamp' [-Werror=implicit-function-declaration]
    3995 |                 tcp_zc_finalize_rx_tstamp(sk, zc, tss);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/TCP_VALID_ZC_MSG_FLAGS +3963 net/ipv4/tcp.c

  3938	
> 3939	int zc_receive_check(struct tcp_zerocopy_receive *zc, int *lenp,
  3940			     char __user *optval, int __user *optlen)
  3941	{
  3942		int len = *lenp, err;
  3943	
  3944		if (get_user(len, optlen))
  3945			return -EFAULT;
  3946		if (len < 0 ||
  3947		    len < offsetofend(struct tcp_zerocopy_receive, length))
  3948			return -EINVAL;
  3949		if (unlikely(len > sizeof(*zc))) {
  3950			err = check_zeroed_user(optval + sizeof(*zc),
  3951						len - sizeof(*zc));
  3952			if (err < 1)
  3953				return err == 0 ? -EINVAL : err;
  3954			len = sizeof(*zc);
  3955			if (put_user(len, optlen))
  3956				return -EFAULT;
  3957		}
  3958		if (copy_from_user(zc, optval, len))
  3959			return -EFAULT;
  3960	
  3961		if (zc->reserved)
  3962			return -EINVAL;
> 3963		if (zc->msg_flags & ~(TCP_VALID_ZC_MSG_FLAGS))
  3964			return -EINVAL;
  3965	
  3966		*lenp = len;
  3967		return 0;
  3968	}
  3969	
> 3970	int zc_receive_update(struct sock *sk, struct tcp_zerocopy_receive *zc, int len,
  3971			      char __user *optval, struct scm_timestamping_internal *tss,
  3972			      int err)
  3973	{
  3974		sk_defer_free_flush(sk);
  3975		if (len >= offsetofend(struct tcp_zerocopy_receive, msg_flags))
  3976			goto zerocopy_rcv_cmsg;
  3977		switch (len) {
  3978		case offsetofend(struct tcp_zerocopy_receive, msg_flags):
  3979			goto zerocopy_rcv_cmsg;
  3980		case offsetofend(struct tcp_zerocopy_receive, msg_controllen):
  3981		case offsetofend(struct tcp_zerocopy_receive, msg_control):
  3982		case offsetofend(struct tcp_zerocopy_receive, flags):
  3983		case offsetofend(struct tcp_zerocopy_receive, copybuf_len):
  3984		case offsetofend(struct tcp_zerocopy_receive, copybuf_address):
  3985		case offsetofend(struct tcp_zerocopy_receive, err):
  3986			goto zerocopy_rcv_sk_err;
  3987		case offsetofend(struct tcp_zerocopy_receive, inq):
  3988			goto zerocopy_rcv_inq;
  3989		case offsetofend(struct tcp_zerocopy_receive, length):
  3990		default:
  3991			goto zerocopy_rcv_out;
  3992		}
  3993	zerocopy_rcv_cmsg:
  3994		if (zc->msg_flags & TCP_CMSG_TS)
> 3995			tcp_zc_finalize_rx_tstamp(sk, zc, tss);
  3996		else
  3997			zc->msg_flags = 0;
  3998	zerocopy_rcv_sk_err:
  3999		if (!err)
  4000			zc->err = sock_error(sk);
  4001	zerocopy_rcv_inq:
  4002		zc->inq = tcp_inq_hint(sk);
  4003	zerocopy_rcv_out:
  4004		if (!err && copy_to_user(optval, zc, len))
  4005			err = -EFAULT;
  4006		return err;
  4007	}
  4008	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] io_uring: zerocopy receive
  2022-01-24  9:43 ` [PATCH 3/3] io_uring: zerocopy receive Hao Xu
@ 2022-01-24 15:01     ` kernel test robot
  2022-01-24 15:42     ` kernel test robot
  1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2022-01-24 15:01 UTC (permalink / raw)
  To: Hao Xu, netdev, io-uring
  Cc: llvm, kbuild-all, Jens Axboe, Pavel Begunkov, Eric Dumazet,
	David S . Miller, Jakub Kicinski, Hideaki YOSHIFUJI, David Ahern,
	Joseph Qi

Hi Hao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.17-rc1 next-20220124]
[cannot apply to horms-ipvs/master]
[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]

url:    https://github.com/0day-ci/linux/commits/Hao-Xu/io_uring-zerocopy-receive/20220124-174546
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0
config: s390-buildonly-randconfig-r004-20220124 (https://download.01.org/0day-ci/archive/20220124/202201242233.64QOWQZ1-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2e58a18910867ba6795066e044293e6daf89edf5)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/0day-ci/linux/commit/295704165d394635876364522d3ac1451b62da66
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hao-Xu/io_uring-zerocopy-receive/20220124-174546
        git checkout 295704165d394635876364522d3ac1451b62da66
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from fs/io_uring.c:60:
   In file included from include/linux/blk-mq.h:8:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                             ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
   #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
                                                        ^
   In file included from fs/io_uring.c:60:
   In file included from include/linux/blk-mq.h:8:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
   #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
                                                        ^
   In file included from fs/io_uring.c:60:
   In file included from include/linux/blk-mq.h:8:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> fs/io_uring.c:6639:10: error: implicit declaration of function 'io_recvzc_prep' [-Werror,-Wimplicit-function-declaration]
                   return io_recvzc_prep(req, sqe);
                          ^
   fs/io_uring.c:6639:10: note: did you mean 'io_recvmsg_prep'?
   fs/io_uring.c:5462:1: note: 'io_recvmsg_prep' declared here
   IO_NETOP_PREP_ASYNC(recvmsg);
   ^
   fs/io_uring.c:5454:38: note: expanded from macro 'IO_NETOP_PREP_ASYNC'
   #define IO_NETOP_PREP_ASYNC(op)                                         \
                                                                           ^
   fs/io_uring.c:5449:12: note: expanded from macro '\
   IO_NETOP_PREP'
   static int io_##op##_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) \
              ^
   <scratch space>:22:1: note: expanded from here
   io_recvmsg_prep
   ^
>> fs/io_uring.c:6924:9: error: implicit declaration of function 'io_recvzc' [-Werror,-Wimplicit-function-declaration]
                   ret = io_recvzc(req, issue_flags);
                         ^
   fs/io_uring.c:6924:9: note: did you mean 'io_recv'?
   fs/io_uring.c:5466:1: note: 'io_recv' declared here
   IO_NETOP_FN(recv);
   ^
   fs/io_uring.c:5442:12: note: expanded from macro 'IO_NETOP_FN'
   static int io_##op(struct io_kiocb *req, unsigned int issue_flags)      \
              ^
   <scratch space>:34:1: note: expanded from here
   io_recv
   ^
   12 warnings and 2 errors generated.


vim +/io_recvzc_prep +6639 fs/io_uring.c

  6560	
  6561	static int io_req_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
  6562	{
  6563		switch (req->opcode) {
  6564		case IORING_OP_NOP:
  6565			return 0;
  6566		case IORING_OP_READV:
  6567		case IORING_OP_READ_FIXED:
  6568		case IORING_OP_READ:
  6569			return io_read_prep(req, sqe);
  6570		case IORING_OP_WRITEV:
  6571		case IORING_OP_WRITE_FIXED:
  6572		case IORING_OP_WRITE:
  6573			return io_write_prep(req, sqe);
  6574		case IORING_OP_POLL_ADD:
  6575			return io_poll_add_prep(req, sqe);
  6576		case IORING_OP_POLL_REMOVE:
  6577			return io_poll_update_prep(req, sqe);
  6578		case IORING_OP_FSYNC:
  6579			return io_fsync_prep(req, sqe);
  6580		case IORING_OP_SYNC_FILE_RANGE:
  6581			return io_sfr_prep(req, sqe);
  6582		case IORING_OP_SENDMSG:
  6583		case IORING_OP_SEND:
  6584			return io_sendmsg_prep(req, sqe);
  6585		case IORING_OP_RECVMSG:
  6586		case IORING_OP_RECV:
  6587			return io_recvmsg_prep(req, sqe);
  6588		case IORING_OP_CONNECT:
  6589			return io_connect_prep(req, sqe);
  6590		case IORING_OP_TIMEOUT:
  6591			return io_timeout_prep(req, sqe, false);
  6592		case IORING_OP_TIMEOUT_REMOVE:
  6593			return io_timeout_remove_prep(req, sqe);
  6594		case IORING_OP_ASYNC_CANCEL:
  6595			return io_async_cancel_prep(req, sqe);
  6596		case IORING_OP_LINK_TIMEOUT:
  6597			return io_timeout_prep(req, sqe, true);
  6598		case IORING_OP_ACCEPT:
  6599			return io_accept_prep(req, sqe);
  6600		case IORING_OP_FALLOCATE:
  6601			return io_fallocate_prep(req, sqe);
  6602		case IORING_OP_OPENAT:
  6603			return io_openat_prep(req, sqe);
  6604		case IORING_OP_CLOSE:
  6605			return io_close_prep(req, sqe);
  6606		case IORING_OP_FILES_UPDATE:
  6607			return io_rsrc_update_prep(req, sqe);
  6608		case IORING_OP_STATX:
  6609			return io_statx_prep(req, sqe);
  6610		case IORING_OP_FADVISE:
  6611			return io_fadvise_prep(req, sqe);
  6612		case IORING_OP_MADVISE:
  6613			return io_madvise_prep(req, sqe);
  6614		case IORING_OP_OPENAT2:
  6615			return io_openat2_prep(req, sqe);
  6616		case IORING_OP_EPOLL_CTL:
  6617			return io_epoll_ctl_prep(req, sqe);
  6618		case IORING_OP_SPLICE:
  6619			return io_splice_prep(req, sqe);
  6620		case IORING_OP_PROVIDE_BUFFERS:
  6621			return io_provide_buffers_prep(req, sqe);
  6622		case IORING_OP_REMOVE_BUFFERS:
  6623			return io_remove_buffers_prep(req, sqe);
  6624		case IORING_OP_TEE:
  6625			return io_tee_prep(req, sqe);
  6626		case IORING_OP_SHUTDOWN:
  6627			return io_shutdown_prep(req, sqe);
  6628		case IORING_OP_RENAMEAT:
  6629			return io_renameat_prep(req, sqe);
  6630		case IORING_OP_UNLINKAT:
  6631			return io_unlinkat_prep(req, sqe);
  6632		case IORING_OP_MKDIRAT:
  6633			return io_mkdirat_prep(req, sqe);
  6634		case IORING_OP_SYMLINKAT:
  6635			return io_symlinkat_prep(req, sqe);
  6636		case IORING_OP_LINKAT:
  6637			return io_linkat_prep(req, sqe);
  6638		case IORING_OP_RECVZC:
> 6639			return io_recvzc_prep(req, sqe);
  6640		}
  6641	
  6642		printk_once(KERN_WARNING "io_uring: unhandled opcode %d\n",
  6643				req->opcode);
  6644		return -EINVAL;
  6645	}
  6646	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] io_uring: zerocopy receive
@ 2022-01-24 15:01     ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2022-01-24 15:01 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 11209 bytes --]

Hi Hao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.17-rc1 next-20220124]
[cannot apply to horms-ipvs/master]
[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]

url:    https://github.com/0day-ci/linux/commits/Hao-Xu/io_uring-zerocopy-receive/20220124-174546
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0
config: s390-buildonly-randconfig-r004-20220124 (https://download.01.org/0day-ci/archive/20220124/202201242233.64QOWQZ1-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2e58a18910867ba6795066e044293e6daf89edf5)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/0day-ci/linux/commit/295704165d394635876364522d3ac1451b62da66
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hao-Xu/io_uring-zerocopy-receive/20220124-174546
        git checkout 295704165d394635876364522d3ac1451b62da66
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from fs/io_uring.c:60:
   In file included from include/linux/blk-mq.h:8:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                             ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
   #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
                                                        ^
   In file included from fs/io_uring.c:60:
   In file included from include/linux/blk-mq.h:8:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
   #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
                                                        ^
   In file included from fs/io_uring.c:60:
   In file included from include/linux/blk-mq.h:8:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> fs/io_uring.c:6639:10: error: implicit declaration of function 'io_recvzc_prep' [-Werror,-Wimplicit-function-declaration]
                   return io_recvzc_prep(req, sqe);
                          ^
   fs/io_uring.c:6639:10: note: did you mean 'io_recvmsg_prep'?
   fs/io_uring.c:5462:1: note: 'io_recvmsg_prep' declared here
   IO_NETOP_PREP_ASYNC(recvmsg);
   ^
   fs/io_uring.c:5454:38: note: expanded from macro 'IO_NETOP_PREP_ASYNC'
   #define IO_NETOP_PREP_ASYNC(op)                                         \
                                                                           ^
   fs/io_uring.c:5449:12: note: expanded from macro '\
   IO_NETOP_PREP'
   static int io_##op##_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) \
              ^
   <scratch space>:22:1: note: expanded from here
   io_recvmsg_prep
   ^
>> fs/io_uring.c:6924:9: error: implicit declaration of function 'io_recvzc' [-Werror,-Wimplicit-function-declaration]
                   ret = io_recvzc(req, issue_flags);
                         ^
   fs/io_uring.c:6924:9: note: did you mean 'io_recv'?
   fs/io_uring.c:5466:1: note: 'io_recv' declared here
   IO_NETOP_FN(recv);
   ^
   fs/io_uring.c:5442:12: note: expanded from macro 'IO_NETOP_FN'
   static int io_##op(struct io_kiocb *req, unsigned int issue_flags)      \
              ^
   <scratch space>:34:1: note: expanded from here
   io_recv
   ^
   12 warnings and 2 errors generated.


vim +/io_recvzc_prep +6639 fs/io_uring.c

  6560	
  6561	static int io_req_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
  6562	{
  6563		switch (req->opcode) {
  6564		case IORING_OP_NOP:
  6565			return 0;
  6566		case IORING_OP_READV:
  6567		case IORING_OP_READ_FIXED:
  6568		case IORING_OP_READ:
  6569			return io_read_prep(req, sqe);
  6570		case IORING_OP_WRITEV:
  6571		case IORING_OP_WRITE_FIXED:
  6572		case IORING_OP_WRITE:
  6573			return io_write_prep(req, sqe);
  6574		case IORING_OP_POLL_ADD:
  6575			return io_poll_add_prep(req, sqe);
  6576		case IORING_OP_POLL_REMOVE:
  6577			return io_poll_update_prep(req, sqe);
  6578		case IORING_OP_FSYNC:
  6579			return io_fsync_prep(req, sqe);
  6580		case IORING_OP_SYNC_FILE_RANGE:
  6581			return io_sfr_prep(req, sqe);
  6582		case IORING_OP_SENDMSG:
  6583		case IORING_OP_SEND:
  6584			return io_sendmsg_prep(req, sqe);
  6585		case IORING_OP_RECVMSG:
  6586		case IORING_OP_RECV:
  6587			return io_recvmsg_prep(req, sqe);
  6588		case IORING_OP_CONNECT:
  6589			return io_connect_prep(req, sqe);
  6590		case IORING_OP_TIMEOUT:
  6591			return io_timeout_prep(req, sqe, false);
  6592		case IORING_OP_TIMEOUT_REMOVE:
  6593			return io_timeout_remove_prep(req, sqe);
  6594		case IORING_OP_ASYNC_CANCEL:
  6595			return io_async_cancel_prep(req, sqe);
  6596		case IORING_OP_LINK_TIMEOUT:
  6597			return io_timeout_prep(req, sqe, true);
  6598		case IORING_OP_ACCEPT:
  6599			return io_accept_prep(req, sqe);
  6600		case IORING_OP_FALLOCATE:
  6601			return io_fallocate_prep(req, sqe);
  6602		case IORING_OP_OPENAT:
  6603			return io_openat_prep(req, sqe);
  6604		case IORING_OP_CLOSE:
  6605			return io_close_prep(req, sqe);
  6606		case IORING_OP_FILES_UPDATE:
  6607			return io_rsrc_update_prep(req, sqe);
  6608		case IORING_OP_STATX:
  6609			return io_statx_prep(req, sqe);
  6610		case IORING_OP_FADVISE:
  6611			return io_fadvise_prep(req, sqe);
  6612		case IORING_OP_MADVISE:
  6613			return io_madvise_prep(req, sqe);
  6614		case IORING_OP_OPENAT2:
  6615			return io_openat2_prep(req, sqe);
  6616		case IORING_OP_EPOLL_CTL:
  6617			return io_epoll_ctl_prep(req, sqe);
  6618		case IORING_OP_SPLICE:
  6619			return io_splice_prep(req, sqe);
  6620		case IORING_OP_PROVIDE_BUFFERS:
  6621			return io_provide_buffers_prep(req, sqe);
  6622		case IORING_OP_REMOVE_BUFFERS:
  6623			return io_remove_buffers_prep(req, sqe);
  6624		case IORING_OP_TEE:
  6625			return io_tee_prep(req, sqe);
  6626		case IORING_OP_SHUTDOWN:
  6627			return io_shutdown_prep(req, sqe);
  6628		case IORING_OP_RENAMEAT:
  6629			return io_renameat_prep(req, sqe);
  6630		case IORING_OP_UNLINKAT:
  6631			return io_unlinkat_prep(req, sqe);
  6632		case IORING_OP_MKDIRAT:
  6633			return io_mkdirat_prep(req, sqe);
  6634		case IORING_OP_SYMLINKAT:
  6635			return io_symlinkat_prep(req, sqe);
  6636		case IORING_OP_LINKAT:
  6637			return io_linkat_prep(req, sqe);
  6638		case IORING_OP_RECVZC:
> 6639			return io_recvzc_prep(req, sqe);
  6640		}
  6641	
  6642		printk_once(KERN_WARNING "io_uring: unhandled opcode %d\n",
  6643				req->opcode);
  6644		return -EINVAL;
  6645	}
  6646	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] io_uring: zerocopy receive
  2022-01-24  9:43 ` [PATCH 3/3] io_uring: zerocopy receive Hao Xu
@ 2022-01-24 15:42     ` kernel test robot
  2022-01-24 15:42     ` kernel test robot
  1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2022-01-24 15:42 UTC (permalink / raw)
  To: Hao Xu, netdev, io-uring
  Cc: kbuild-all, Jens Axboe, Pavel Begunkov, Eric Dumazet,
	David S . Miller, Jakub Kicinski, Hideaki YOSHIFUJI, David Ahern,
	Joseph Qi

Hi Hao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.17-rc1 next-20220124]
[cannot apply to horms-ipvs/master]
[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]

url:    https://github.com/0day-ci/linux/commits/Hao-Xu/io_uring-zerocopy-receive/20220124-174546
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0
config: h8300-randconfig-r026-20220124 (https://download.01.org/0day-ci/archive/20220124/202201242307.INcQOwqz-lkp@intel.com/config)
compiler: h8300-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/295704165d394635876364522d3ac1451b62da66
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hao-Xu/io_uring-zerocopy-receive/20220124-174546
        git checkout 295704165d394635876364522d3ac1451b62da66
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=h8300 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:20,
                    from fs/io_uring.c:42:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   include/asm-generic/page.h:89:51: warning: ordered comparison of pointer with null pointer [-Wextra]
      89 | #define virt_addr_valid(kaddr)  (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
         |                                                   ^~
   include/linux/compiler.h:78:45: note: in definition of macro 'unlikely'
      78 | # define unlikely(x)    __builtin_expect(!!(x), 0)
         |                                             ^
   include/linux/scatterlist.h:160:9: note: in expansion of macro 'BUG_ON'
     160 |         BUG_ON(!virt_addr_valid(buf));
         |         ^~~~~~
   include/linux/scatterlist.h:160:17: note: in expansion of macro 'virt_addr_valid'
     160 |         BUG_ON(!virt_addr_valid(buf));
         |                 ^~~~~~~~~~~~~~~
   fs/io_uring.c: In function '__io_submit_flush_completions':
   fs/io_uring.c:2537:40: warning: variable 'prev' set but not used [-Wunused-but-set-variable]
    2537 |         struct io_wq_work_node *node, *prev;
         |                                        ^~~~
   fs/io_uring.c: In function 'io_req_prep':
>> fs/io_uring.c:6639:24: error: implicit declaration of function 'io_recvzc_prep'; did you mean 'io_recvmsg_prep'? [-Werror=implicit-function-declaration]
    6639 |                 return io_recvzc_prep(req, sqe);
         |                        ^~~~~~~~~~~~~~
         |                        io_recvmsg_prep
   fs/io_uring.c: In function 'io_issue_sqe':
>> fs/io_uring.c:6924:23: error: implicit declaration of function 'io_recvzc'; did you mean 'io_recv'? [-Werror=implicit-function-declaration]
    6924 |                 ret = io_recvzc(req, issue_flags);
         |                       ^~~~~~~~~
         |                       io_recv
   cc1: some warnings being treated as errors


vim +6639 fs/io_uring.c

  6560	
  6561	static int io_req_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
  6562	{
  6563		switch (req->opcode) {
  6564		case IORING_OP_NOP:
  6565			return 0;
  6566		case IORING_OP_READV:
  6567		case IORING_OP_READ_FIXED:
  6568		case IORING_OP_READ:
  6569			return io_read_prep(req, sqe);
  6570		case IORING_OP_WRITEV:
  6571		case IORING_OP_WRITE_FIXED:
  6572		case IORING_OP_WRITE:
  6573			return io_write_prep(req, sqe);
  6574		case IORING_OP_POLL_ADD:
  6575			return io_poll_add_prep(req, sqe);
  6576		case IORING_OP_POLL_REMOVE:
  6577			return io_poll_update_prep(req, sqe);
  6578		case IORING_OP_FSYNC:
  6579			return io_fsync_prep(req, sqe);
  6580		case IORING_OP_SYNC_FILE_RANGE:
  6581			return io_sfr_prep(req, sqe);
  6582		case IORING_OP_SENDMSG:
  6583		case IORING_OP_SEND:
  6584			return io_sendmsg_prep(req, sqe);
  6585		case IORING_OP_RECVMSG:
  6586		case IORING_OP_RECV:
  6587			return io_recvmsg_prep(req, sqe);
  6588		case IORING_OP_CONNECT:
  6589			return io_connect_prep(req, sqe);
  6590		case IORING_OP_TIMEOUT:
  6591			return io_timeout_prep(req, sqe, false);
  6592		case IORING_OP_TIMEOUT_REMOVE:
  6593			return io_timeout_remove_prep(req, sqe);
  6594		case IORING_OP_ASYNC_CANCEL:
  6595			return io_async_cancel_prep(req, sqe);
  6596		case IORING_OP_LINK_TIMEOUT:
  6597			return io_timeout_prep(req, sqe, true);
  6598		case IORING_OP_ACCEPT:
  6599			return io_accept_prep(req, sqe);
  6600		case IORING_OP_FALLOCATE:
  6601			return io_fallocate_prep(req, sqe);
  6602		case IORING_OP_OPENAT:
  6603			return io_openat_prep(req, sqe);
  6604		case IORING_OP_CLOSE:
  6605			return io_close_prep(req, sqe);
  6606		case IORING_OP_FILES_UPDATE:
  6607			return io_rsrc_update_prep(req, sqe);
  6608		case IORING_OP_STATX:
  6609			return io_statx_prep(req, sqe);
  6610		case IORING_OP_FADVISE:
  6611			return io_fadvise_prep(req, sqe);
  6612		case IORING_OP_MADVISE:
  6613			return io_madvise_prep(req, sqe);
  6614		case IORING_OP_OPENAT2:
  6615			return io_openat2_prep(req, sqe);
  6616		case IORING_OP_EPOLL_CTL:
  6617			return io_epoll_ctl_prep(req, sqe);
  6618		case IORING_OP_SPLICE:
  6619			return io_splice_prep(req, sqe);
  6620		case IORING_OP_PROVIDE_BUFFERS:
  6621			return io_provide_buffers_prep(req, sqe);
  6622		case IORING_OP_REMOVE_BUFFERS:
  6623			return io_remove_buffers_prep(req, sqe);
  6624		case IORING_OP_TEE:
  6625			return io_tee_prep(req, sqe);
  6626		case IORING_OP_SHUTDOWN:
  6627			return io_shutdown_prep(req, sqe);
  6628		case IORING_OP_RENAMEAT:
  6629			return io_renameat_prep(req, sqe);
  6630		case IORING_OP_UNLINKAT:
  6631			return io_unlinkat_prep(req, sqe);
  6632		case IORING_OP_MKDIRAT:
  6633			return io_mkdirat_prep(req, sqe);
  6634		case IORING_OP_SYMLINKAT:
  6635			return io_symlinkat_prep(req, sqe);
  6636		case IORING_OP_LINKAT:
  6637			return io_linkat_prep(req, sqe);
  6638		case IORING_OP_RECVZC:
> 6639			return io_recvzc_prep(req, sqe);
  6640		}
  6641	
  6642		printk_once(KERN_WARNING "io_uring: unhandled opcode %d\n",
  6643				req->opcode);
  6644		return -EINVAL;
  6645	}
  6646	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] io_uring: zerocopy receive
@ 2022-01-24 15:42     ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2022-01-24 15:42 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6969 bytes --]

Hi Hao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.17-rc1 next-20220124]
[cannot apply to horms-ipvs/master]
[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]

url:    https://github.com/0day-ci/linux/commits/Hao-Xu/io_uring-zerocopy-receive/20220124-174546
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0
config: h8300-randconfig-r026-20220124 (https://download.01.org/0day-ci/archive/20220124/202201242307.INcQOwqz-lkp(a)intel.com/config)
compiler: h8300-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/295704165d394635876364522d3ac1451b62da66
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hao-Xu/io_uring-zerocopy-receive/20220124-174546
        git checkout 295704165d394635876364522d3ac1451b62da66
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=h8300 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:20,
                    from fs/io_uring.c:42:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   include/asm-generic/page.h:89:51: warning: ordered comparison of pointer with null pointer [-Wextra]
      89 | #define virt_addr_valid(kaddr)  (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
         |                                                   ^~
   include/linux/compiler.h:78:45: note: in definition of macro 'unlikely'
      78 | # define unlikely(x)    __builtin_expect(!!(x), 0)
         |                                             ^
   include/linux/scatterlist.h:160:9: note: in expansion of macro 'BUG_ON'
     160 |         BUG_ON(!virt_addr_valid(buf));
         |         ^~~~~~
   include/linux/scatterlist.h:160:17: note: in expansion of macro 'virt_addr_valid'
     160 |         BUG_ON(!virt_addr_valid(buf));
         |                 ^~~~~~~~~~~~~~~
   fs/io_uring.c: In function '__io_submit_flush_completions':
   fs/io_uring.c:2537:40: warning: variable 'prev' set but not used [-Wunused-but-set-variable]
    2537 |         struct io_wq_work_node *node, *prev;
         |                                        ^~~~
   fs/io_uring.c: In function 'io_req_prep':
>> fs/io_uring.c:6639:24: error: implicit declaration of function 'io_recvzc_prep'; did you mean 'io_recvmsg_prep'? [-Werror=implicit-function-declaration]
    6639 |                 return io_recvzc_prep(req, sqe);
         |                        ^~~~~~~~~~~~~~
         |                        io_recvmsg_prep
   fs/io_uring.c: In function 'io_issue_sqe':
>> fs/io_uring.c:6924:23: error: implicit declaration of function 'io_recvzc'; did you mean 'io_recv'? [-Werror=implicit-function-declaration]
    6924 |                 ret = io_recvzc(req, issue_flags);
         |                       ^~~~~~~~~
         |                       io_recv
   cc1: some warnings being treated as errors


vim +6639 fs/io_uring.c

  6560	
  6561	static int io_req_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
  6562	{
  6563		switch (req->opcode) {
  6564		case IORING_OP_NOP:
  6565			return 0;
  6566		case IORING_OP_READV:
  6567		case IORING_OP_READ_FIXED:
  6568		case IORING_OP_READ:
  6569			return io_read_prep(req, sqe);
  6570		case IORING_OP_WRITEV:
  6571		case IORING_OP_WRITE_FIXED:
  6572		case IORING_OP_WRITE:
  6573			return io_write_prep(req, sqe);
  6574		case IORING_OP_POLL_ADD:
  6575			return io_poll_add_prep(req, sqe);
  6576		case IORING_OP_POLL_REMOVE:
  6577			return io_poll_update_prep(req, sqe);
  6578		case IORING_OP_FSYNC:
  6579			return io_fsync_prep(req, sqe);
  6580		case IORING_OP_SYNC_FILE_RANGE:
  6581			return io_sfr_prep(req, sqe);
  6582		case IORING_OP_SENDMSG:
  6583		case IORING_OP_SEND:
  6584			return io_sendmsg_prep(req, sqe);
  6585		case IORING_OP_RECVMSG:
  6586		case IORING_OP_RECV:
  6587			return io_recvmsg_prep(req, sqe);
  6588		case IORING_OP_CONNECT:
  6589			return io_connect_prep(req, sqe);
  6590		case IORING_OP_TIMEOUT:
  6591			return io_timeout_prep(req, sqe, false);
  6592		case IORING_OP_TIMEOUT_REMOVE:
  6593			return io_timeout_remove_prep(req, sqe);
  6594		case IORING_OP_ASYNC_CANCEL:
  6595			return io_async_cancel_prep(req, sqe);
  6596		case IORING_OP_LINK_TIMEOUT:
  6597			return io_timeout_prep(req, sqe, true);
  6598		case IORING_OP_ACCEPT:
  6599			return io_accept_prep(req, sqe);
  6600		case IORING_OP_FALLOCATE:
  6601			return io_fallocate_prep(req, sqe);
  6602		case IORING_OP_OPENAT:
  6603			return io_openat_prep(req, sqe);
  6604		case IORING_OP_CLOSE:
  6605			return io_close_prep(req, sqe);
  6606		case IORING_OP_FILES_UPDATE:
  6607			return io_rsrc_update_prep(req, sqe);
  6608		case IORING_OP_STATX:
  6609			return io_statx_prep(req, sqe);
  6610		case IORING_OP_FADVISE:
  6611			return io_fadvise_prep(req, sqe);
  6612		case IORING_OP_MADVISE:
  6613			return io_madvise_prep(req, sqe);
  6614		case IORING_OP_OPENAT2:
  6615			return io_openat2_prep(req, sqe);
  6616		case IORING_OP_EPOLL_CTL:
  6617			return io_epoll_ctl_prep(req, sqe);
  6618		case IORING_OP_SPLICE:
  6619			return io_splice_prep(req, sqe);
  6620		case IORING_OP_PROVIDE_BUFFERS:
  6621			return io_provide_buffers_prep(req, sqe);
  6622		case IORING_OP_REMOVE_BUFFERS:
  6623			return io_remove_buffers_prep(req, sqe);
  6624		case IORING_OP_TEE:
  6625			return io_tee_prep(req, sqe);
  6626		case IORING_OP_SHUTDOWN:
  6627			return io_shutdown_prep(req, sqe);
  6628		case IORING_OP_RENAMEAT:
  6629			return io_renameat_prep(req, sqe);
  6630		case IORING_OP_UNLINKAT:
  6631			return io_unlinkat_prep(req, sqe);
  6632		case IORING_OP_MKDIRAT:
  6633			return io_mkdirat_prep(req, sqe);
  6634		case IORING_OP_SYMLINKAT:
  6635			return io_symlinkat_prep(req, sqe);
  6636		case IORING_OP_LINKAT:
  6637			return io_linkat_prep(req, sqe);
  6638		case IORING_OP_RECVZC:
> 6639			return io_recvzc_prep(req, sqe);
  6640		}
  6641	
  6642		printk_once(KERN_WARNING "io_uring: unhandled opcode %d\n",
  6643				req->opcode);
  6644		return -EINVAL;
  6645	}
  6646	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] net-zerocopy: split zerocopy receive to several parts
@ 2022-01-24 16:44 kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2022-01-24 16:44 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4044 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20220124094320.900713-2-haoxu@linux.alibaba.com>
References: <20220124094320.900713-2-haoxu@linux.alibaba.com>
TO: Hao Xu <haoxu@linux.alibaba.com>
TO: netdev(a)vger.kernel.org
TO: io-uring(a)vger.kernel.org
CC: Jens Axboe <axboe@kernel.dk>
CC: Pavel Begunkov <asml.silence@gmail.com>
CC: Eric Dumazet <edumazet@google.com>
CC: "David S . Miller" <davem@davemloft.net>
CC: Jakub Kicinski <kuba@kernel.org>
CC: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
CC: David Ahern <dsahern@kernel.org>
CC: Joseph Qi <joseph.qi@linux.alibaba.com>

Hi Hao,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.17-rc1 next-20220124]
[cannot apply to horms-ipvs/master]
[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]

url:    https://github.com/0day-ci/linux/commits/Hao-Xu/io_uring-zerocopy-receive/20220124-174546
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0
:::::: branch date: 7 hours ago
:::::: commit date: 7 hours ago
config: x86_64-randconfig-m001-20220124 (https://download.01.org/0day-ci/archive/20220125/202201250056.W4B9lptZ-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/ipv4/tcp.c:3951 zc_receive_check() warn: check for integer overflow 'len'

vim +/len +3951 net/ipv4/tcp.c

1c885808e45601 Francis Yan 2016-11-27  3938  
8ed32d9a0fe79a Hao Xu      2022-01-24  3939  int zc_receive_check(struct tcp_zerocopy_receive *zc, int *lenp,
8ed32d9a0fe79a Hao Xu      2022-01-24  3940  		     char __user *optval, int __user *optlen)
8ed32d9a0fe79a Hao Xu      2022-01-24  3941  {
8ed32d9a0fe79a Hao Xu      2022-01-24  3942  	int len = *lenp, err;
8ed32d9a0fe79a Hao Xu      2022-01-24  3943  
8ed32d9a0fe79a Hao Xu      2022-01-24  3944  	if (get_user(len, optlen))
8ed32d9a0fe79a Hao Xu      2022-01-24  3945  		return -EFAULT;
8ed32d9a0fe79a Hao Xu      2022-01-24  3946  	if (len < 0 ||
8ed32d9a0fe79a Hao Xu      2022-01-24  3947  	    len < offsetofend(struct tcp_zerocopy_receive, length))
8ed32d9a0fe79a Hao Xu      2022-01-24  3948  		return -EINVAL;
8ed32d9a0fe79a Hao Xu      2022-01-24  3949  	if (unlikely(len > sizeof(*zc))) {
8ed32d9a0fe79a Hao Xu      2022-01-24  3950  		err = check_zeroed_user(optval + sizeof(*zc),
8ed32d9a0fe79a Hao Xu      2022-01-24 @3951  					len - sizeof(*zc));
8ed32d9a0fe79a Hao Xu      2022-01-24  3952  		if (err < 1)
8ed32d9a0fe79a Hao Xu      2022-01-24  3953  			return err == 0 ? -EINVAL : err;
8ed32d9a0fe79a Hao Xu      2022-01-24  3954  		len = sizeof(*zc);
8ed32d9a0fe79a Hao Xu      2022-01-24  3955  		if (put_user(len, optlen))
8ed32d9a0fe79a Hao Xu      2022-01-24  3956  			return -EFAULT;
8ed32d9a0fe79a Hao Xu      2022-01-24  3957  	}
8ed32d9a0fe79a Hao Xu      2022-01-24  3958  	if (copy_from_user(zc, optval, len))
8ed32d9a0fe79a Hao Xu      2022-01-24  3959  		return -EFAULT;
8ed32d9a0fe79a Hao Xu      2022-01-24  3960  
8ed32d9a0fe79a Hao Xu      2022-01-24  3961  	if (zc->reserved)
8ed32d9a0fe79a Hao Xu      2022-01-24  3962  		return -EINVAL;
8ed32d9a0fe79a Hao Xu      2022-01-24  3963  	if (zc->msg_flags & ~(TCP_VALID_ZC_MSG_FLAGS))
8ed32d9a0fe79a Hao Xu      2022-01-24  3964  		return -EINVAL;
8ed32d9a0fe79a Hao Xu      2022-01-24  3965  
8ed32d9a0fe79a Hao Xu      2022-01-24  3966  	*lenp = len;
8ed32d9a0fe79a Hao Xu      2022-01-24  3967  	return 0;
8ed32d9a0fe79a Hao Xu      2022-01-24  3968  }
8ed32d9a0fe79a Hao Xu      2022-01-24  3969  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-01-24 16:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-24  9:43 [RFC 0/3] io_uring zerocopy receive Hao Xu
2022-01-24  9:43 ` [PATCH 1/3] net-zerocopy: split zerocopy receive to several parts Hao Xu
2022-01-24 14:09   ` kernel test robot
2022-01-24 14:09     ` kernel test robot
2022-01-24  9:43 ` [PATCH 2/3] net-zerocopy: remove static for tcp_zerocopy_receive() Hao Xu
2022-01-24  9:43 ` [PATCH 3/3] io_uring: zerocopy receive Hao Xu
2022-01-24 15:01   ` kernel test robot
2022-01-24 15:01     ` kernel test robot
2022-01-24 15:42   ` kernel test robot
2022-01-24 15:42     ` kernel test robot
2022-01-24 16:44 [PATCH 1/3] net-zerocopy: split zerocopy receive to several parts kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.