lkml.org 
[lkml]   [2016]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/2] kernel, timekeeping, add trylock option to ktime_get_with_offset()
From
On Wed, Jan 6, 2016 at 9:28 AM, John Stultz <john.stultz@linaro.org> wrote:
> On Wed, Jan 6, 2016 at 5:00 AM, Prarit Bhargava <prarit@redhat.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.

Only for writing.. sorry.. still drinking my coffee.

> 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.

And more clearly here, if a cpu takes a write on the seqcounter in
update_wall_time() and at that point another cpu hits a bug, and IPIs
the cpus, the system would deadlock. That's really what I want to
avoid.

thanks
-john


\
 
 \ /
  Last update: 2016-01-06 19:21    [W:0.652 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site