This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] [powerpc] Use DIRECT_SYSVIPC_SYSCALLS


From: "Paul A. Clarke" <pc@us.ibm.com>

Support for direct (non-multiplexed) SysV IPC syscalls was added for
powerpc in Linux 5.0.

Support in glibc is already present, but disabled for powerpc.

1. Enable this support for powerpc if glibc is built for kernels >= 5.0.0.
2. Stop passing __IPC_64 bit in associated commands, as this is no longer
   required or expected with this support on powerpc.
3. "semop" is in the set of "SysV IPC" syscalls which are enabled in glibc,
   but semop is not supported on powerpc even in the Linux 5.0 kernel, so
   disable this syscall if __NR_semop is not defined.

2019-10-09  Paul A. Clarke  <pc@us.ibm.com>

	* sysdeps/unix/sysv/linux/powerpc/kernel-features.h: Enable
	(do not disable) __ASSUME_DIRECT_SYSVIPC_SYSCALLS for Linux >= 5.0.0.
	* sysdeps/unix/sysv/linux/powerpc/ipc_priv.h: Nullify __IPC_64
	for Linux >= 5.0.0.
	* sysdeps/unix/sysv/linux/semop.c: Disable DIRECT_SYSCALL unless
	__NR_semop is defined.
---
Tested on openSUSE Tumbleweed 20190814 with kernel 5.1.3-1-default.
A hacked up benchmark (which called msgctl (0,0,0) and thus returned failure,
so basically just testing system call overhead), showed about 12% improvement
in latency.

 sysdeps/unix/sysv/linux/powerpc/ipc_priv.h        | 4 ++++
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 2 ++
 sysdeps/unix/sysv/linux/semop.c                   | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
index 96372bc..e56fcae 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
@@ -18,7 +18,11 @@
 
 #include <sys/ipc.h>  /* For __key_t  */
 
+#if __LINUX_KERNEL_VERSION < 0x050000
 #define __IPC_64	0x100
+#else
+#define __IPC_64	0
+#endif
 
 struct __old_ipc_perm
 {
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index d177a91..b2c824f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -44,8 +44,10 @@
 
 #include_next <kernel-features.h>
 
+#if __LINUX_KERNEL_VERSION < 0x050000
 /* powerpc only supports ipc syscall.  */
 #undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+#endif
 
 #undef __ASSUME_CLONE_DEFAULT
 #define __ASSUME_CLONE_BACKWARDS	1
diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
index 687fdcb..e15bd5e 100644
--- a/sysdeps/unix/sysv/linux/semop.c
+++ b/sysdeps/unix/sysv/linux/semop.c
@@ -26,7 +26,7 @@
 int
 semop (int semid, struct sembuf *sops, size_t nsops)
 {
-#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+#if defined (__ASSUME_DIRECT_SYSVIPC_SYSCALLS) && defined (__NR_semop)
   return INLINE_SYSCALL_CALL (semop, semid, sops, nsops);
 #else
   return INLINE_SYSCALL_CALL (ipc, IPCOP_semop, semid, nsops, 0, sops);
-- 
1.8.3.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]