From patchwork Wed Oct 9 23:16:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul A. Clarke" X-Patchwork-Id: 1174182 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-105807-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="O8ZdDUHI"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46pVVJ2JQgz9s7T for ; Thu, 10 Oct 2019 10:17:11 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=UyN9w8io50nqmAMTi3sNm9EA+N62kyt/DvLUPTGE12sdA3mBCXHC4 5Jju1A5WipW5wnJaSwmEXP7aU4j0xFJy1rQLHxXqa2C8bYXWbG0Eg42TbMJEPrgP fdmTxyvns7Su9MQ6zrKw9e1st98EIC3uC5wp5VPqZ2wb3EzkbXTrBw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=Zq6J+qm2o1KFYE+BxQkIS2T8yL4=; b=O8ZdDUHIwYmPw4fd3kRYfvDuzIeq 1NrJkTCMv3KfvwewQZcnQwSA2wMHIQTLUu84GJGnztmfNt6X+FSPdqEdpIyniOp+ gap2nbc+fOIVJmTZ7XVykz3Q4xi/PcsFVFTeL4R0CKfDZBE/Cb7EwIQ+jIw2Zu9P 2fmzrqZIdnJ3h9s= Received: (qmail 109522 invoked by alias); 9 Oct 2019 23:17:05 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 109514 invoked by uid 89); 9 Oct 2019 23:17:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:2865, H*F:D*us.ibm.com, Tumbleweed, ipc X-HELO: mx0a-001b2d01.pphosted.com From: "Paul A. Clarke" To: libc-alpha@sourceware.org Cc: tuliom@ascii.art.br Subject: [PATCH] [powerpc] Use DIRECT_SYSVIPC_SYSCALLS Date: Wed, 9 Oct 2019 18:16:53 -0500 Message-Id: <1570663013-10269-1-git-send-email-pc@us.ibm.com> From: "Paul A. Clarke" 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 * 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 /* 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 +#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);