From patchwork Tue Mar 25 23:20:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 283 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (caibbdcaaahb.dreamhost.com [208.113.200.71]) by wilcox.dreamhost.com (Postfix) with ESMTP id 11E633600A6 for ; Tue, 25 Mar 2014 16:20:13 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14307373) id B0FCECB5A0B; Tue, 25 Mar 2014 16:20:12 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx21.g.dreamhost.com 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 homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 8B45FD9B917 for ; Tue, 25 Mar 2014 16:20:12 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version:content-type; q=dns; s=default; b=ZryYq oDBRU5cSIEdJBR7sy2aCs3FWb3EihON77HtzgY1M/BhdBKKertSs7l83LNbEjLbN wb3ahfny8O1Qmzr77TUPYISb7pEXgF8blRvJxIzAOpwux6LSA5jjs8c2vDGGh2K0 Woaf2bIQzMXk0b7vyecGLkKR0mPCe4ycSxhy1g= 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:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version:content-type; s=default; bh=7VvkLfh6AVJ jEV00XT00JtrqYU8=; b=KCPDRSDVZBQZC76lPcJ8SE3DKQ3hvgCL7F6hEaxnW+/ LOAoTJ5tZTcBVJwHUbla0aQZgZGgCxOZtgjO+NziORElhDw4nZvHrcpu6X7vfudy 3ok8bxE1sQwnszJ4nKooC8WhirFPPv47eCea9S2yAoKhKlGyvrKvYYcrPzIjna4I = Received: (qmail 671 invoked by alias); 25 Mar 2014 23:20:10 -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 660 invoked by uid 89); 25 Mar 2014 23:20:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Tue, 25 Mar 2014 23:20:00 +0000 From: "Joseph S. Myers" To: David Miller CC: , , , Subject: Re: Correct robust mutex / PI futex kernel assumptions (bug 9894) In-Reply-To: <20140325.190632.1279135735148309574.davem@davemloft.net> Message-ID: References: <20140325.180932.680988348665832310.davem@davemloft.net> <20140325.190632.1279135735148309574.davem@davemloft.net> MIME-Version: 1.0 X-DH-Original-To: glibc@patchwork.siddhesh.in On Tue, 25 Mar 2014, David Miller wrote: > Actually, it turns out you can simply test for the CPP macro __sparc_v9__ In that case, here is a revised patch using __sparc_v9__ in place of __arch64__. 2014-03-25 Joseph Myers [BZ #9894] * sysdeps/unix/sysv/linux/kernel-features.h [__sparc__ && !__sparc_v9__] (__ASSUME_SET_ROBUST_LIST): Do not define. [__sparc__ && !__sparc_v9__] (__ASSUME_FUTEX_LOCK_PI): Likewise. [__sparc__ && !__sparc_v9__] (__ASSUME_REQUEUE_PI): Likewise. * sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_FUTEX_LOCK_PI): Undefine. (__ASSUME_REQUEUE_PI): Likewise. (__ASSUME_SET_ROBUST_LIST): Likewise. * sysdeps/unix/sysv/linux/m68k/kernel-features.h [__LINUX_KERNEL_VERSION < 0x030a00] (__ASSUME_FUTEX_LOCK_PI): Undefine. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h [__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_FUTEX_LOCK_PI): Likewise. [__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_REQUEUE_PI): Likewise. [__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_SET_ROBUST_LIST): Likewise. * sysdeps/unix/sysv/linux/mips/kernel-features.h [__mips == 1 || _MIPS_ARCH_R5900] (__ASSUME_FUTEX_LOCK_PI): Undefine. [__mips == 1 || _MIPS_ARCH_R5900] (__ASSUME_REQUEUE_PI): Likewise. [__mips == 1 || _MIPS_ARCH_R5900] (__ASSUME_SET_ROBUST_LIST): Likewise. diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h index 401343b..96b7350 100644 --- a/sysdeps/unix/sysv/linux/arm/kernel-features.h +++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h @@ -53,3 +53,10 @@ # undef __ASSUME_PSELECT # undef __ASSUME_PPOLL #endif + +/* The ARM kernel may or may not support + futex_atomic_cmpxchg_inatomic, depending on kernel + configuration. */ +#undef __ASSUME_FUTEX_LOCK_PI +#undef __ASSUME_REQUEUE_PI +#undef __ASSUME_SET_ROBUST_LIST diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 555b82c..a1853c3 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -106,9 +106,12 @@ # define __ASSUME_ATFCTS 1 #endif -/* Support for inter-process robust mutexes was added in 2.6.17. */ +/* Support for inter-process robust mutexes was added in 2.6.17 (but + some architectures lack futex_atomic_cmpxchg_inatomic in some + configurations). */ #if __LINUX_KERNEL_VERSION >= 0x020611 \ - && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613) + && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613) \ + && !(defined __sparc__ && !defined __sparc_v9__) # define __ASSUME_SET_ROBUST_LIST 1 #endif @@ -119,8 +122,10 @@ # define __ASSUME_COMPLETE_READV_WRITEV 1 #endif -/* Support for PI futexes was added in 2.6.18. */ -#if __LINUX_KERNEL_VERSION >= 0x020612 +/* Support for PI futexes was added in 2.6.18 (but some architectures + lack futex_atomic_cmpxchg_inatomic in some configurations). */ +#if __LINUX_KERNEL_VERSION >= 0x020612 \ + && !(defined __sparc__ && !defined __sparc_v9__) # define __ASSUME_FUTEX_LOCK_PI 1 #endif @@ -223,8 +228,11 @@ # define __ASSUME_PWRITEV 1 #endif -/* Support for FUTEX_*_REQUEUE_PI was added in 2.6.31. */ -#if __LINUX_KERNEL_VERSION >= 0x02061f +/* Support for FUTEX_*_REQUEUE_PI was added in 2.6.31 (but some + architectures lack futex_atomic_cmpxchg_inatomic in some + configurations). */ +#if __LINUX_KERNEL_VERSION >= 0x02061f \ + && !(defined __sparc__ && !defined __sparc_v9__) # define __ASSUME_REQUEUE_PI 1 #endif diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h index cb8915f..bc340bd 100644 --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h @@ -48,6 +48,7 @@ /* No support for PI futexes or robust mutexes before 3.10 for m68k. */ #if __LINUX_KERNEL_VERSION < 0x030a00 +# undef __ASSUME_FUTEX_LOCK_PI # undef __ASSUME_REQUEUE_PI # undef __ASSUME_SET_ROBUST_LIST #endif diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h index f9a61a9..a62b839 100644 --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h @@ -43,6 +43,13 @@ #include_next +/* Support for futex_atomic_cmpxchg_inatomic was added in 2.6.33. */ +#if __LINUX_KERNEL_VERSION < 0x020621 +# undef __ASSUME_FUTEX_LOCK_PI +# undef __ASSUME_REQUEUE_PI +# undef __ASSUME_SET_ROBUST_LIST +#endif + /* The MicroBlaze kernel does not support the pselect6, preadv and pwritev syscalls. */ #undef __ASSUME_PSELECT diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h index 52cbf3a..19d3cba 100644 --- a/sysdeps/unix/sysv/linux/mips/kernel-features.h +++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h @@ -53,3 +53,11 @@ #if _MIPS_SIM == _ABIN32 && __LINUX_KERNEL_VERSION < 0x020623 # undef __ASSUME_GETDENTS64_SYSCALL #endif + +/* The MIPS kernel does not support futex_atomic_cmpxchg_inatomic if + emulating LL/SC. */ +#if __mips == 1 || defined _MIPS_ARCH_R5900 +# undef __ASSUME_FUTEX_LOCK_PI +# undef __ASSUME_REQUEUE_PI +# undef __ASSUME_SET_ROBUST_LIST +#endif