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] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 06 Jan 2016 13:09:08 -0500
From:	Prarit Bhargava <prarit@...hat.com>
To:	Thomas Gleixner <tglx@...utronix.de>,
	John Stultz <john.stultz@...aro.org>
CC:	lkml <linux-kernel@...r.kernel.org>,
	Ingo Molnar <mingo@...nel.org>,
	Xunlei Pang <pang.xunlei@...aro.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Baolin Wang <baolin.wang@...aro.org>,
	Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH 1/2] kernel, timekeeping, add trylock option to ktime_get_with_offset()



On 01/06/2016 12:34 PM, Thomas Gleixner wrote:
> On Wed, 6 Jan 2016, John Stultz wrote:
>> On Wed, Jan 6, 2016 at 5:00 AM, Prarit Bhargava <prarit@...hat.com> wrote:
>>> -ktime_t ktime_get_with_offset(enum tk_offsets offs)
>>> +ktime_t ktime_get_with_offset(enum tk_offsets offs, int trylock)
>>>  {
>>>         struct timekeeper *tk = &tk_core.timekeeper;
>>>         unsigned int seq;
>>>         ktime_t base, *offset = offsets[offs];
>>>         s64 nsecs;
>>> +       unsigned long flags = 0;
>>> +
>>> +       if (unlikely(!timekeeping_initialized))
>>> +               return ktime_set(0, 0);
>>>
>>>         WARN_ON(timekeeping_suspended);
>>>
>>> +       if (trylock && !raw_spin_trylock_irqsave(&timekeeper_lock, flags))
>>> +               return ktime_set(KTIME_MAX, 0);
>>
>> Wait.. this doesn't make sense. The timekeeper lock is only for reading.
>>
>> What I was suggesting to you off line is to have something that avoids
>> spinning on the seqcounter should if a bug occurs and we IPI all the
>> cpus, that we don't deadlock or block any printk messages.
> 
> We could also extend the fast timekeeper with boot/real/tai extensions and use
> that for printk. You can use ktime_get_mono_fast_ns() today.
> 

Thanks tglx -- I thought about doing that but was put off by the comments
in __ktime_get_fast_ns() which point out that we could see backwards time
stamps.  But I see your point -- I could do the same "last_time_stamp" check
and use "??" in the output.

That's a far better approach here, and unless John has any objections I'll
go with that.

P.


> Thanks,
> 
> 	tglx
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ