lkml.org 
[lkml]   [2017]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 18/25] hrtimer: Enable soft and hard hrtimer
On Tue, 26 Sep 2017, Peter Zijlstra wrote:

> On Thu, Aug 31, 2017 at 12:23:42PM -0000, Anna-Maria Gleixner wrote:
> > --- a/include/linux/hrtimer.h
> > +++ b/include/linux/hrtimer.h
> > @@ -23,6 +23,17 @@
> > #include <linux/timer.h>
> > #include <linux/timerqueue.h>
> >
> > +/*
> > + * Clock ids for hrtimers which expire in softirq context. These clock ids
> > + * are kernel internal and never exported to user space.
> > + */
> > +#define HRTIMER_BASE_SOFT_MASK MAX_CLOCKS
> > +
> > +#define CLOCK_REALTIME_SOFT (CLOCK_REALTIME | HRTIMER_BASE_SOFT_MASK)
> > +#define CLOCK_MONOTONIC_SOFT (CLOCK_MONOTONIC | HRTIMER_BASE_SOFT_MASK)
> > +#define CLOCK_BOOTTIME_SOFT (CLOCK_BOOTTIME | HRTIMER_BASE_SOFT_MASK)
> > +#define CLOCK_TAI_SOFT (CLOCK_TAI | HRTIMER_BASE_SOFT_MASK)
> > +
> > struct hrtimer_clock_base;
> > struct hrtimer_cpu_base;
> >
>
> > --- a/kernel/time/hrtimer.c
> > +++ b/kernel/time/hrtimer.c
> > @@ -1173,7 +1161,7 @@ u64 hrtimer_get_next_event(void)
> >
> > static inline int hrtimer_clockid_to_base(clockid_t clock_id)
> > {
> > + if (likely(clock_id < MAX_CLOCKS_HRT)) {
> > int base = hrtimer_clock_to_base_table[clock_id];
> >
> > if (likely(base != HRTIMER_MAX_CLOCK_BASES))
> > @@ -1193,8 +1181,12 @@ static void __hrtimer_init(struct hrtime
> >
> > cpu_base = raw_cpu_ptr(&hrtimer_bases);
> >
> > + if (mode != HRTIMER_MODE_ABS) {
> > + if (clock_id == CLOCK_REALTIME)
> > + clock_id = CLOCK_MONOTONIC;
> > + else if (clock_id == CLOCK_REALTIME_SOFT)
> > + clock_id = CLOCK_MONOTONIC_SOFT;
> > + }
> >
> > base = hrtimer_clockid_to_base(clock_id);
> > timer->base = &cpu_base->clock_base[base];
>
> So why expose these extra bases at all, why not stick another flag in
> MODE? These extra bases is a pure implementation detail imo; you could
> equally implement the functionality without (albeit at extra cost).
>

It was Thomas' request not to use a flag for this.

Anna-Maria

\
 
 \ /
  Last update: 2017-09-27 16:19    [W:0.091 / U:1.408 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site