LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Axtens <dja@axtens.net>
To: Jakub Drnec <jaydee@email.cz>, linuxppc-dev@lists.ozlabs.org
Subject: Re: PROBLEM: monotonic clock going backwards on ppc64
Date: Thu, 28 Feb 2019 17:48:19 +1100	[thread overview]
Message-ID: <87y3601k98.fsf@dja-thinkpad.axtens.net> (raw)
In-Reply-To: <HaC.ZfES.62bwlnvAvMP.1STMMj@seznam.cz>

Hi,

> I think I observed a potential problem, is this the correct place to report it? (CC me, not on list)

Yes

> [1.] One line summary: monotonic clock can be made to decrease on ppc64
> [2.] Full description:
> Setting the realtime clock can sometimes make the monotonic clock go back by over a hundred years.
> Decreasing the realtime clock across the y2k38 threshold is one reliable way to reproduce.
> Allegedly this can also happen just by running ntpd, I have not managed to reproduce that other
> than booting with rtc at >2038 and then running ntp.
> When this happens, anything with timers (e.g. openjdk) breaks rather badly.

I can confirm this on a physical 64bit book3e system and powerpc/next
with the provided reproducer.

> [X.] Other notes, patches, fixes, workarounds:
> The problem seems to be in vDSO code in arch/powerpc/kernel/vdso64/gettimeofday.S.
> (possibly because some values used in the calculation are only 32 bit?)
> Slightly silly workaround: 
> nuke the "cmpwi cr1,r3,CLOCK_MONOTONIC" in __kernel_clock_gettime
> Now it always goes through the syscall fallback which does not have the same problem.

I'll look at the asm but I'm no expert here so we might need to defer to
someone with real expertise. Falling back to the syscall sadly ruins
the performance gain of having a vDSO.

Regards,
Daniel


  reply	other threads:[~2019-02-28  6:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26 16:13 PROBLEM: monotonic clock going backwards on ppc64 Jakub Drnec
2019-02-28  6:48 ` Daniel Axtens [this message]
2019-02-28  7:04 ` Mathieu Malaterre
2019-02-28 11:17   ` Daniel Axtens
2019-03-01 13:33   ` Jakub Drnec
2019-03-01 13:24 ` Michael Ellerman
2019-03-01 23:59   ` 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=87y3601k98.fsf@dja-thinkpad.axtens.net \
    --to=dja@axtens.net \
    --cc=jaydee@email.cz \
    --cc=linuxppc-dev@lists.ozlabs.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