[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHmME9pVeYBkUX058EA-W4ZkEch=enPsiPioWnkVLK03djuQ9A@mail.gmail.com>
Date: Thu, 13 Jun 2019 18:17:50 +0200
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
Clemens Ladisch <clemens@...isch.de>,
Sultan Alsawaf <sultan@...neltoast.com>,
Waiman Long <longman@...hat.com>, X86 ML <x86@...nel.org>
Subject: Re: infinite loop in read_hpet from ktime_get_boot_fast_ns
Hey Arnd,
On Thu, Jun 13, 2019 at 5:40 PM Arnd Bergmann <arnd@...db.de> wrote:
> A seqlock is a very cheap synchronization primitive, I would actually
> guess that this is faster than most implementations of sched_clock()
> that access a hardware register for reading the time.
It appears to me that ktime_get_coarse_boottime() has a granularity of
a whole second, which is a lot worse than jiffies. Looking at the
source, you assign base but don't then add ns like the other
functions. At first I thought this was an intentional quirk to avoid
hitting the slow hardware paths. But noticing this poor granularity
now and observing that there's actually a blank line (\n\n) where the
nanosecond addition normally would be, I wonder if something was lost
in cut-and-paste?
I'm still poking around trying to see what's up. As a quick test,
running this on every packet during a high speed test shows the left
incrementing many times per second, whereas the right increments once
per second:
static int x = 0;
if (!(x++ % 30000))
pr_err("%llu %llu\n", local_clock(), ktime_get_coarse_boottime());
Jason
Powered by blists - more mailing lists