lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 23 Nov 2016 09:59:32 +0100 (CET)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Joel Fernandes <joelaf@...gle.com>
cc:     LKML <linux-kernel@...r.kernel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        John Stultz <john.stultz@...aro.org>,
        Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH v2 1/2] timekeeping: Introduce a fast boot clock derived
 from fast monotonic clock

On Tue, 22 Nov 2016, Joel Fernandes wrote:
> On Tue, Nov 22, 2016 at 2:29 PM, Thomas Gleixner <tglx@...utronix.de> wrote:
> > What's wrong with adding a tracepoint into the boot offset update function
> > and let perf or the tracer inject the value of the boot offset into the
> > trace data when starting. The time adjustment can be done in
> > postprocessing.
> 
> I agree we're bloating this and probably not very acceptable.
> tracepoint adds additional complexity and out of tree patches which

Why are tracepoints a problem and adding complexity? Also why would they
cause out of tree patches?

> we'd like to avoid. Would you be Ok if we added a relatively simple
> function like below that could do the job and not bloat the optimal
> case?
> 
> /*
>  * Fast and NMI safe access to boot time. It may be slightly out of date
>  * as we're accessing offset without seqcount writes, but is safe to access.
>  */
> u64 ktime_get_boot_fast_ns(void)
> {
>         struct timekeeper *tk = &tk_core.timekeeper;
>         return __ktime_get_fast_ns(&tk_fast_mono) + tk->offs_boot;

This needs a big fat comment and documentation of the possible side effects
of this:

1) The timestamp might be off due:

   CPU 0	       	  	       	      CPU 1
   timekeeping_inject_sleeptime64()
   __timekeeping_inject_sleeptime(tk, delta);
						timestamp();
   timekeeping_update(tk, TK_CLEAR_NTP...);

2) On 32bit machines the timestamp might see a half updated boot offset
   value. On 64bit machines it either sees the old or the new value.

I don't think this is a big issue, because the event of updating boot
offset is really, really rare, so postprocessing should be able to handle
this. But at least it must be documented so people wont get surprised.

> > That should be sufficient for tracing suspend/resume behaviour. If there is
> > not a really convincing reason for having that as a real trace clock then I
> > prefer to avoid that extra stuff.
> 
> Several clocks are accessible just by simple writing of clock name to
> trace_clock in debugfs. This is really cool and doesn't require any
> out of tree patches or post processing complexity.

I know that it's nice to have :)

Thanks,

	tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ