Skip to contentSkip to conversation

Add two new system call mq_recvmmsg() and mq_sendmmsg() to posix ipc mqueue

PATCH Superseded mathura kumar 2 participants 8 messages Aug 16 – Aug 17

Subsystems (20)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add two new system call mq_recvmmsg() and mq_sendmmsg() to posix ipc mqueue

Patch series overview:

1. Add New system call mq_recvmmsg(), mq_sendmmsg() and handler implementation.
2. Add system call number in all most common architectures.
3. Add entries in performance tools.
4. Prepared Documentation and test.

Hi Everyone,

It has been couple of month since last work but yeah I had quite hectic schedule and has been recieved lot of feedback to improve many thing. I am also new in kernel development so its hard in early month to digest lot of subtle things in code, flow etc.
Therefore i have taken time to deep dive..

so now,I will be gratefull if you spend little bit of time in reviewing current work.

Thanks,

change since v2:

- my official mail changed to <[email protected]> from <[email protected]>

- iovec is introduced for arguments.

- since v2 does not contain batch operation and I introduced batch support now in recv or peek, due to that I added one more system call to support batch during send as well otherwise i don't see any benefites of having batching in consumer side only.

- tree is augmented with two new field for improving traversal complexity.

- lot of edges cases got handled like compat layer, Flag check for unkown operation to make it robust and resilient.

- self test is updated
- documentation is updated appropriately.

- v2 Link: https://lore.kernel.org/linux-arch/[email protected]/T/#t

mathura kumar (4):
IPC: Added two new system call mq_recvmmsg() and mq_sendmmsg()
IPC: Added system call entry in all of most common architectures
IPC: Added system call entry in performance tool
Test: Added self-testing and documentation

 Documentation/userspace-api/index.rst         |   2 +
 Documentation/userspace-api/mq_recvmmsg.rst   | 205 +++++++
 Documentation/userspace-api/mq_sendmmsg.rst   | 168 ++++++
 arch/alpha/kernel/syscalls/syscall.tbl        |   2 +
 arch/arm/tools/syscall.tbl                    |   2 +
 arch/arm64/tools/syscall_32.tbl               |   3 +
 arch/m68k/kernel/syscalls/syscall.tbl         |   2 +
 arch/microblaze/kernel/syscalls/syscall.tbl   |   2 +
 arch/mips/kernel/syscalls/syscall_n32.tbl     |   2 +
 arch/mips/kernel/syscalls/syscall_n64.tbl     |   3 +
 arch/mips/kernel/syscalls/syscall_o32.tbl     |   2 +
 arch/parisc/kernel/syscalls/syscall.tbl       |   2 +
 arch/powerpc/kernel/syscalls/syscall.tbl      |   2 +
 arch/s390/kernel/syscalls/syscall.tbl         |   3 +
 arch/sh/kernel/syscalls/syscall.tbl           |   2 +
 arch/sparc/kernel/syscalls/syscall.tbl        |   3 +
 arch/x86/entry/syscalls/syscall_32.tbl        |   2 +
 arch/x86/entry/syscalls/syscall_64.tbl        |   3 +-
 arch/xtensa/kernel/syscalls/syscall.tbl       |   2 +
 include/linux/compat.h                        |  12 +-
 include/linux/syscalls.h                      |   9 +
 include/uapi/asm-generic/unistd.h             |   9 +-
 include/uapi/linux/mqueue.h                   |  27 +-
 ipc/mqueue.c                                  | 568 +++++++++++++++++-
 ipc/msg.c                                     |   2 +-
 ipc/msgutil.c                                 |  45 +-
 ipc/util.h                                    |   3 +-
 kernel/sys_ni.c                               |   6 +
 scripts/syscall.tbl                           |   2 +
 tools/include/uapi/asm-generic/unistd.h       |   8 +-
 .../arch/alpha/entry/syscalls/syscall.tbl     |   4 +
 .../perf/arch/arm/entry/syscalls/syscall.tbl  |   3 +
 .../arch/arm64/entry/syscalls/syscall_32.tbl  |   3 +
 .../arch/mips/entry/syscalls/syscall_n64.tbl  |   2 +
 .../arch/parisc/entry/syscalls/syscall.tbl    |   3 +
 .../arch/powerpc/entry/syscalls/syscall.tbl   |   3 +
 .../perf/arch/s390/entry/syscalls/syscall.tbl |   2 +
 tools/perf/arch/sh/entry/syscalls/syscall.tbl |   2 +
 .../arch/sparc/entry/syscalls/syscall.tbl     |   2 +
 .../arch/x86/entry/syscalls/syscall_32.tbl    |   2 +
 .../arch/x86/entry/syscalls/syscall_64.tbl    |   2 +
 .../arch/xtensa/entry/syscalls/syscall.tbl    |   2 +
 tools/scripts/syscall.tbl                     |   2 +
 tools/testing/selftests/ipc/Makefile          |   2 +-
 tools/testing/selftests/ipc/mq_recvmmsg.c     | 392 ++++++++++++
 tools/testing/selftests/ipc/mq_sendmmsg.c     | 360 +++++++++++
 46 files changed, 1823 insertions(+), 66 deletions(-)
 create mode 100644 Documentation/userspace-api/mq_recvmmsg.rst
 create mode 100644 Documentation/userspace-api/mq_sendmmsg.rst
 create mode 100644 tools/testing/selftests/ipc/mq_recvmmsg.c
 create mode 100644 tools/testing/selftests/ipc/mq_sendmmsg.c
Signature · 1 line
2.43.0
#1 lore raw

PATCH v3 1/4 IPC: Added two new system call mq_recvmmsg() and mq_sendmmsg()

Implement two new POSIX message queue system calls, mq_sendmmsg() and mq_recvmmsg(), analogous to the existing sendmmsg()/recvmmsg() socket system calls. These allow sending and receiving or peek multiple messages in a single syscall,reducing the overhead of repeated context switches per discrete message.

It contains the core implementation of both system calls as part of a larger patchset.

long mq_sendmmsg(mqd_t mqdes, struct mq_mmsg_attrs *attrs,

		   unsigned int attrs_len, unsigned long start_idx,
		   const struct __kernel_timespec *u_abs_timeout);

long mq_recvmmsg(mqd_t mqdes, struct mq_mmsg_attrs *attrs,
unsigned int attrs_len, unsigned int flags, unsigned long start_idx,
const struct __kernel_timespec *u_abs_timeout);

Implementation complete details available under
mq_recvmmsg.rst and mq_sendmmsg.rst

---
 include/linux/compat.h            |  12 +-
 include/linux/syscalls.h          |   9 +
 include/uapi/asm-generic/unistd.h |   9 +-
 include/uapi/linux/mqueue.h       |  27 +-
 ipc/mqueue.c                      | 568 ++++++++++++++++++++++++++++--
 ipc/msg.c                         |   2 +-
 ipc/msgutil.c                     |  45 ++-
 ipc/util.h                        |   3 +-
 kernel/sys_ni.c                   |   6 +
 9 files changed, 618 insertions(+), 63 deletions(-)
include/linux/compat.h +9 -3
index 8da0a15c95f4..cb6cda4aebdd 100644
@@ -18,7 +18,6 @@
 #include <linux/aio_abi.h>	/* for aio_context_t */
 #include <linux/uaccess.h>
 #include <linux/unistd.h>
-
 #include <asm/compat.h>
 #include <asm/siginfo.h>
 #include <asm/signal.h>
@@ -428,6 +427,8 @@ struct compat_sysctl_args;
 struct compat_kexec_segment;
 struct compat_mq_attr;
 struct compat_msgbuf;
+struct compat_msg_attrs;
+struct compat_mq_mmsg_attrs;
 
 void copy_siginfo_to_external32(struct compat_siginfo *to,
 		const struct kernel_siginfo *from);
@@ -805,8 +806,13 @@ asmlinkage long compat_sys_pwritev64v2(unsigned long fd,
 		const struct iovec __user *vec,
 		unsigned long vlen, loff_t pos, rwf_t flags);
 #endif
-
-
+asmlinkage long compat_sys_mq_sendmmsg(mqd_t mqdes, struct compat_mq_mmsg_attrs __user *attrs,
+				      unsigned int attrs_len, unsigned long start_index,
+				      const struct __kernel_timespec __user *abs_timeout);
+asmlinkage long compat_sys_mq_recvmmsg(mqd_t mqdes, struct compat_mq_mmsg_attrs __user *attrs,
+				      unsigned int attrs_len, unsigned int flags,
+				      unsigned long start_index,
+				      const struct __kernel_timespec __user *abs_timeout);
 /*
  * Deprecated system calls which are still defined in
  * include/uapi/asm-generic/unistd.h and wanted by >= 1 arch
include/linux/syscalls.h +9 -0
index 874d9067a43b..0abf938e86da 100644
@@ -79,6 +79,8 @@ struct mnt_id_req;
 struct ns_id_req;
 struct xattr_args;
 struct file_attr;
+struct mq_msg_attrs;
+struct mq_mmsg_attrs;
 
 #include <linux/types.h>
 #include <linux/aio_abi.h>
@@ -739,7 +741,14 @@ asmlinkage long sys_sysinfo(struct sysinfo __user *info);
 asmlinkage long sys_mq_open(const char __user *name, int oflag, umode_t mode, struct mq_attr __user *attr);
 asmlinkage long sys_mq_unlink(const char __user *name);
 asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct __kernel_timespec __user *abs_timeout);
+asmlinkage long sys_mq_sendmmsg(mqd_t mqdes, struct mq_mmsg_attrs __user *attrs,
+				unsigned int attrs_len, unsigned long start_index,
+				const struct __kernel_timespec __user *abs_timeout);
 asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct __kernel_timespec __user *abs_timeout);
+asmlinkage long sys_mq_recvmmsg(mqd_t mqdes, struct mq_mmsg_attrs __user *attrs,
+				unsigned int attrs_len, unsigned int flags,
+				unsigned long start_index,
+				const struct __kernel_timespec __user *abs_timeout);
 asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
 asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
 asmlinkage long sys_mq_timedreceive_time32(mqd_t mqdes,
include/uapi/asm-generic/unistd.h +7 -2
index a627acc8fb5f..1d06486d3aa5 100644
@@ -863,9 +863,14 @@ __SYSCALL(__NR_listns, sys_listns)
 #define __NR_rseq_slice_yield 471
 __SYSCALL(__NR_rseq_slice_yield, sys_rseq_slice_yield)
 
-#undef __NR_syscalls
-#define __NR_syscalls 472
+#define __NR_mq_recvmmsg 472
+__SC_COMP(__NR_mq_recvmmsg, sys_mq_recvmmsg, compat_sys_mq_recvmmsg)
+
+#define __NR_mq_sendmmsg 473
+__SC_COMP(__NR_mq_sendmmsg, sys_mq_sendmmsg, compat_sys_mq_sendmmsg)
 
+#undef __NR_syscalls
+#define __NR_syscalls 474
 /*
  * 32 bit systems traditionally used different
  * syscalls for off_t and loff_t arguments, while
include/uapi/linux/mqueue.h +26 -1
index b516b66840ad..6ce21e41eb18 100644
@@ -18,8 +18,9 @@
 
 #ifndef _LINUX_MQUEUE_H
 #define _LINUX_MQUEUE_H
-
+#include <linux/uio.h>
 #include <linux/types.h>
+#include <linux/compat.h>
 
 #define MQ_PRIO_MAX 	32768
 /* per-uid limit of kernel memory used by mqueue, in bytes */
@@ -33,6 +34,30 @@ struct mq_attr {
 	__kernel_long_t	__reserved[4];	/* ignored for input, zeroed for output */
 };
 
+struct mq_msg_attrs {
+	__kernel_size_t msg_len;
+	unsigned int __user *msg_prio;
+	void __user *msg_ptr;
+};
+
+struct mq_mmsg_attrs {
+	struct iovec __user *msg_attrs_vec;
+	__kernel_size_t vlen;
+	int __user  *ret;
+};
+
+struct compat_msg_attrs {
+	compat_size_t msg_len;
+	compat_uptr_t __user msg_prio;
+	compat_uptr_t __user msg_ptr;
+};
+
+struct compat_mq_mmsg_attrs {
+	compat_uptr_t __user msg_attrs_vec;
+	compat_size_t vlen;
+	compat_uptr_t __user ret;
+};
+
 /*
  * SIGEV_THREAD implementation:
  * SIGEV_THREAD must be implemented in user space. If SIGEV_THREAD is passed
ipc/mqueue.c +537 -31

719 lines not on this page · raw message

ipc/msg.c +1 -1
index 62996b97f0ac..53c1632dc22a 100644
@@ -1156,7 +1156,7 @@ static long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, in
 			 * not update queue parameters.
 			 */
 			if (msgflg & MSG_COPY) {
-				msg = copy_msg(msg, copy);
+				msg = copy_msg(msg, copy, min_t(size_t, bufsz, ns->msg_ctlmax));
 				goto out_unlock0;
 			}
 
ipc/msgutil.c +21 -24

67 lines not on this page · raw message

ipc/util.h +2 -1
index a55d6cebe6d3..374abeee79b3 100644
@@ -197,8 +197,9 @@ int ipc_parse_version(int *cmd);
 
 extern void free_msg(struct msg_msg *msg);
 extern struct msg_msg *load_msg(const void __user *src, size_t len);
-extern struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst);
+extern struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst, size_t len);
 extern int store_msg(void __user *dest, struct msg_msg *msg, size_t len);
+extern struct msg_msg *alloc_msg(size_t len);
 
 static inline int ipc_checkid(struct kern_ipc_perm *ipcp, int id)
 {
kernel/sys_ni.c +6 -0
index add3032da16f..8219d76c72a0 100644
@@ -392,5 +392,11 @@ COND_SYSCALL(setuid16);
 COND_SYSCALL(rseq);
 COND_SYSCALL(rseq_slice_yield);
 
+/* ipc */
+COND_SYSCALL(mq_recvmmsg);
+COND_SYSCALL_COMPAT(mq_recvmmsg);
+COND_SYSCALL(mq_sendmmsg);
+COND_SYSCALL_COMPAT(mq_sendmmsg);
+
 COND_SYSCALL(uretprobe);
 COND_SYSCALL(uprobe);
Signature · 1 line
2.43.0
#2 lore raw

PATCH v3 2/4 IPC: Added system call entry in all of most common architectures

In reply to mathura kumar

Wire up the new syscall numbers for all common architectures in their respective syscall tables.

---
 arch/alpha/kernel/syscalls/syscall.tbl      | 2 ++
 arch/arm/tools/syscall.tbl                  | 2 ++
 arch/arm64/tools/syscall_32.tbl             | 3 +++
 arch/m68k/kernel/syscalls/syscall.tbl       | 2 ++
 arch/microblaze/kernel/syscalls/syscall.tbl | 2 ++
 arch/mips/kernel/syscalls/syscall_n32.tbl   | 2 ++
 arch/mips/kernel/syscalls/syscall_n64.tbl   | 3 +++
 arch/mips/kernel/syscalls/syscall_o32.tbl   | 2 ++
 arch/parisc/kernel/syscalls/syscall.tbl     | 2 ++
 arch/powerpc/kernel/syscalls/syscall.tbl    | 2 ++
 arch/s390/kernel/syscalls/syscall.tbl       | 3 +++
 arch/sh/kernel/syscalls/syscall.tbl         | 2 ++
 arch/sparc/kernel/syscalls/syscall.tbl      | 3 +++
 arch/x86/entry/syscalls/syscall_32.tbl      | 2 ++
 arch/x86/entry/syscalls/syscall_64.tbl      | 3 ++-
 arch/xtensa/kernel/syscalls/syscall.tbl     | 2 ++
 scripts/syscall.tbl                         | 2 ++
 17 files changed, 38 insertions(+), 1 deletion(-)
arch/alpha/kernel/syscalls/syscall.tbl +2 -0
index f31b7afffc34..d3f73725239b 100644
@@ -511,3 +511,5 @@
 579	common	file_setattr			sys_file_setattr
 580	common	listns				sys_listns
 581	common	rseq_slice_yield		sys_rseq_slice_yield
+582	common	mq_recvmmsg			sys_mq_recvmmsg
+583	common	mq_sendmmsg			sys_mq_sendmmsg
arch/arm/tools/syscall.tbl +2 -0
index 94351e22bfcf..ad9080eb5800 100644
@@ -486,3 +486,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg
arch/arm64/tools/syscall_32.tbl +3 -0
index 62d93d88e0fe..7d758c8de10f 100644
@@ -483,3 +483,6 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg		compat_sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg		compat_sys_mq_sendmmsg
+
arch/m68k/kernel/syscalls/syscall.tbl +2 -0
index 248934257101..42e277f7f1bc 100644
@@ -471,3 +471,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg
arch/microblaze/kernel/syscalls/syscall.tbl +2 -0
index 223d26303627..0a4a72d4f112 100644
@@ -477,3 +477,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+473	common	mq_sendmmsg			sys_mq_sendmmsg
+472	common	mq_recvmmsg			sys_mq_recvmmsg
arch/mips/kernel/syscalls/syscall_n32.tbl +2 -0
index 7430714e2b8f..03099ba20103 100644
@@ -410,3 +410,5 @@
 469	n32	file_setattr			sys_file_setattr
 470	n32	listns				sys_listns
 471	n32	rseq_slice_yield		sys_rseq_slice_yield
+472	n32	mq_recvmmsg			compat_sys_mq_recvmmsg
+473	n32	mq_sendmmsg			compat_sys_mq_sendmmsg
arch/mips/kernel/syscalls/syscall_n64.tbl +3 -0
index 630aab9e5425..49b52129b110 100644
@@ -386,3 +386,6 @@
 469	n64	file_setattr			sys_file_setattr
 470	n64	listns				sys_listns
 471	n64	rseq_slice_yield		sys_rseq_slice_yield
+472	n64	mq_recvmmsg			sys_mq_recvmmsg
+473	n64	mq_sendmmsg			sys_mq_sendmmsg
+
arch/mips/kernel/syscalls/syscall_o32.tbl +2 -0
index 128653112284..c26fa87ae06e 100644
@@ -459,3 +459,5 @@
 469	o32	file_setattr			sys_file_setattr
 470	o32	listns				sys_listns
 471	o32	rseq_slice_yield		sys_rseq_slice_yield
+472	o32	mq_recvmmsg			sys_mq_recvmmsg		compat_sys_mq_recvmmsg
+473	o32	mq_sendmmsg			sys_mq_sendmmsg		compat_sys_mq_sendmmsg
arch/parisc/kernel/syscalls/syscall.tbl +2 -0
index c6331dad9461..fd3c4fde3298 100644
@@ -470,3 +470,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg		compat_sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg		compat_sys_mq_sendmmsg
arch/powerpc/kernel/syscalls/syscall.tbl +2 -0
index 4fcc7c58a105..a84355ada041 100644
@@ -562,3 +562,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	nospu	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg		compat_sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg		compat_sys_mq_sendmmsg
arch/s390/kernel/syscalls/syscall.tbl +3 -0
index 09a7ef04d979..a3ce9c216477 100644
@@ -398,3 +398,6 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg
+
arch/sh/kernel/syscalls/syscall.tbl +2 -0
index 70b315cbe710..b14d8f4614c4 100644
@@ -475,3 +475,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg
arch/sparc/kernel/syscalls/syscall.tbl +3 -0
index 7e71bf7fcd14..7ce825b9f531 100644
@@ -517,3 +517,6 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg		compat_sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg		compat_sys_mq_sendmmsg
+
arch/x86/entry/syscalls/syscall_32.tbl +2 -0
index f832ebd2d79b..b40cce591f20 100644
@@ -477,3 +477,5 @@
 469	i386	file_setattr		sys_file_setattr
 470	i386	listns			sys_listns
 471	i386	rseq_slice_yield	sys_rseq_slice_yield
+472	i386	mq_recvmmsg		sys_mq_recvmmsg		compat_sys_mq_recvmmsg
+473	i386	mq_sendmmsg		sys_mq_sendmmsg		compat_sys_mq_sendmmsg
arch/x86/entry/syscalls/syscall_64.tbl +2 -1
index 524155d655da..16b29007e210 100644
@@ -396,7 +396,8 @@
 469	common	file_setattr		sys_file_setattr
 470	common	listns			sys_listns
 471	common	rseq_slice_yield	sys_rseq_slice_yield
-
+472	common	mq_recvmmsg		sys_mq_recvmmsg
+473	common	mq_sendmmsg		sys_mq_sendmmsg
 #
 # Due to a historical design error, certain syscalls are numbered differently
 # in x32 as compared to native x86_64.  These syscalls have numbers 512-547.
arch/xtensa/kernel/syscalls/syscall.tbl +2 -0
index a9bca4e484de..377f27d70a65 100644
@@ -442,3 +442,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg
scripts/syscall.tbl +2 -0
index 7a42b32b6577..8e50ab85b951 100644
@@ -412,3 +412,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg		compat_sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg		compat_sys_mq_sendmmsg
Signature · 1 line
2.43.0
#3 lore raw

PATCH v3 3/4 IPC: Added system call entry in performance tool

In reply to mathura kumar

It include all the entries made up in performance tools for both new system call.

---
 tools/include/uapi/asm-generic/unistd.h             | 8 +++++++-
 tools/perf/arch/alpha/entry/syscalls/syscall.tbl    | 4 ++++
 tools/perf/arch/arm/entry/syscalls/syscall.tbl      | 3 +++
 tools/perf/arch/arm64/entry/syscalls/syscall_32.tbl | 3 +++
 tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl | 2 ++
 tools/perf/arch/parisc/entry/syscalls/syscall.tbl   | 3 +++
 tools/perf/arch/powerpc/entry/syscalls/syscall.tbl  | 3 +++
 tools/perf/arch/s390/entry/syscalls/syscall.tbl     | 2 ++
 tools/perf/arch/sh/entry/syscalls/syscall.tbl       | 2 ++
 tools/perf/arch/sparc/entry/syscalls/syscall.tbl    | 2 ++
 tools/perf/arch/x86/entry/syscalls/syscall_32.tbl   | 2 ++
 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl   | 2 ++
 tools/perf/arch/xtensa/entry/syscalls/syscall.tbl   | 2 ++
 tools/scripts/syscall.tbl                           | 2 ++
 14 files changed, 39 insertions(+), 1 deletion(-)
tools/include/uapi/asm-generic/unistd.h +7 -1
index a627acc8fb5f..b891edfebdf9 100644
@@ -863,8 +863,14 @@ __SYSCALL(__NR_listns, sys_listns)
 #define __NR_rseq_slice_yield 471
 __SYSCALL(__NR_rseq_slice_yield, sys_rseq_slice_yield)
 
+#define __NR_mq_recvmmsg 472
+__SC_COMP(__NR_mq_recvmmsg, sys_mq_recvmmsg, compat_sys_mq_recvmmsg)
+
+#define __NR_mq_sendmmsg 473
+__SC_COMP(__NR_mq_sendmmsg, sys_mq_sendmmsg, compat_sys_mq_sendmmsg)
+
 #undef __NR_syscalls
-#define __NR_syscalls 472
+#define __NR_syscalls 474
 
 /*
  * 32 bit systems traditionally used different
tools/perf/arch/alpha/entry/syscalls/syscall.tbl +4 -0
index 74720667fe09..44cb7657bd44 100644
@@ -502,3 +502,7 @@
 570	common	lsm_set_self_attr		sys_lsm_set_self_attr
 571	common	lsm_list_modules		sys_lsm_list_modules
 572	common  mseal				sys_mseal
+# 573-581 are kept reserved for existing system call
+582	common	mq_recvmmsg			sys_mq_recvmmsg
+583	common	mq_sendmmsg			sys_mq_sendmmsg
+
tools/perf/arch/arm/entry/syscalls/syscall.tbl +3 -0
index 94351e22bfcf..714b3964e31c 100644
@@ -486,3 +486,6 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg
+
tools/perf/arch/arm64/entry/syscalls/syscall_32.tbl +3 -0
index 9a37930d4e26..3d408a842d07 100644
@@ -474,3 +474,6 @@
 460	common	lsm_set_self_attr		sys_lsm_set_self_attr
 461	common	lsm_list_modules		sys_lsm_list_modules
 462	common	mseal				sys_mseal
+# 463-471 are kept reserved for existing system call
+472	common mq_recvmmsg			sys_mq_recvmmsg		compat_sys_mq_recvmmsg
+473	common mq_sendmmsg			sys_mq_sendmmsg		compat_sys_mq_sendmmsg
tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl +2 -0
index 630aab9e5425..de1000dff765 100644
@@ -386,3 +386,5 @@
 469	n64	file_setattr			sys_file_setattr
 470	n64	listns				sys_listns
 471	n64	rseq_slice_yield		sys_rseq_slice_yield
+472	n64	mq_recvmmsg			sys_mq_recvmmsg
+473	n64	mq_sendmmsg			sys_mq_sendmmsg
tools/perf/arch/parisc/entry/syscalls/syscall.tbl +3 -0
index 66dc406b12e4..e1d442f17f25 100644
@@ -461,3 +461,6 @@
 460	common	lsm_set_self_attr		sys_lsm_set_self_attr
 461	common	lsm_list_modules		sys_lsm_list_modules
 462	common	mseal				sys_mseal
+472	common	mq_recvmmsg			sys_mq_recvmmsg		compat_sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg		compat_sys_mq_sendmmsg
+
tools/perf/arch/powerpc/entry/syscalls/syscall.tbl +3 -0
index 4fcc7c58a105..4a9edd38da52 100644
@@ -562,3 +562,6 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	nospu	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg		compat_sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg		compat_sys_mq_sendmmsg
+
tools/perf/arch/s390/entry/syscalls/syscall.tbl +2 -0
index 09a7ef04d979..eba3ed5b7576 100644
@@ -398,3 +398,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg
tools/perf/arch/sh/entry/syscalls/syscall.tbl +2 -0
index 70b315cbe710..b14d8f4614c4 100644
@@ -475,3 +475,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg
tools/perf/arch/sparc/entry/syscalls/syscall.tbl +2 -0
index 7e71bf7fcd14..35ee3651e66c 100644
@@ -517,3 +517,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg		compat_sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg		compat_sys_mq_sendmmsg
tools/perf/arch/x86/entry/syscalls/syscall_32.tbl +2 -0
index f832ebd2d79b..b40cce591f20 100644
@@ -477,3 +477,5 @@
 469	i386	file_setattr		sys_file_setattr
 470	i386	listns			sys_listns
 471	i386	rseq_slice_yield	sys_rseq_slice_yield
+472	i386	mq_recvmmsg		sys_mq_recvmmsg		compat_sys_mq_recvmmsg
+473	i386	mq_sendmmsg		sys_mq_sendmmsg		compat_sys_mq_sendmmsg
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl +2 -0
index 524155d655da..c16fb5d613b2 100644
@@ -396,6 +396,8 @@
 469	common	file_setattr		sys_file_setattr
 470	common	listns			sys_listns
 471	common	rseq_slice_yield	sys_rseq_slice_yield
+472	common	mq_recvmmsg		sys_mq_recvmmsg
+473	common	mq_sendmmsg		sys_mq_sendmmsg
 
 #
 # Due to a historical design error, certain syscalls are numbered differently
tools/perf/arch/xtensa/entry/syscalls/syscall.tbl +2 -0
index a9bca4e484de..377f27d70a65 100644
@@ -442,3 +442,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg
tools/scripts/syscall.tbl +2 -0
index 7a42b32b6577..8e50ab85b951 100644
@@ -412,3 +412,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_recvmmsg			sys_mq_recvmmsg		compat_sys_mq_recvmmsg
+473	common	mq_sendmmsg			sys_mq_sendmmsg		compat_sys_mq_sendmmsg
Signature · 1 line
2.43.0
#4 lore raw

PATCH v3 4/4 Test: Added self-testing and documentation

In reply to mathura kumar

Add test coverage to verify system call behavior under different-different cases.

Update index documentation to include two new doc.
1) mq_recvmmsg.rst
2) mq_sendmmsg.rst

The tests validate:
1) Offset boundries.
2) Partial success behaviors.
3) Timeout behavior.

Documentation changes include:
1) Updated implementation details.
2) Error handlings mechanism.
3) Tests details.

---
 Documentation/userspace-api/index.rst       |   2 +
 Documentation/userspace-api/mq_recvmmsg.rst | 205 ++++++++++
 Documentation/userspace-api/mq_sendmmsg.rst | 168 +++++++++
 tools/testing/selftests/ipc/Makefile        |   2 +-
 tools/testing/selftests/ipc/mq_recvmmsg.c   | 392 ++++++++++++++++++++
 tools/testing/selftests/ipc/mq_sendmmsg.c   | 360 ++++++++++++++++++
 6 files changed, 1128 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/userspace-api/mq_recvmmsg.rst
 create mode 100644 Documentation/userspace-api/mq_sendmmsg.rst
 create mode 100644 tools/testing/selftests/ipc/mq_recvmmsg.c
 create mode 100644 tools/testing/selftests/ipc/mq_sendmmsg.c
Documentation/userspace-api/index.rst +2 -0
index a68b1bea57a8..4e9cbdd8c3a8 100644
@@ -22,6 +22,8 @@ System calls
    ioctl/index
    mseal
    rseq
+   mq_recvmmsg
+   mq_sendmmsg
 
 Security-related interfaces
 ===========================
Documentation/userspace-api/mq_recvmmsg.rst new file +205 -0

205 lines not on this page · raw message

Documentation/userspace-api/mq_sendmmsg.rst new file +168 -0

168 lines not on this page · raw message

tools/testing/selftests/ipc/Makefile +1 -1
index fad10f2bb57b..04da0efd67d7 100644
@@ -12,7 +12,7 @@ endif
 
 CFLAGS += $(KHDR_INCLUDES)
 
-TEST_GEN_PROGS := msgque
+TEST_GEN_PROGS := msgque mq_recvmmsg mq_sendmmsg
 
 include ../lib.mk
 
tools/testing/selftests/ipc/mq_recvmmsg.c new file +392 -0

392 lines not on this page · raw message

tools/testing/selftests/ipc/mq_sendmmsg.c new file +360 -0

360 lines not on this page · raw message

Signature · 1 line
2.43.0
reviewer
#5 lore raw

Re: [PATCH v3 4/4] Test: Added self-testing and documentation

Hi--

Quoted 18 lines · mathura kumar

Add test coverage to verify system call behavior under different-different cases.

Update index documentation to include two new doc.
1) mq_recvmmsg.rst
2) mq_sendmmsg.rst

The tests validate:
1) Offset boundries.
2) Partial success behaviors.
3) Timeout behavior.

Documentation changes include:
1) Updated implementation details.
2) Error handlings mechanism.
3) Tests details.

Quoted 12 lines
---
 Documentation/userspace-api/index.rst       |   2 +
 Documentation/userspace-api/mq_recvmmsg.rst | 205 ++++++++++
 Documentation/userspace-api/mq_sendmmsg.rst | 168 +++++++++
 tools/testing/selftests/ipc/Makefile        |   2 +-
 tools/testing/selftests/ipc/mq_recvmmsg.c   | 392 ++++++++++++++++++++
 tools/testing/selftests/ipc/mq_sendmmsg.c   | 360 ++++++++++++++++++
 6 files changed, 1128 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/userspace-api/mq_recvmmsg.rst
 create mode 100644 Documentation/userspace-api/mq_sendmmsg.rst
 create mode 100644 tools/testing/selftests/ipc/mq_recvmmsg.c
 create mode 100644 tools/testing/selftests/ipc/mq_sendmmsg.c

Documentation build warnings (from 'make htmldocs'):

Documentation/userspace-api/mq_recvmmsg.rst:96: WARNING: Bullet list ends without a blank line; unexpected unindent. [docutils] /work/lnx/repo/linux-next/Documentation/userspace-api/mq_recvmmsg.rst:179: WARNING: Title underline too short.

3.4 start_idx argument
~~~~~~~~~~~~~~~~~~~ [docutils]
Documentation/userspace-api/mq_sendmmsg.rst:77: WARNING: Bullet list ends without a blank line; unexpected unindent. [docutils] /work/lnx/repo/linux-next/Documentation/userspace-api/mq_sendmmsg.rst:146: WARNING: Title underline too short.

3.3 start_idx argument
~~~~~~~~~~~~~~~~~~~ [docutils]

Signature · 1 line
~Randy
#6 lore raw

Re: [PATCH v3 4/4] Test: Added self-testing and documentation

yeah, I have fixed the minor formatting and one unsequenced new sys number for microblaze in syscall.tbl
Should I wait for a complete review for this or send an updated version, and one more thing sashiko show potential regression in core augmentation logic but i think it is false positive and i am pretty sure, as per my intuition i don't think it have any regression regrading propagating msg count after insertion and deletion of node.

Thanks,
Mathura

Quoted 52 lines · Randy Dunlap

Hi--

Quoted 18 lines · mathura kumar

Add test coverage to verify system call behavior under different-different cases.

Update index documentation to include two new doc.
1) mq_recvmmsg.rst
2) mq_sendmmsg.rst

The tests validate:
1) Offset boundries.
2) Partial success behaviors.
3) Timeout behavior.

Documentation changes include:
1) Updated implementation details.
2) Error handlings mechanism.
3) Tests details.

Quoted 12 lines
---
 Documentation/userspace-api/index.rst       |   2 +
 Documentation/userspace-api/mq_recvmmsg.rst | 205 ++++++++++
 Documentation/userspace-api/mq_sendmmsg.rst | 168 +++++++++
 tools/testing/selftests/ipc/Makefile        |   2 +-
 tools/testing/selftests/ipc/mq_recvmmsg.c   | 392 ++++++++++++++++++++
 tools/testing/selftests/ipc/mq_sendmmsg.c   | 360 ++++++++++++++++++
 6 files changed, 1128 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/userspace-api/mq_recvmmsg.rst
 create mode 100644 Documentation/userspace-api/mq_sendmmsg.rst
 create mode 100644 tools/testing/selftests/ipc/mq_recvmmsg.c
 create mode 100644 tools/testing/selftests/ipc/mq_sendmmsg.c

Documentation build warnings (from 'make htmldocs'):

Documentation/userspace-api/mq_recvmmsg.rst:96: WARNING: Bullet list ends without a blank line; unexpected unindent. [docutils] /work/lnx/repo/linux-next/Documentation/userspace-api/mq_recvmmsg.rst:179: WARNING: Title underline too short.

3.4 start_idx argument
~~~~~~~~~~~~~~~~~~~ [docutils]
Documentation/userspace-api/mq_sendmmsg.rst:77: WARNING: Bullet list ends without a blank line; unexpected unindent. [docutils] /work/lnx/repo/linux-next/Documentation/userspace-api/mq_sendmmsg.rst:146: WARNING: Title underline too short.

3.3 start_idx argument
~~~~~~~~~~~~~~~~~~~ [docutils]

--
~Randy

reviewer
#7 lore raw

Re: [PATCH v3 4/4] Test: Added self-testing and documentation

Quoted 8 lines · Mathura kumar

yeah, I have fixed the minor formatting and one unsequenced new sys number for microblaze in syscall.tbl
Should I wait for a complete review for this or send an updated version, and one more thing sashiko show potential regression in core augmentation logic but i think it is false positive and i am pretty sure, as per my intuition i don't think it have any regression regrading propagating msg count after insertion and deletion of node.

I'd say wait for more comments/review.

Quoted 57 lines

Thanks,
Mathura

Quoted 52 lines · Randy Dunlap

Hi--

Quoted 18 lines · mathura kumar

Add test coverage to verify system call behavior under different-different cases.

Update index documentation to include two new doc.
1) mq_recvmmsg.rst
2) mq_sendmmsg.rst

The tests validate:
1) Offset boundries.
2) Partial success behaviors.
3) Timeout behavior.

Documentation changes include:
1) Updated implementation details.
2) Error handlings mechanism.
3) Tests details.

Quoted 12 lines
---
 Documentation/userspace-api/index.rst       |   2 +
 Documentation/userspace-api/mq_recvmmsg.rst | 205 ++++++++++
 Documentation/userspace-api/mq_sendmmsg.rst | 168 +++++++++
 tools/testing/selftests/ipc/Makefile        |   2 +-
 tools/testing/selftests/ipc/mq_recvmmsg.c   | 392 ++++++++++++++++++++
 tools/testing/selftests/ipc/mq_sendmmsg.c   | 360 ++++++++++++++++++
 6 files changed, 1128 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/userspace-api/mq_recvmmsg.rst
 create mode 100644 Documentation/userspace-api/mq_sendmmsg.rst
 create mode 100644 tools/testing/selftests/ipc/mq_recvmmsg.c
 create mode 100644 tools/testing/selftests/ipc/mq_sendmmsg.c

Documentation build warnings (from 'make htmldocs'):

Documentation/userspace-api/mq_recvmmsg.rst:96: WARNING: Bullet list ends without a blank line; unexpected unindent. [docutils] /work/lnx/repo/linux-next/Documentation/userspace-api/mq_recvmmsg.rst:179: WARNING: Title underline too short.

3.4 start_idx argument
~~~~~~~~~~~~~~~~~~~ [docutils]
Documentation/userspace-api/mq_sendmmsg.rst:77: WARNING: Bullet list ends without a blank line; unexpected unindent. [docutils] /work/lnx/repo/linux-next/Documentation/userspace-api/mq_sendmmsg.rst:146: WARNING: Title underline too short.

3.3 start_idx argument
~~~~~~~~~~~~~~~~~~~ [docutils]

--
~Randy

Signature · 1 line
~Randy