mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Andreas Larsson" <andreas@gaisler.com>,
	"John Paul Adrian Glaubitz" <glaubitz@physik.fu-berlin.de>,
	"Arnd Bergmann" <arnd@kernel.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
	"David S . Miller" <davem@davemloft.net>
Cc: "Andy Lutomirski" <luto@kernel.org>,
	"Vincenzo Frascino" <vincenzo.frascino@arm.com>,
	shuah <shuah@kernel.org>,
	"Anna-Maria Gleixner" <anna-maria@linutronix.de>,
	"Frederic Weisbecker" <frederic@kernel.org>,
	"John Stultz" <jstultz@google.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Eric Biggers" <ebiggers@google.com>,
	sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] vdso: sparc: stub out custom vdso implementation
Date: Fri, 11 Jul 2025 12:31:44 +0200	[thread overview]
Message-ID: <ba62bc7b-fa3e-4f34-a966-cc734468b8ef@app.fastmail.com> (raw)
In-Reply-To: <7e29bcc1-3dc7-40f8-84f0-fbe497fb01bf@gaisler.com>

On Thu, Jul 10, 2025, at 18:22, Andreas Larsson wrote:
> On 2025-07-07 18:05, John Paul Adrian Glaubitz wrote:
>> On Mon, 2025-07-07 at 17:45 +0200, Arnd Bergmann wrote:
>>> On Mon, Jul 7, 2025, at 17:22, John Paul Adrian Glaubitz wrote:
>>>>
>>>> On Mon, 2025-07-07 at 16:46 +0200, Arnd Bergmann wrote:
>>>>> Rip out the whole thing and replace it with a minimal stub as we do
>>>>> on parisc and uml. This introduces a small performance regression when
>>>>> using a libc that is aware of the vdso (glibc-2.29 or higher).
>>>>
>>>> Can this performance hit quantified in any way?
>>>
>>> It's trivial to test calling glibc clock_gettime() in a loop
>>> on a specific piece of hardware, the difference should largely
>>> depend on how long the timer hardware access takes compared
>>> to the syscall overhead.
>>>
>>> On machines that have neither TICK nor STICK clocksource, the
>>> simpler version should even be minimally faster, on those that
>>> have one of the two, there is an added cost for entering the
>>> syscall on every clock_gettime() as we do on architectures without
>>> vdso.
>> 
>> OK, thanks. Since Andreas has access to a SPARC T4 as of recently, he should
>> be able to test this. Please allow some time for him to review and test the
>> changes, so we can be sure this doesn't cause any serious regressions.
>
> I tested this patch (running Linux in an LDOM under Solaris) and
> measuring the cost of clock_gettime(), running millions of calls. The
> calls takes around 13-15 times as long (from around 82-94 nanoseconds
> per call to around 1220 nanoseconds per call) with this patch compared
> to without, so not an insignificant performance regression in this
> environment.

Ok, thanks a lot for testing! I guess the good news is that I didn't
break functionality here.

Obviously 15x slowdown sounds like a lot, but what I don't know is
whether 1.2µs is actually too slow. Is this CLOCK_REALTIME or some
other clock? I would expect to see a larger difference for the
COARSE version since that saves the hardware access as well.

From what I remember, the original driver for having a VDSO
clock_gettime/gettimeofday was Java applications that call it
too often. Do you know of anyone using Java on performance-critical
sparc64 servers any more, or any other type of workload that
depends on these functions being small?

It is probably not all that hard to convert the VDSO to use the
generic implementation if you remove the runtime patching between
TICK and STICK mode. From the code and the documentation, it
seems that any JPS1 compatible CPU (or newer) uses STICK,
this would be UltraSPARC III (Cheetah), SPARC64 V (Zeus)
and all UltraSPARC T. If you want to give it a try to do the
conversion to the generic VDSO, I could respin my patch to only
remove the older TICK version and the runtime patching but leave
the STICK one. I don't think it's worth my time trying to convert
STICK myself since I have no way of testing it.

Another option would be to start by adding a VDSO for LEON
CPUs using the ASR22:23 upcounter register. This should be
fairly easy to do if you copy the CSR_TIME code from riscv
and replace their __arch_get_hw_counter(), and this is probably more
relevant than the sparc64 version. Once that works, you
can extend it to use STICK on JPS1.

     Arnd

  reply	other threads:[~2025-07-11 10:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-07 14:46 Arnd Bergmann
2025-07-07 14:46 ` [PATCH 2/2] clocksource: remove ARCH_CLOCKSOURCE_DATA Arnd Bergmann
2025-07-07 17:31   ` John Stultz
2025-07-07 15:22 ` [PATCH 1/2] vdso: sparc: stub out custom vdso implementation John Paul Adrian Glaubitz
2025-07-07 15:45   ` Arnd Bergmann
2025-07-07 16:05     ` John Paul Adrian Glaubitz
2025-07-10 16:22       ` Andreas Larsson
2025-07-11 10:31         ` Arnd Bergmann [this message]
2025-07-14  8:40           ` John Paul Adrian Glaubitz
2025-07-21 21:12           ` Thomas Gleixner
2025-07-08  5:39 ` Thomas Weißschuh
2025-07-08  6:40   ` Arnd Bergmann
2025-07-08  7:13     ` Thomas Weißschuh
2025-07-23 10:57 ` Thomas Weißschuh
2025-07-23 11:10   ` John Paul Adrian Glaubitz
2025-07-23 17:24   ` Thomas Gleixner

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=ba62bc7b-fa3e-4f34-a966-cc734468b8ef@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=andreas@gaisler.com \
    --cc=anna-maria@linutronix.de \
    --cc=arnd@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=davem@davemloft.net \
    --cc=ebiggers@google.com \
    --cc=frederic@kernel.org \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=shuah@kernel.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=vincenzo.frascino@arm.com \
    --cc=will@kernel.org \
    /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

all inboxes | Powered by JetHome®