16 Oct, 2015

1 commit

  • timekeeping_init() can set the wall time offset, so we need to
    increment the clock_was_set_seq counter. That way hrtimers will pick
    up the early offset immediately. Otherwise on a machine which does not
    set wall time later in the boot process the hrtimer offset is stale at
    0 and wall time timers are going to expire with a delay of 45 years.

    Fixes: 868a3e915f7f "hrtimer: Make offset update smarter"
    Reported-and-tested-by: Heiko Carstens
    Signed-off-by: Thomas Gleixner
    Cc: Stefan Liebler
    Cc: Peter Zijlstra
    Cc: John Stultz

    Thomas Gleixner
     

03 Oct, 2015

2 commits

  • Pull timer fixes from Ingo Molnar:
    "An abs64() fix in the watchdog driver, and two clocksource driver
    NO_IRQ assumption fixes"

    * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    clocksource: Fix abs() usage w/ 64bit values
    clocksource/drivers/keystone: Fix bad NO_IRQ usage
    clocksource/drivers/rockchip: Fix bad NO_IRQ usage

    Linus Torvalds
     
  • This patch fixes one cases where abs() was being used with 64-bit
    nanosecond values, where the result may be capped at 32-bits.

    This potentially could cause watchdog false negatives on 32-bit
    systems, so this patch addresses the issue by using abs64().

    Signed-off-by: John Stultz
    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Cc: Ingo Molnar
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/1442279124-7309-2-git-send-email-john.stultz@linaro.org
    Signed-off-by: Thomas Gleixner

    John Stultz
     

18 Sep, 2015

1 commit


14 Sep, 2015

1 commit

  • All users are migrated to the per-state callbacks, get rid of the
    unused interface and the core support code.

    Signed-off-by: Viresh Kumar
    Signed-off-by: Thomas Gleixner
    Cc: linaro-kernel@lists.linaro.org
    Cc: John Stultz
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/fd60de14cf6d125489c031207567bb255ad946f6.1441943991.git.viresh.kumar@linaro.org
    Signed-off-by: Ingo Molnar

    Viresh Kumar
     

13 Sep, 2015

1 commit

  • The internal clocksteering done for fine-grained error
    correction uses a logarithmic approximation, so any time
    adjtimex() adjusts the clock steering, timekeeping_freqadjust()
    quickly approximates the correct clock frequency over a series
    of ticks.

    Unfortunately, the logic in timekeeping_freqadjust(), introduced
    in commit:

    dc491596f639 ("timekeeping: Rework frequency adjustments to work better w/ nohz")

    used the abs() function with a s64 error value to calculate the
    size of the approximated adjustment to be made.

    Per include/linux/kernel.h:

    "abs() should not be used for 64-bit types (s64, u64, long long) - use abs64()".

    Thus on 32-bit platforms, this resulted in the clocksteering to
    take a quite dampended random walk trying to converge on the
    proper frequency, which caused the adjustments to be made much
    slower then intended (most easily observed when large
    adjustments are made).

    This patch fixes the issue by using abs64() instead.

    Reported-by: Nuno Gonçalves
    Tested-by: Nuno Goncalves
    Signed-off-by: John Stultz
    Cc: # v3.17+
    Cc: Linus Torvalds
    Cc: Miroslav Lichvar
    Cc: Peter Zijlstra
    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1441840051-20244-1-git-send-email-john.stultz@linaro.org
    Signed-off-by: Ingo Molnar

    John Stultz
     

02 Sep, 2015

2 commits

  • The code ensures that when nohz full is running, at least the
    boot CPU serves as a housekeeper and it can't be later offlined.

    Let's assert this assumption to make sure that we have CPUs to
    handle unbound jobs like workqueues and timers while nohz full
    CPUs run undisturbed.

    Also improve the comments on housekeeper offlining prevention.

    Signed-off-by: Frederic Weisbecker
    Acked-by: Thomas Gleixner
    Cc: Chris Metcalf
    Cc: Christoph Lameter
    Cc: Linus Torvalds
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Cc: Vatika Harlalka
    Link: http://lkml.kernel.org/r/1441119060-2230-3-git-send-email-fweisbec@gmail.com
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     
  • Pull timer updates from Thomas Gleixner:
    "Rather large, but nothing exiting:

    - new range check for settimeofday() to prevent that boot time
    becomes negative.
    - fix for file time rounding
    - a few simplifications of the hrtimer code
    - fix for the proc/timerlist code so the output of clock realtime
    timers is accurate
    - more y2038 work
    - tree wide conversion of clockevent drivers to the new callbacks"

    * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (88 commits)
    hrtimer: Handle failure of tick_init_highres() gracefully
    hrtimer: Unconfuse switch_hrtimer_base() a bit
    hrtimer: Simplify get_target_base() by returning current base
    hrtimer: Drop return code of hrtimer_switch_to_hres()
    time: Introduce timespec64_to_jiffies()/jiffies_to_timespec64()
    time: Introduce current_kernel_time64()
    time: Introduce struct itimerspec64
    time: Add the common weak version of update_persistent_clock()
    time: Always make sure wall_to_monotonic isn't positive
    time: Fix nanosecond file time rounding in timespec_trunc()
    timer_list: Add the base offset so remaining nsecs are accurate for non monotonic timers
    cris/time: Migrate to new 'set-state' interface
    kernel: broadcast-hrtimer: Migrate to new 'set-state' interface
    xtensa/time: Migrate to new 'set-state' interface
    unicore/time: Migrate to new 'set-state' interface
    um/time: Migrate to new 'set-state' interface
    sparc/time: Migrate to new 'set-state' interface
    sh/localtimer: Migrate to new 'set-state' interface
    score/time: Migrate to new 'set-state' interface
    s390/time: Migrate to new 'set-state' interface
    ...

    Linus Torvalds
     

01 Sep, 2015

2 commits

  • Pull NOHZ updates from Ingo Molnar:
    "The main changes, mostly written by Frederic Weisbecker, include:

    - Fix some jiffies based cputime assumptions. (No real harm because
    the concerned code isn't used by full dynticks.)

    - Simplify jiffies usecs conversions. Remove dead code.

    - Remove early hacks on nohz full code that avoided messing up idle
    nohz internals. Now nohz integrates well full and idle and such
    hack have become needless.

    - Restart nohz full tick from irq exit. (A simplification and a
    preparation for future optimization on scheduler kick to nohz
    full)

    - Code cleanups.

    - Tile driver isolation enhancement on top of nohz. (Chris Metcalf)"

    * 'timers-nohz-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    nohz: Remove useless argument on tick_nohz_task_switch()
    nohz: Move tick_nohz_restart_sched_tick() above its users
    nohz: Restart nohz full tick from irq exit
    nohz: Remove idle task special case
    nohz: Prevent tilegx network driver interrupts
    alpha: Fix jiffies based cputime assumption
    apm32: Fix cputime == jiffies assumption
    jiffies: Remove HZ > USEC_PER_SEC special case

    Linus Torvalds
     
  • Pull RCU updates from Ingo Molnar:
    "The main RCU changes in this cycle are:

    - the combination of tree geometry-initialization simplifications and
    OS-jitter-reduction changes to expedited grace periods. These two
    are stacked due to the large number of conflicts that would
    otherwise result.

    - privatize smp_mb__after_unlock_lock().

    This commit moves the definition of smp_mb__after_unlock_lock() to
    kernel/rcu/tree.h, in recognition of the fact that RCU is the only
    thing using this, that nothing else is likely to use it, and that
    it is likely to go away completely.

    - documentation updates.

    - torture-test updates.

    - misc fixes"

    * 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (60 commits)
    rcu,locking: Privatize smp_mb__after_unlock_lock()
    rcu: Silence lockdep false positive for expedited grace periods
    rcu: Don't disable CPU hotplug during OOM notifiers
    scripts: Make checkpatch.pl warn on expedited RCU grace periods
    rcu: Update MAINTAINERS entry
    rcu: Clarify CONFIG_RCU_EQS_DEBUG help text
    rcu: Fix backwards RCU_LOCKDEP_WARN() in synchronize_rcu_tasks()
    rcu: Rename rcu_lockdep_assert() to RCU_LOCKDEP_WARN()
    rcu: Make rcu_is_watching() really notrace
    cpu: Wait for RCU grace periods concurrently
    rcu: Create a synchronize_rcu_mult()
    rcu: Fix obsolete priority-boosting comment
    rcu: Use WRITE_ONCE in RCU_INIT_POINTER
    rcu: Hide RCU_NOCB_CPU behind RCU_EXPERT
    rcu: Add RCU-sched flavors of get-state and cond-sync
    rcu: Add fastpath bypassing funnel locking
    rcu: Rename RCU_GP_DONE_FQS to RCU_GP_DOING_FQS
    rcu: Pull out wait_event*() condition into helper function
    documentation: Describe new expedited stall warnings
    rcu: Add stall warnings to synchronize_sched_expedited()
    ...

    Linus Torvalds
     

22 Aug, 2015

1 commit

  • Commit 75e3b37d0598 ("hrtimer: Drop return code of hrtimer_switch_to_hres()")
    drops the return code of hrtimer_switch_to_hres(). While doing so, it also
    drops the return statement itself on failure. This may cause a system hang.
    Seen when running arm:multi_v7_defconfig in qemu with devicetree file
    vexpress-v2p-ca9.

    Fixes: 75e3b37d0598 ("hrtimer: Drop return code of hrtimer_switch_to_hres()")
    Cc: Luiz Capitulino
    Signed-off-by: Guenter Roeck
    Link: http://lkml.kernel.org/r/1440231047-16256-1-git-send-email-linux@roeck-us.net
    Signed-off-by: Thomas Gleixner

    Guenter Roeck
     

21 Aug, 2015

1 commit


19 Aug, 2015

2 commits

  • The variable called "this_base" is confusing because its name suggests
    it's of "struct hrtimer_clock_base" type, along with "base" and "new_base"
    which doesn't help understanding this complicated function.

    Make its name clearer and fix the misleading comment while at it.

    [ tglx: Fixed the comment for real ]

    Signed-off-by: Frederic Weisbecker
    Link: http://lkml.kernel.org/r/1439907509-9553-3-git-send-email-fweisbec@gmail.com
    Signed-off-by: Thomas Gleixner

    Frederic Weisbecker
     
  • Instead of fetching again the current cpu base, just take it from the
    parameter.

    Signed-off-by: Frederic Weisbecker
    Link: http://lkml.kernel.org/r/1439907509-9553-2-git-send-email-fweisbec@gmail.com
    Signed-off-by: Thomas Gleixner

    Frederic Weisbecker
     

18 Aug, 2015

8 commits

  • lock_timer_base() cannot prevent the following :

    CPU1 ( in __mod_timer()
    timer->flags |= TIMER_MIGRATING;
    spin_unlock(&base->lock);
    base = new_base;
    spin_lock(&base->lock);
    // The next line clears TIMER_MIGRATING
    timer->flags &= ~TIMER_BASEMASK;
    CPU2 (in lock_timer_base())
    see timer base is cpu0 base
    spin_lock_irqsave(&base->lock, *flags);
    if (timer->flags == tf)
    return base; // oops, wrong base
    timer->flags |= base->cpu // too late

    We must write timer->flags in one go, otherwise we can fool other cpus.

    Fixes: bc7a34b8b9eb ("timer: Reduce timer migration overhead if disabled")
    Signed-off-by: Eric Dumazet
    Cc: Jon Christopherson
    Cc: David Miller
    Cc: xen-devel@lists.xen.org
    Cc: david.vrabel@citrix.com
    Cc: Sander Eikelenboom
    Link: http://lkml.kernel.org/r/1439831928.32680.11.camel@edumazet-glaptop2.roam.corp.google.com
    Signed-off-by: Thomas Gleixner
    Cc: Thomas Gleixner

    Eric Dumazet
     
  • It's not checked by the caller.

    Signed-off-by: Luiz Capitulino
    Link: http://lkml.kernel.org/r/20150811164043.538241ef@redhat.com
    Signed-off-by: Thomas Gleixner

    Luiz Capitulino
     
  • The conversion between struct timespec and jiffies is not year 2038
    safe on 32bit systems. Introduce timespec64_to_jiffies() and
    jiffies_to_timespec64() functions which use struct timespec64 to
    make it ready for 2038 issue.

    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Baolin Wang
    Signed-off-by: John Stultz

    Baolin Wang
     
  • The current_kernel_time() is not year 2038 safe on 32bit systems
    since it returns a timespec value. Introduce current_kernel_time64()
    which returns a timespec64 value.

    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Baolin Wang
    Signed-off-by: John Stultz

    Baolin Wang
     
  • The weak update_persistent_clock64() calls update_persistent_clock(),
    if the architecture defines an update_persistent_clock64() to replace
    and remove its update_persistent_clock() version, when building the
    kernel the linker will throw an undefined symbol error, that is, any
    arch that switches to update_persistent_clock64() will have this issue.

    To solve the issue, we add the common weak update_persistent_clock().

    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: Arnd Bergmann
    Signed-off-by: Xunlei Pang
    Signed-off-by: John Stultz

    Xunlei Pang
     
  • Two issues were found on an IMX6 development board without an
    enabled RTC device(resulting in the boot time and monotonic
    time being initialized to 0).

    Issue 1:exportfs -a generate:
    "exportfs: /opt/nfs/arm does not support NFS export"
    Issue 2:cat /proc/stat:
    "btime 4294967236"

    The same issues can be reproduced on x86 after running the
    following code:
    int main(void)
    {
    struct timeval val;
    int ret;

    val.tv_sec = 0;
    val.tv_usec = 0;
    ret = settimeofday(&val, NULL);
    return 0;
    }

    Two issues are different symptoms of same problem:
    The reason is a positive wall_to_monotonic pushes boot time back
    to the time before Epoch, and getboottime will return negative
    value.

    In symptom 1:
    negative boot time cause get_expiry() to overflow time_t
    when input expire time is 2147483647, then cache_flush()
    always clears entries just added in ip_map_parse.
    In symptom 2:
    show_stat() uses "unsigned long" to print negative btime
    value returned by getboottime.

    This patch fix the problem by prohibiting time from being set to a value which
    would cause a negative boot time. As a result one can't set the CLOCK_REALTIME
    time prior to (1970 + system uptime).

    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Wang YanQing
    [jstultz: reworded commit message]
    Signed-off-by: John Stultz

    Wang YanQing
     
  • timespec_trunc() avoids rounding if granularity 1 second.

    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Karsten Blees
    Signed-off-by: John Stultz

    Karsten Blees
     
  • I noticed for non-monotonic timers in timer_list, some of the
    output looked a little confusing.

    For example:
    #1: , posix_timer_fn, S:01, hrtimer_start_range_ns, leap-a-day/2360
    # expires at 1434412800000000000-1434412800000000000 nsecs [in 1434410725062375469 to 1434410725062375469 nsecs]

    You'll note the relative time till the expiration "[in xxx to
    yyy nsecs]" is incorrect. This is because its printing the delta
    between CLOCK_MONOTONIC time to the CLOCK_REALTIME expiration.

    This patch fixes this issue by adding the clock offset to the
    "now" time which we use to calculate the delta.

    Cc: Prarit Bhargava
    Cc: Daniel Bristot de Oliveira
    Cc: Richard Cochran
    Cc: Jan Kara
    Cc: Jiri Bohac
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Shuah Khan
    Signed-off-by: John Stultz

    John Stultz
     

12 Aug, 2015

1 commit

  • …k/linux-rcu into core/rcu

    Pull RCU changes from Paul E. McKenney:

    - The combination of tree geometry-initialization simplifications
    and OS-jitter-reduction changes to expedited grace periods.
    These two are stacked due to the large number of conflicts
    that would otherwise result.

    [ With one addition, a temporary commit to silence a lockdep false
    positive. Additional changes to the expedited grace-period
    primitives (queued for 4.4) remove the cause of this false
    positive, and therefore include a revert of this temporary commit. ]

    - Documentation updates.

    - Torture-test updates.

    - Miscellaneous fixes.

    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

10 Aug, 2015

1 commit


01 Aug, 2015

1 commit


29 Jul, 2015

5 commits

  • Leftover from early code.

    Cc: Christoph Lameter
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: Viresh Kumar
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • Fix the function declaration/definition dance.

    Reviewed-by: Rik van Riel
    Cc: Christoph Lameter
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: Viresh Kumar
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • Restart the tick when necessary from the irq exit path. It makes nohz
    full more flexible, simplify the related IPIs and doesn't bring
    significant overhead on irq exit.

    In a longer term view, it will allow us to piggyback the nohz kick
    on the scheduler IPI in the future instead of sending a dedicated IPI
    that often doubles the scheduler IPI on task wakeup. This will require
    more changes though including careful review of resched_curr() callers
    to include nohz full needs.

    Reviewed-by: Rik van Riel
    Cc: Christoph Lameter
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: Viresh Kumar
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • On nohz full early days, idle dynticks and full dynticks weren't well
    integrated and we couldn't risk full dynticks calls on idle without
    risking messing up tick idle statistics. This is why we prevented such
    thing to happen.

    Nowadays full dynticks and idle dynticks are better integrated and
    interact without known issue.

    So lets remove that.

    Reviewed-by: Rik van Riel
    Cc: Christoph Lameter
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: Viresh Kumar
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • HZ never goes much further 1000 and a bit. And if we ever reach one tick
    per microsecond, we might be having a problem.

    Lets stop maintaining this special case, just leave a paranoid check.

    Reviewed-by: Rik van Riel
    Cc: Christoph Lameter
    Cc: Ingo Molnar
    Cc; John Stultz
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: Viresh Kumar
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     

14 Jul, 2015

1 commit


11 Jul, 2015

1 commit


08 Jul, 2015

8 commits

  • Andriy reported that on a virtual machine the warning about negative
    expiry time in the clock events programming code triggered:

    hpet: hpet0 irq 40 for MSI
    hpet: hpet1 irq 41 for MSI
    Switching to clocksource hpet
    WARNING: at kernel/time/clockevents.c:239

    [] clockevents_program_event+0xdb/0xf0
    [] tick_handle_periodic_broadcast+0x41/0x50
    [] timer_interrupt+0x15/0x20

    When the second hpet is installed as a per cpu timer the broadcast
    event is not longer required and stopped, which sets the next_evt of
    the broadcast device to KTIME_MAX.

    If after that a spurious interrupt happens on the broadcast device,
    then the current code blindly handles it and tries to reprogram the
    broadcast device afterwards, which adds the period to
    next_evt. KTIME_MAX + period results in a negative expiry value
    causing the WARN_ON in the clockevents code to trigger.

    Add a proper check for the state of the broadcast device into the
    interrupt handler and return if the interrupt is spurious.

    [ Folded in pointer fix from Sudeep ]

    Reported-by: Andriy Gapon
    Signed-off-by: Thomas Gleixner
    Cc: Sudeep Holla
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Link: http://lkml.kernel.org/r/20150705205221.802094647@linutronix.de

    Thomas Gleixner
     
  • If the current cpu is the one which has the hrtimer based broadcast
    queued then we better return busy immediately instead of going through
    loops and hoops to figure that out.

    [ Split out from a larger combo patch ]

    Tested-by: Sudeep Holla
    Signed-off-by: Thomas Gleixner
    Cc: Suzuki Poulose
    Cc: Lorenzo Pieralisi
    Cc: Catalin Marinas
    Cc: Rafael J. Wysocki
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Cc: Ingo Molnar
    Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1507070929360.3916@nanos

    Thomas Gleixner
     
  • Tell the idle code not to go deep if the broadcast IPI is about to
    arrive.

    [ Split out from a larger combo patch ]

    Tested-by: Sudeep Holla
    Signed-off-by: Thomas Gleixner
    Cc: Suzuki Poulose
    Cc: Lorenzo Pieralisi
    Cc: Catalin Marinas
    Cc: Rafael J. Wysocki
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Cc: Ingo Molnar
    Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1507070929360.3916@nanos

    Thomas Gleixner
     
  • If the system is in periodic mode and the broadcast device is hrtimer
    based, return busy as we have no proper handling for this.

    [ Split out from a larger combo patch ]

    Tested-by: Sudeep Holla
    Signed-off-by: Thomas Gleixner
    Cc: Suzuki Poulose
    Cc: Lorenzo Pieralisi
    Cc: Catalin Marinas
    Cc: Rafael J. Wysocki
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Cc: Ingo Molnar
    Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1507070929360.3916@nanos

    Thomas Gleixner
     
  • We need to check more than the periodic mode for proper operation in
    all runtime combinations. To avoid code duplication move the check
    into the enter state handling.

    No functional change.

    [ Split out from a larger combo patch ]

    Reported-and-tested-by: Sudeep Holla
    Signed-off-by: Thomas Gleixner
    Cc: Suzuki Poulose
    Cc: Lorenzo Pieralisi
    Cc: Catalin Marinas
    Cc: Rafael J. Wysocki
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Cc: Ingo Molnar
    Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1507070929360.3916@nanos

    Thomas Gleixner
     
  • Add a check for a installed broadcast device to the oneshot control
    function and return busy if not.

    [ Split out from a larger combo patch ]

    Reported-and-tested-by: Sudeep Holla
    Signed-off-by: Thomas Gleixner
    Cc: Suzuki Poulose
    Cc: Lorenzo Pieralisi
    Cc: Catalin Marinas
    Cc: Rafael J. Wysocki
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Cc: Ingo Molnar
    Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1507070929360.3916@nanos

    Thomas Gleixner
     
  • Currently the broadcast busy check, which prevents the idle code from
    going into deep idle, works only in one shot mode.

    If NOHZ and HIGHRES are off (config or command line) there is no
    sanity check at all, so under certain conditions cpus are allowed to
    go into deep idle, where the local timer stops, and are not woken up
    again because there is no broadcast timer installed or a hrtimer based
    broadcast device is not evaluated.

    Move tick_broadcast_oneshot_control() into the common code and provide
    proper subfunctions for the various config combinations.

    The common check in tick_broadcast_oneshot_control() is for the C3STOP
    misfeature flag of the local clock event device. If its not set, idle
    can proceed. If set, further checks are necessary.

    Provide checks for the trivial cases:

    - If broadcast is disabled in the config, then return busy

    - If oneshot mode (NOHZ/HIGHES) is disabled in the config, return
    busy if the broadcast device is hrtimer based.

    - If oneshot mode is enabled in the config call the original
    tick_broadcast_oneshot_control() function. That function needs
    extra checks which will be implemented in seperate patches.

    [ Split out from a larger combo patch ]

    Reported-and-tested-by: Sudeep Holla
    Signed-off-by: Thomas Gleixner
    Cc: Suzuki Poulose
    Cc: Lorenzo Pieralisi
    Cc: Catalin Marinas
    Cc: Rafael J. Wysocki
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Cc: Ingo Molnar
    Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1507070929360.3916@nanos

    Thomas Gleixner
     
  • The broadcast code shuts down the local clock event unconditionally
    even if no broadcast device is installed or if the broadcast device is
    hrtimer based.

    Add proper sanity checks.

    [ Split out from a larger combo patch ]

    Reported-and-tested-by: Sudeep Holla
    Signed-off-by: Thomas Gleixner
    Cc: Suzuki Poulose
    Cc: Lorenzo Pieralisi
    Cc: Catalin Marinas
    Cc: Rafael J. Wysocki
    Cc: Peter Zijlstra
    Cc: Preeti U Murthy
    Cc: Ingo Molnar
    Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1507070929360.3916@nanos

    Thomas Gleixner