From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH 07/27] arm64: Substitute gettimeofday with C implementation Date: Fri, 9 Nov 2018 22:13:50 +0100 Message-ID: References: <20181109123730.8743-1-vincenzo.frascino@arm.com> <20181109123730.8743-8-vincenzo.frascino@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: salyzyn@android.com Cc: linux-arch , Catalin Marinas , Daniel Lezcano , Will Deacon , Russell King - ARM Linux , Ralf Baechle , Paul Burton , Thomas Gleixner , vincenzo.frascino@arm.com, Peter Collingbourne , Linux ARM List-Id: linux-arch.vger.kernel.org On Fri, Nov 9, 2018 at 6:23 PM Mark Salyzyn wrote: > On 11/09/2018 08:13 AM, Arnd Bergmann wrote: > >> diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S > >> index beca249bc2f3..9de0ffc369c5 100644 > >> --- a/arch/arm64/kernel/vdso/vdso.lds.S > >> +++ b/arch/arm64/kernel/vdso/vdso.lds.S > >> @@ -88,6 +88,7 @@ VERSION > >> __kernel_gettimeofday; > >> __kernel_clock_gettime; > >> __kernel_clock_getres; > >> + __kernel_time; > >> local: *; > >> }; > >> } > > I would prefer to not add any deprecated interfaces in the VDSO. If we > > have the 64-bit version of clock_gettime, we don't need the 32-bit version > > of it, and we don't need gettimeofday() or time() either. The C library > > can easily implement those by calling into clock_gettime. > > Alas time() calls are simple and in the order of get_res, the cost of > which is a five fold improvement over the alternate higher resolution calls > (clock_gettime or up to 100 fold on some architectures over gettimeofday). > > We could measure a small improvement in cpu utilization (and thus > battery life by extension) attributed to arm64 Android by calling > __kernel_time over __kernel_clock_gettime with coarse resolution. > > A game of inches admittedly, but super KISS to add, and it is not as-if > __kernel_time existence will cause an issue with deprecation of a system > call entry point. But wouldn't it be much better to fix the application in that case? I can't see any reason why a user would call time() so often that it shows up in CPU profiles, when the result only changes every few billion CPU cycles. Moreover, most architectures cannot return a time64_t from a system call today, so we'd have to change the system call entry points on all of those first to implement the slowpath for a new time64() system call. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-f193.google.com ([209.85.222.193]:46631 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725799AbeKJG42 (ORCPT ); Sat, 10 Nov 2018 01:56:28 -0500 Received: by mail-qk1-f193.google.com with SMTP id q1so4136806qkf.13 for ; Fri, 09 Nov 2018 13:14:07 -0800 (PST) MIME-Version: 1.0 References: <20181109123730.8743-1-vincenzo.frascino@arm.com> <20181109123730.8743-8-vincenzo.frascino@arm.com> In-Reply-To: From: Arnd Bergmann Date: Fri, 9 Nov 2018 22:13:50 +0100 Message-ID: Subject: Re: [PATCH 07/27] arm64: Substitute gettimeofday with C implementation Content-Type: text/plain; charset="UTF-8" Sender: linux-arch-owner@vger.kernel.org List-ID: To: salyzyn@android.com Cc: vincenzo.frascino@arm.com, linux-arch , Linux ARM , Catalin Marinas , Will Deacon , Russell King - ARM Linux , Ralf Baechle , Paul Burton , Daniel Lezcano , Thomas Gleixner , Peter Collingbourne Message-ID: <20181109211350.mPo_aiHTv_LNbrM-HRUI6dwP-rYXcqV0aTutF-l48vo@z> On Fri, Nov 9, 2018 at 6:23 PM Mark Salyzyn wrote: > On 11/09/2018 08:13 AM, Arnd Bergmann wrote: > >> diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S > >> index beca249bc2f3..9de0ffc369c5 100644 > >> --- a/arch/arm64/kernel/vdso/vdso.lds.S > >> +++ b/arch/arm64/kernel/vdso/vdso.lds.S > >> @@ -88,6 +88,7 @@ VERSION > >> __kernel_gettimeofday; > >> __kernel_clock_gettime; > >> __kernel_clock_getres; > >> + __kernel_time; > >> local: *; > >> }; > >> } > > I would prefer to not add any deprecated interfaces in the VDSO. If we > > have the 64-bit version of clock_gettime, we don't need the 32-bit version > > of it, and we don't need gettimeofday() or time() either. The C library > > can easily implement those by calling into clock_gettime. > > Alas time() calls are simple and in the order of get_res, the cost of > which is a five fold improvement over the alternate higher resolution calls > (clock_gettime or up to 100 fold on some architectures over gettimeofday). > > We could measure a small improvement in cpu utilization (and thus > battery life by extension) attributed to arm64 Android by calling > __kernel_time over __kernel_clock_gettime with coarse resolution. > > A game of inches admittedly, but super KISS to add, and it is not as-if > __kernel_time existence will cause an issue with deprecation of a system > call entry point. But wouldn't it be much better to fix the application in that case? I can't see any reason why a user would call time() so often that it shows up in CPU profiles, when the result only changes every few billion CPU cycles. Moreover, most architectures cannot return a time64_t from a system call today, so we'd have to change the system call entry points on all of those first to implement the slowpath for a new time64() system call. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Fri, 9 Nov 2018 22:13:50 +0100 Subject: [PATCH 07/27] arm64: Substitute gettimeofday with C implementation In-Reply-To: References: <20181109123730.8743-1-vincenzo.frascino@arm.com> <20181109123730.8743-8-vincenzo.frascino@arm.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Fri, Nov 9, 2018 at 6:23 PM Mark Salyzyn wrote: > On 11/09/2018 08:13 AM, Arnd Bergmann wrote: > >> diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S > >> index beca249bc2f3..9de0ffc369c5 100644 > >> --- a/arch/arm64/kernel/vdso/vdso.lds.S > >> +++ b/arch/arm64/kernel/vdso/vdso.lds.S > >> @@ -88,6 +88,7 @@ VERSION > >> __kernel_gettimeofday; > >> __kernel_clock_gettime; > >> __kernel_clock_getres; > >> + __kernel_time; > >> local: *; > >> }; > >> } > > I would prefer to not add any deprecated interfaces in the VDSO. If we > > have the 64-bit version of clock_gettime, we don't need the 32-bit version > > of it, and we don't need gettimeofday() or time() either. The C library > > can easily implement those by calling into clock_gettime. > > Alas time() calls are simple and in the order of get_res, the cost of > which is a five fold improvement over the alternate higher resolution calls > (clock_gettime or up to 100 fold on some architectures over gettimeofday). > > We could measure a small improvement in cpu utilization (and thus > battery life by extension) attributed to arm64 Android by calling > __kernel_time over __kernel_clock_gettime with coarse resolution. > > A game of inches admittedly, but super KISS to add, and it is not as-if > __kernel_time existence will cause an issue with deprecation of a system > call entry point. But wouldn't it be much better to fix the application in that case? I can't see any reason why a user would call time() so often that it shows up in CPU profiles, when the result only changes every few billion CPU cycles. Moreover, most architectures cannot return a time64_t from a system call today, so we'd have to change the system call entry points on all of those first to implement the slowpath for a new time64() system call. Arnd