From patchwork Fri Apr 29 07:42:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 11948 Received: (qmail 26163 invoked by alias); 29 Apr 2016 07:42:33 -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 26131 invoked by uid 89); 29 Apr 2016 07:42:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=4810, 48, 10, 29, 6, desire X-HELO: plane.gmane.org To: libc-alpha@sourceware.org From: Stefan Liebler Subject: S390: Add support for vdso getcpu symbol. Date: Fri, 29 Apr 2016 09:42:14 +0200 Lines: 120 Message-ID: Mime-Version: 1.0 X-Mozilla-News-Host: news://news.gmane.org:119 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 Hi, This patch adds support for symbol __kernel_getcpu in vDSO, which is available with kernel 4.5. Now sched_getcpu is using this symbol if available in mapped vDSO by defining macro HAVE_GETCPU_VSYSCALL. If not available at runtime, the former syscall is used. Bye Stefan ChangeLog: * sysdeps/unix/sysv/linux/s390/init-first.c: Add VDSO_SYMBOL(getcpu). (_libc_vdso_platform_setup): Initialize VDSO_SYMBOL(getcpu). * sysdeps/unix/sysv/linux/s390/libc-vdso.h: Add VDSO_SYMBOL(getcpu). * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: New define HAVE_GETCPU_VSYSCALL. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise. commit 47c8c56d61660701e18cf17932a6da1b84fcf789 Author: Stefan Liebler Date: Thu Apr 28 17:30:34 2016 +0200 S390: Add support for vdso getcpu symbol. This patch adds support for symbol __kernel_getcpu in vDSO, which is available with kernel 4.5. Now sched_getcpu is using this symbol if available in mapped vDSO by defining macro HAVE_GETCPU_VSYSCALL. If not available at runtime, the former syscall is used. ChangeLog: * sysdeps/unix/sysv/linux/s390/init-first.c: Add VDSO_SYMBOL(getcpu). (_libc_vdso_platform_setup): Initialize VDSO_SYMBOL(getcpu). * sysdeps/unix/sysv/linux/s390/libc-vdso.h: Add VDSO_SYMBOL(getcpu). * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: New define HAVE_GETCPU_VSYSCALL. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise. diff --git a/sysdeps/unix/sysv/linux/s390/init-first.c b/sysdeps/unix/sysv/linux/s390/init-first.c index d3a20fd..7498cbe 100644 --- a/sysdeps/unix/sysv/linux/s390/init-first.c +++ b/sysdeps/unix/sysv/linux/s390/init-first.c @@ -29,6 +29,8 @@ long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *) long int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *) __attribute__ ((nocommon)); +long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *) + attribute_hidden; static inline void _libc_vdso_platform_setup (void) @@ -46,6 +48,10 @@ _libc_vdso_platform_setup (void) p = _dl_vdso_vsym ("__kernel_clock_getres", &linux2629); PTR_MANGLE (p); VDSO_SYMBOL (clock_getres) = p; + + p = _dl_vdso_vsym ("__kernel_getcpu", &linux2629); + PTR_MANGLE (p); + VDSO_SYMBOL (getcpu) = p; } # define VDSO_SETUP _libc_vdso_platform_setup diff --git a/sysdeps/unix/sysv/linux/s390/libc-vdso.h b/sysdeps/unix/sysv/linux/s390/libc-vdso.h index d2a8316..512b3ba 100644 --- a/sysdeps/unix/sysv/linux/s390/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/s390/libc-vdso.h @@ -31,6 +31,8 @@ extern long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *); extern long int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *); +extern long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *) + attribute_hidden; #endif #endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index 3540416..651e1ee 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -283,6 +283,7 @@ #define HAVE_CLOCK_GETRES_VSYSCALL 1 #define HAVE_CLOCK_GETTIME_VSYSCALL 1 #define HAVE_GETTIMEOFDAY_VSYSCALL 1 +#define HAVE_GETCPU_VSYSCALL 1 /* This version is for internal uses when there is no desire to set errno */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index 6f390ff..702b0b6 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -289,6 +289,7 @@ #define HAVE_CLOCK_GETRES_VSYSCALL 1 #define HAVE_CLOCK_GETTIME_VSYSCALL 1 #define HAVE_GETTIMEOFDAY_VSYSCALL 1 +#define HAVE_GETCPU_VSYSCALL 1 /* This version is for internal uses when there is no desire to set errno */