Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1302912

Re: [PATCH 1/2] kernel, timekeeping, add trylock option to ktime_get_with_offset()

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] kernel, timekeeping, add trylock option to ktime_get_with_offset()
Date 2016-01-06 18:40 +0100
Message-ID <qO0dX-4eZ-1@gated-at.bofh.it> (permalink)
References <qNW0H-1yG-35@gated-at.bofh.it> <qNW0H-1yG-39@gated-at.bofh.it> <qO04h-4bH-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 6 Jan 2016, John Stultz 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.
> 
> 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

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] kernel, timekeeping, add trylock option to ktime_get_with_offset() Prarit Bhargava <prarit@redhat.com> - 2016-01-06 14:10 +0100
  Re: [PATCH 1/2] kernel, timekeeping, add trylock option to  ktime_get_with_offset() Jiri Bohac <jbohac@suse.cz> - 2016-01-06 17:10 +0100
    Re: [PATCH 1/2] kernel, timekeeping, add trylock option to ktime_get_with_offset() Prarit Bhargava <prarit@redhat.com> - 2016-01-06 17:30 +0100
  Re: [PATCH 1/2] kernel, timekeeping, add trylock option to  ktime_get_with_offset() Petr Mladek <pmladek@suse.com> - 2016-01-06 17:30 +0100
  Re: [PATCH 1/2] kernel, timekeeping, add trylock option to ktime_get_with_offset() John Stultz <john.stultz@linaro.org> - 2016-01-06 18:30 +0100
    Re: [PATCH 1/2] kernel, timekeeping, add trylock option to  ktime_get_with_offset() Thomas Gleixner <tglx@linutronix.de> - 2016-01-06 18:40 +0100
      Re: [PATCH 1/2] kernel, timekeeping, add trylock option to ktime_get_with_offset() Prarit Bhargava <prarit@redhat.com> - 2016-01-06 19:10 +0100
        Re: [PATCH 1/2] kernel, timekeeping, add trylock option to  ktime_get_with_offset() Thomas Gleixner <tglx@linutronix.de> - 2016-01-06 19:20 +0100
      Re: [PATCH 1/2] kernel, timekeeping, add trylock option to ktime_get_with_offset() John Stultz <john.stultz@linaro.org> - 2016-01-06 20:10 +0100
        Re: [PATCH 1/2] kernel, timekeeping, add trylock option to ktime_get_with_offset() Prarit Bhargava <prarit@redhat.com> - 2016-01-06 20:10 +0100
    Re: [PATCH 1/2] kernel, timekeeping, add trylock option to ktime_get_with_offset() John Stultz <john.stultz@linaro.org> - 2016-01-06 18:40 +0100
      Re: [PATCH 1/2] kernel, timekeeping, add trylock option to ktime_get_with_offset() Prarit Bhargava <prarit@redhat.com> - 2016-01-06 19:10 +0100
        Re: [PATCH 1/2] kernel, timekeeping, add trylock option to  ktime_get_with_offset() Thomas Gleixner <tglx@linutronix.de> - 2016-01-06 19:20 +0100

csiph-web