From patchwork Thu Jun 13 15:11:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raoni Fassina Firmino X-Patchwork-Id: 33107 Received: (qmail 43459 invoked by alias); 13 Jun 2019 15:11:58 -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 43365 invoked by uid 89); 13 Jun 2019 15:11:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.1 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:1803, 2019-05 X-HELO: mx0a-001b2d01.pphosted.com From: Raoni Fassina Firmino To: libc-alpha@sourceware.org Subject: [PATCH 3/4] powerpc: Refactor of _get_timebase_freq Date: Thu, 13 Jun 2019 12:11:44 -0300 In-Reply-To: <20190613151145.22243-1-raoni@linux.ibm.com> References: <20190613151145.22243-1-raoni@linux.ibm.com> MIME-Version: 1.0 x-cbid: 19061315-0004-0000-0000-0000151BDA61 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011255; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01217420; UDB=6.00640188; IPR=6.00998532; MB=3.00027295; MTD=3.00000008; XFM=3.00000015; UTC=2019-06-13 15:11:52 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061315-0005-0000-0000-00008C13261E Message-Id: <20190613151145.22243-4-raoni@linux.ibm.com> Since BZ#19767 is at least fixed for powerpc, we can now use the same code in an agnostic way for static and shared linkage. Also because all vDSO symbol do no fail we can simplify the vDSO calling without most of the wrapper macros. We keep the /proc/cpuinfo parsing as fallback if a kernel is built without vDSO support This implements the solution drafted by Adhemerval Zanella on the mailing list: https://www.sourceware.org/ml/libc-alpha/2019-05/msg00658.html ChangeLog: 2019-06-13 Raoni Fassina Firmino * sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c (__get_timebase_freq): Refactoring. --- sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c index c245e97526..959c311acb 100644 --- a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c +++ b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c @@ -28,12 +28,12 @@ __get_timebase_freq (void) { hp_timing_t result = 0L; -#ifdef SHARED - /* The vDSO does not return an error (it clear cr0.so on returning). */ - INTERNAL_SYSCALL_DECL (err); - result = - INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, uint64_t, 0); -#else + /* The vDSO does not fail (it clears cr0.so on returning). */ + __typeof (VDSO_SYMBOL(get_tbfreq)) vdsop = VDSO_SYMBOL(get_tbfreq); + PTR_DEMANGLE (vdsop); + if (vdsop != NULL) + return vdsop (); + /* We read the information from the /proc filesystem. /proc/cpuinfo contains at least one line like: timebase : 33333333 @@ -99,7 +99,6 @@ __get_timebase_freq (void) } } } -#endif return result; }