From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A978C10F0E for ; Mon, 15 Apr 2019 17:37:10 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 868312073F for ; Mon, 15 Apr 2019 17:37:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 868312073F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44jbKb3mFTzDqKy for ; Tue, 16 Apr 2019 03:37:07 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=arm.com (client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=catalin.marinas@arm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by lists.ozlabs.org (Postfix) with ESMTP id 44jbHm27dMzDqFM for ; Tue, 16 Apr 2019 03:35:31 +1000 (AEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CD92F80D; Mon, 15 Apr 2019 10:35:27 -0700 (PDT) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.196.78]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2CB893F706; Mon, 15 Apr 2019 10:35:25 -0700 (PDT) Date: Mon, 15 Apr 2019 18:35:22 +0100 From: Catalin Marinas To: Vincenzo Frascino Subject: Re: [PATCH 1/5] arm64: Fix vDSO clock_getres() Message-ID: <20190415173521.GA901@arrakis.emea.arm.com> References: <20190401115152.32751-1-vincenzo.frascino@arm.com> <20190401115152.32751-2-vincenzo.frascino@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190401115152.32751-2-vincenzo.frascino@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Shuah Khan , Arnd Bergmann , Heiko Carstens , Will Deacon , Paul Mackerras , Greentime Hu , Martin Schwidefsky , Thomas Gleixner , Vincent Chen , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Mon, Apr 01, 2019 at 12:51:48PM +0100, Vincenzo Frascino wrote: > diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c > index 2d419006ad43..47ba72345739 100644 > --- a/arch/arm64/kernel/vdso.c > +++ b/arch/arm64/kernel/vdso.c > @@ -245,6 +245,8 @@ void update_vsyscall(struct timekeeper *tk) > vdso_data->cs_shift = tk->tkr_mono.shift; > } > > + vdso_data->hrtimer_res = hrtimer_resolution; > + > smp_wmb(); > ++vdso_data->tb_seq_count; > } > diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S > index c39872a7b03c..7a2cd2f8e13a 100644 > --- a/arch/arm64/kernel/vdso/gettimeofday.S > +++ b/arch/arm64/kernel/vdso/gettimeofday.S > @@ -296,32 +296,35 @@ ENDPROC(__kernel_clock_gettime) > /* int __kernel_clock_getres(clockid_t clock_id, struct timespec *res); */ > ENTRY(__kernel_clock_getres) > .cfi_startproc > + adr vdso_data, _vdso_data > cmp w0, #CLOCK_REALTIME > ccmp w0, #CLOCK_MONOTONIC, #0x4, ne > ccmp w0, #CLOCK_MONOTONIC_RAW, #0x4, ne > - b.ne 1f > + b.ne 2f > > - ldr x2, 5f > - b 2f > -1: > +1: /* Get hrtimer_res */ > + seqcnt_acquire > + syscall_check fail=5f > + ldr x2, [vdso_data, #CLOCK_REALTIME_RES] > + seqcnt_check fail=1b > + b 3f > +2: We talked briefly but I'm still confused why we need the fallback to the syscall here if archdata.vdso_direct is false. Is it because if the timer driver code sets vdso_direct to false, we don't don't support highres timers? If my understanding is correct, you may want to move the hrtimer_res setting in update_vsyscall() to the !use_syscall block. -- Catalin