Generic Linux architectural discussions
 help / color / mirror / Atom feed
From: Vincenzo Frascino <vincenzo.frascino@arm.com>
To: David Miller <davem@davemloft.net>
Cc: linux-arch@vger.kernel.org, arnd@arndb.de,
	catalin.marinas@arm.com, daniel.lezcano@linaro.org,
	will.deacon@arm.com, linux@armlinux.org.uk, ralf@linux-mips.org,
	salyzyn@android.com, paul.burton@mips.com, tglx@linutronix.de,
	pcc@google.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 07/27] arm64: Substitute gettimeofday with C implementation
Date: Wed, 14 Nov 2018 10:22:52 +0000	[thread overview]
Message-ID: <b455064b-4ffe-3ed3-6fa1-ee65e78f054b@arm.com> (raw)
In-Reply-To: <20181109.162920.1263908485037438031.davem@davemloft.net>

Hi David,

thank you for reviewing my code.

On 10/11/2018 00:29, David Miller wrote:
> From: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Date: Fri,  9 Nov 2018 12:37:10 +0000
> 
>> To take advantage of the commonly defined vdso interface for
>> gettimeofday the architectural code requires an adaptation.
>>
>> This patch re-implements the gettimeofday vdso in C in order to use
>> lib/vdso.
>>
>> With the new implementation arm64 gains support for CLOCK_BOOTTIME,
>> CLOCK_TAI and __kernel_time.
>>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will.deacon@arm.com>
>> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> 
> What is the performance penalty for going to C from ASM like this?
> 
> I like the vDSO consolidation, but actually I think it makes a lot of
> sense to implement these things in assembler with some C implementation
> as guidance or for architectures that haven't optimized into an ASM
> version yet.
> 
> I'd also like to see if we can somehow make PowerPC's optimizations in
> this area usable in more places.
> 
> It defines a reciprocal in order to use a multiply instead of a divide
> after capturing the time values.
> > I say all of this because I want to do something similar on sparc, and
> having a generic implementation of all of the math would make that easier
> for me and other architecture maintainers who might want to do the same.
> 

I did run some benchmarks on arm64 with both vdsotest-bench (I added a
script to the vdsotest implementation that can be used to replicate the
results) and an ad-hoc test that stresses the vdso library and the
differences in terms of performance penalty are very little (~1%) to
none in some cases.  

-- 
Regards,
Vincenzo

WARNING: multiple messages have this Message-ID (diff)
From: Vincenzo Frascino <vincenzo.frascino@arm.com>
To: David Miller <davem@davemloft.net>
Cc: linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	catalin.marinas@arm.com, will.deacon@arm.com, arnd@arndb.de,
	linux@armlinux.org.uk, ralf@linux-mips.org, paul.burton@mips.com,
	daniel.lezcano@linaro.org, tglx@linutronix.de,
	salyzyn@android.com, pcc@google.com
Subject: Re: [PATCH 07/27] arm64: Substitute gettimeofday with C implementation
Date: Wed, 14 Nov 2018 10:22:52 +0000	[thread overview]
Message-ID: <b455064b-4ffe-3ed3-6fa1-ee65e78f054b@arm.com> (raw)
Message-ID: <20181114102252.9YOGVQe5dqrpvm9UnAqp7xdEfi3IGSYvkWpUetA8gEI@z> (raw)
In-Reply-To: <20181109.162920.1263908485037438031.davem@davemloft.net>

Hi David,

thank you for reviewing my code.

On 10/11/2018 00:29, David Miller wrote:
> From: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Date: Fri,  9 Nov 2018 12:37:10 +0000
> 
>> To take advantage of the commonly defined vdso interface for
>> gettimeofday the architectural code requires an adaptation.
>>
>> This patch re-implements the gettimeofday vdso in C in order to use
>> lib/vdso.
>>
>> With the new implementation arm64 gains support for CLOCK_BOOTTIME,
>> CLOCK_TAI and __kernel_time.
>>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will.deacon@arm.com>
>> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> 
> What is the performance penalty for going to C from ASM like this?
> 
> I like the vDSO consolidation, but actually I think it makes a lot of
> sense to implement these things in assembler with some C implementation
> as guidance or for architectures that haven't optimized into an ASM
> version yet.
> 
> I'd also like to see if we can somehow make PowerPC's optimizations in
> this area usable in more places.
> 
> It defines a reciprocal in order to use a multiply instead of a divide
> after capturing the time values.
> > I say all of this because I want to do something similar on sparc, and
> having a generic implementation of all of the math would make that easier
> for me and other architecture maintainers who might want to do the same.
> 

I did run some benchmarks on arm64 with both vdsotest-bench (I added a
script to the vdsotest implementation that can be used to replicate the
results) and an ad-hoc test that stresses the vdso library and the
differences in terms of performance penalty are very little (~1%) to
none in some cases.  

-- 
Regards,
Vincenzo

  parent reply	other threads:[~2018-11-14 10:22 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09 12:37 [PATCH 00/27] Unify vDSOs across more architectures Vincenzo Frascino
2018-11-09 12:37 ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 01/27] kernel: Standardize vdso_datapage Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 02/27] kernel: Add Monotonic boot time support Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 03/27] kernel: Add International Atomic Time support Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 04/27] kernel: Add masks support for Raw and NTP time Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 05/27] kernel: Add clock_mode support Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 06/27] kernel: Define gettimeofday vdso common code Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 16:05   ` Arnd Bergmann
2018-11-09 16:05     ` Arnd Bergmann
2018-11-13 10:21     ` Vincenzo Frascino
2018-11-13 10:21       ` Vincenzo Frascino
2018-11-10 16:18   ` Arnd Bergmann
2018-11-10 16:18     ` Arnd Bergmann
2018-11-13 10:24     ` Vincenzo Frascino
2018-11-13 10:24       ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 07/27] arm64: Substitute gettimeofday with C implementation Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 16:13   ` Arnd Bergmann
2018-11-09 16:13     ` Arnd Bergmann
2018-11-09 17:23     ` Mark Salyzyn
2018-11-09 17:23       ` Mark Salyzyn
2018-11-09 21:13       ` Arnd Bergmann
2018-11-09 21:13         ` Arnd Bergmann
2018-11-13 10:58     ` Vincenzo Frascino
2018-11-13 10:58       ` Vincenzo Frascino
2018-11-14 17:47       ` Arnd Bergmann
2018-11-14 17:47         ` Arnd Bergmann
2018-11-23 10:49         ` Vincenzo Frascino
2018-11-23 10:49           ` Vincenzo Frascino
2018-11-23 11:14           ` Arnd Bergmann
2018-11-23 11:14             ` Arnd Bergmann
2018-11-09 18:09   ` Peter Collingbourne
2018-11-09 18:09     ` Peter Collingbourne
2018-11-13 10:36     ` Vincenzo Frascino
2018-11-13 10:36       ` Vincenzo Frascino
2018-11-10  0:29   ` David Miller
2018-11-10  0:29     ` David Miller
2018-11-12 18:21     ` Mark Salyzyn
2018-11-12 18:21       ` Mark Salyzyn
2018-11-14 10:22     ` Vincenzo Frascino [this message]
2018-11-14 10:22       ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 08/27] arm64: compat: Alloc separate pages for vectors and sigpage Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 09/27] arm64: compat: Split kuser32 Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 10/27] arm64: compat: Refactor aarch32_alloc_vdso_pages() Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 11/27] arm64: compat: Add KUSER_HELPERS config option Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 12/27] arm64: compat: Add missing syscall numbers Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 13/27] arm64: compat: Expose signal related structures Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 14/27] arm64: compat: Generate asm offsets for signals Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 15/27] lib: vdso: Add compat support Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 16/27] arm64: compat: Add vDSO Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 16:23   ` Arnd Bergmann
2018-11-09 16:23     ` Arnd Bergmann
2018-11-09 12:37 ` [PATCH 17/27] arm64: Refactor vDSO code Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 18/27] arm64: compat: vDSO setup for compat layer Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 19/27] arm64: elf: vDSO code page discovery Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 20/27] arm64: compat: Get sigreturn trampolines from vDSO Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 21/27] arm64: Add vDSO compat support Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 22/27] arm64: Enable compat vDSO support Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 23/27] arm: Add support for generic vDSO Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 16:27   ` Arnd Bergmann
2018-11-09 16:27     ` Arnd Bergmann
2018-11-09 12:37 ` [PATCH 24/27] mips: Introduce vdso_direct Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 25/27] clock: csrc-4k: Add support for vdso_direct Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 26/27] clock: gic-timer: " Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-09 12:37 ` [PATCH 27/27] mips: Add support for generic vDSO Vincenzo Frascino
2018-11-09 12:37   ` Vincenzo Frascino
2018-11-10 16:33 ` [PATCH 00/27] Unify vDSOs across more architectures Arnd Bergmann
2018-11-10 16:33   ` Arnd Bergmann
2018-11-23 11:05   ` Vincenzo Frascino
2018-11-23 11:05     ` Vincenzo Frascino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b455064b-4ffe-3ed3-6fa1-ee65e78f054b@arm.com \
    --to=vincenzo.frascino@arm.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=davem@davemloft.net \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=paul.burton@mips.com \
    --cc=pcc@google.com \
    --cc=ralf@linux-mips.org \
    --cc=salyzyn@android.com \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox