29 Mar, 2016

1 commit

  • The tick dependency mask was intially unsigned long because this is the
    type on which clear_bit() operates on and fetch_or() accepts it.

    But now that we have atomic_fetch_or(), we can instead use
    atomic_andnot() to clear the bit. This consolidates the type of our
    tick dependency mask, reduce its size on structures and benefit from
    possible architecture optimizations on atomic_t operations.

    Suggested-by: Linus Torvalds
    Signed-off-by: Frederic Weisbecker
    Cc: Andrew Morton
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1458830281-4255-3-git-send-email-fweisbec@gmail.com
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

26 Mar, 2016

1 commit


23 Mar, 2016

1 commit

  • Use the more common logging method with the eventual goal of removing
    pr_warning altogether.

    Miscellanea:

    - Realign arguments
    - Coalesce formats
    - Add missing space between a few coalesced formats

    Signed-off-by: Joe Perches
    Acked-by: Rafael J. Wysocki [kernel/power/suspend.c]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

19 Mar, 2016

1 commit

  • Merge second patch-bomb from Andrew Morton:

    - a couple of hotfixes

    - the rest of MM

    - a new timer slack control in procfs

    - a couple of procfs fixes

    - a few misc things

    - some printk tweaks

    - lib/ updates, notably to radix-tree.

    - add my and Nick Piggin's old userspace radix-tree test harness to
    tools/testing/radix-tree/. Matthew said it was a godsend during the
    radix-tree work he did.

    - a few code-size improvements, switching to __always_inline where gcc
    screwed up.

    - partially implement character sets in sscanf

    * emailed patches from Andrew Morton : (118 commits)
    sscanf: implement basic character sets
    lib/bug.c: use common WARN helper
    param: convert some "on"/"off" users to strtobool
    lib: add "on"/"off" support to kstrtobool
    lib: update single-char callers of strtobool()
    lib: move strtobool() to kstrtobool()
    include/linux/unaligned: force inlining of byteswap operations
    include/uapi/linux/byteorder, swab: force inlining of some byteswap operations
    include/asm-generic/atomic-long.h: force inlining of some atomic_long operations
    usb: common: convert to use match_string() helper
    ide: hpt366: convert to use match_string() helper
    ata: hpt366: convert to use match_string() helper
    power: ab8500: convert to use match_string() helper
    power: charger_manager: convert to use match_string() helper
    drm/edid: convert to use match_string() helper
    pinctrl: convert to use match_string() helper
    device property: convert to use match_string() helper
    lib/string: introduce match_string() helper
    radix-tree tests: add test for radix_tree_iter_next
    radix-tree tests: add regression3 test
    ...

    Linus Torvalds
     

18 Mar, 2016

4 commits

  • Pull trivial tree updates from Jiri Kosina.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
    drivers/rtc: broken link fix
    drm/i915 Fix typos in i915_gem_fence.c
    Docs: fix missing word in REPORTING-BUGS
    lib+mm: fix few spelling mistakes
    MAINTAINERS: add git URL for APM driver
    treewide: Fix typo in printk

    Linus Torvalds
     
  • This changes several users of manual "on"/"off" parsing to use
    strtobool.

    Some side-effects:
    - these uses will now parse y/n/1/0 meaningfully too
    - the early_param uses will now bubble up parse errors

    Signed-off-by: Kees Cook
    Acked-by: Heiko Carstens
    Acked-by: Michael Ellerman
    Cc: Amitkumar Karwar
    Cc: Andy Shevchenko
    Cc: Daniel Borkmann
    Cc: Joe Perches
    Cc: Kalle Valo
    Cc: Martin Schwidefsky
    Cc: Nishant Sarmukadam
    Cc: Rasmus Villemoes
    Cc: Steve French
    Cc: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     
  • This patchset introduces a /proc//timerslack_ns interface which
    would allow controlling processes to be able to set the timerslack value
    on other processes in order to save power by avoiding wakeups (Something
    Android currently does via out-of-tree patches).

    The first patch tries to fix the internal timer_slack_ns usage which was
    defined as a long, which limits the slack range to ~4 seconds on 32bit
    systems. It converts it to a u64, which provides the same basically
    unlimited slack (500 years) on both 32bit and 64bit machines.

    The second patch introduces the /proc//timerslack_ns interface
    which allows the full 64bit slack range for a task to be read or set on
    both 32bit and 64bit machines.

    With these two patches, on a 32bit machine, after setting the slack on
    bash to 10 seconds:

    $ time sleep 1

    real 0m10.747s
    user 0m0.001s
    sys 0m0.005s

    The first patch is a little ugly, since I had to chase the slack delta
    arguments through a number of functions converting them to u64s. Let me
    know if it makes sense to break that up more or not.

    Other than that things are fairly straightforward.

    This patch (of 2):

    The timer_slack_ns value in the task struct is currently a unsigned
    long. This means that on 32bit applications, the maximum slack is just
    over 4 seconds. However, on 64bit machines, its much much larger (~500
    years).

    This disparity could make application development a little (as well as
    the default_slack) to a u64. This means both 32bit and 64bit systems
    have the same effective internal slack range.

    Now the existing ABI via PR_GET_TIMERSLACK and PR_SET_TIMERSLACK specify
    the interface as a unsigned long, so we preserve that limitation on
    32bit systems, where SET_TIMERSLACK can only set the slack to a unsigned
    long value, and GET_TIMERSLACK will return ULONG_MAX if the slack is
    actually larger then what can be stored by an unsigned long.

    This patch also modifies hrtimer functions which specified the slack
    delta as a unsigned long.

    Signed-off-by: John Stultz
    Cc: Arjan van de Ven
    Cc: Thomas Gleixner
    Cc: Oren Laadan
    Cc: Ruchi Kandoi
    Cc: Rom Lemarchand
    Cc: Kees Cook
    Cc: Android Kernel Team
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    John Stultz
     
  • Pull security layer updates from James Morris:
    "There are a bunch of fixes to the TPM, IMA, and Keys code, with minor
    fixes scattered across the subsystem.

    IMA now requires signed policy, and that policy is also now measured
    and appraised"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (67 commits)
    X.509: Make algo identifiers text instead of enum
    akcipher: Move the RSA DER encoding check to the crypto layer
    crypto: Add hash param to pkcs1pad
    sign-file: fix build with CMS support disabled
    MAINTAINERS: update tpmdd urls
    MODSIGN: linux/string.h should be #included to get memcpy()
    certs: Fix misaligned data in extra certificate list
    X.509: Handle midnight alternative notation in GeneralizedTime
    X.509: Support leap seconds
    Handle ISO 8601 leap seconds and encodings of midnight in mktime64()
    X.509: Fix leap year handling again
    PKCS#7: fix unitialized boolean 'want'
    firmware: change kernel read fail to dev_dbg()
    KEYS: Use the symbol value for list size, updated by scripts/insert-sys-cert
    KEYS: Reserve an extra certificate symbol for inserting without recompiling
    modsign: hide openssl output in silent builds
    tpm_tis: fix build warning with tpm_tis_resume
    ima: require signed IMA policy
    ima: measure and appraise the IMA policy itself
    ima: load policy using path
    ...

    Linus Torvalds
     

16 Mar, 2016

1 commit

  • Pull timer updates from Thomas Gleixner:
    "The timer department delivers this time:

    - Support for cross clock domain timestamps in the core code plus a
    first user. That allows more precise timestamping for PTP and
    later for audio and other peripherals.

    The ptp/e1000e patches have been acked by the relevant maintainers
    and are carried in the timer tree to avoid merge ordering issues.

    - Support for unregistering the current clocksource watchdog. That
    lifts a limitation for switching clocksources which has been there
    from day 1

    - The usual pile of fixes and updates to the core and the drivers.
    Nothing outstanding and exciting"

    * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (26 commits)
    time/timekeeping: Work around false positive GCC warning
    e1000e: Adds hardware supported cross timestamp on e1000e nic
    ptp: Add PTP_SYS_OFFSET_PRECISE for driver crosstimestamping
    x86/tsc: Always Running Timer (ART) correlated clocksource
    hrtimer: Revert CLOCK_MONOTONIC_RAW support
    time: Add history to cross timestamp interface supporting slower devices
    time: Add driver cross timestamp interface for higher precision time synchronization
    time: Remove duplicated code in ktime_get_raw_and_real()
    time: Add timekeeping snapshot code capturing system time and counter
    time: Add cycles to nanoseconds translation
    jiffies: Use CLOCKSOURCE_MASK instead of constant
    clocksource: Introduce clocksource_freq2mult()
    clockevents/drivers/exynos_mct: Implement ->set_state_oneshot_stopped()
    clockevents/drivers/arm_global_timer: Implement ->set_state_oneshot_stopped()
    clockevents/drivers/arm_arch_timer: Implement ->set_state_oneshot_stopped()
    clocksource/drivers/arm_global_timer: Register delay timer
    clocksource/drivers/lpc32xx: Support timer-based ARM delay
    clocksource/drivers/lpc32xx: Support periodic mode
    clocksource/drivers/lpc32xx: Don't use the prescaler counter for clockevents
    clocksource/drivers/rockchip: Add err handle for rk_timer_init
    ...

    Linus Torvalds
     

08 Mar, 2016

1 commit

  • Newer GCC versions trigger the following warning:

    kernel/time/timekeeping.c: In function ‘get_device_system_crosststamp’:
    kernel/time/timekeeping.c:987:5: warning: ‘clock_was_set_seq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    if (discontinuity) {
    ^
    kernel/time/timekeeping.c:1045:15: note: ‘clock_was_set_seq’ was declared here
    unsigned int clock_was_set_seq;
    ^

    GCC clearly is unable to recognize that the 'do_interp' boolean tracks
    the initialization status of 'clock_was_set_seq'.

    The GCC version used was:

    gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC)

    Work it around by initializing clock_was_set_seq to 0. Compilers that
    are able to recognize the code flow will eliminate the unnecessary
    initialization.

    Acked-by: Thomas Gleixner
    Cc: John Stultz
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

04 Mar, 2016

1 commit


03 Mar, 2016

6 commits

  • Revert commits:
    a6e707ddbdf1: KVM: arm/arm64: timer: Switch to CLOCK_MONOTONIC_RAW
    9006a01829a5: hrtimer: Catch illegal clockids
    9c808765e88e: hrtimer: Add support for CLOCK_MONOTONIC_RAW

    Marc found out, that there are fundamental issues with that patch series
    because __hrtimer_get_next_event() and hrtimer_forward() need support for
    CLOCK_MONOTONIC_RAW. Nothing which is easily fixed, so revert the whole lot.

    Reported-by: Marc Zyngier
    Link: http://lkml.kernel.org/r/56D6CEF0.8060607@arm.com
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • Another representative use case of time sync and the correlated
    clocksource (in addition to PTP noted above) is PTP synchronized
    audio.

    In a streaming application, as an example, samples will be sent and/or
    received by multiple devices with a presentation time that is in terms
    of the PTP master clock. Synchronizing the audio output on these
    devices requires correlating the audio clock with the PTP master
    clock. The more precise this correlation is, the better the audio
    quality (i.e. out of sync audio sounds bad).

    From an application standpoint, to correlate the PTP master clock with
    the audio device clock, the system clock is used as a intermediate
    timebase. The transforms such an application would perform are:

    System Clock Audio clock
    System Clock Network Device Clock [ PTP Master Clock]

    Modern Intel platforms can perform a more accurate cross timestamp in
    hardware (ART,audio device clock). The audio driver requires
    ART->system time transforms -- the same as required for the network
    driver. These platforms offload audio processing (including
    cross-timestamps) to a DSP which to ensure uninterrupted audio
    processing, communicates and response to the host only once every
    millsecond. As a result is takes up to a millisecond for the DSP to
    receive a request, the request is processed by the DSP, the audio
    output hardware is polled for completion, the result is copied into
    shared memory, and the host is notified. All of these operation occur
    on a millisecond cadence. This transaction requires about 2 ms, but
    under heavier workloads it may take up to 4 ms.

    Adding a history allows these slow devices the option of providing an
    ART value outside of the current interval. In this case, the callback
    provided is an accessor function for the previously obtained counter
    value. If get_system_device_crosststamp() receives a counter value
    previous to cycle_last, it consults the history provided as an
    argument in history_ref and interpolates the realtime and monotonic
    raw system time using the provided counter value. If there are any
    clock discontinuities, e.g. from calling settimeofday(), the monotonic
    raw time is interpolated in the usual way, but the realtime clock time
    is adjusted by scaling the monotonic raw adjustment.

    When an accessor function is used a history argument *must* be
    provided. The history is initialized using ktime_get_snapshot() and
    must be called before the counter values are read.

    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Andy Lutomirski
    Cc: kevin.b.stanton@intel.com
    Cc: kevin.j.clarke@intel.com
    Cc: hpa@zytor.com
    Cc: jeffrey.t.kirsher@intel.com
    Cc: netdev@vger.kernel.org
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Christopher S. Hall
    [jstultz: Fixed up cycles_t/cycle_t type confusion]
    Signed-off-by: John Stultz

    Christopher S. Hall
     
  • ACKNOWLEDGMENT: cross timestamp code was developed by Thomas Gleixner
    . It has changed considerably and any mistakes are
    mine.

    The precision with which events on multiple networked systems can be
    synchronized using, as an example, PTP (IEEE 1588, 802.1AS) is limited
    by the precision of the cross timestamps between the system clock and
    the device (timestamp) clock. Precision here is the degree of
    simultaneity when capturing the cross timestamp.

    Currently the PTP cross timestamp is captured in software using the
    PTP device driver ioctl PTP_SYS_OFFSET. Reads of the device clock are
    interleaved with reads of the realtime clock. At best, the precision
    of this cross timestamp is on the order of several microseconds due to
    software latencies. Sub-microsecond precision is required for
    industrial control and some media applications. To achieve this level
    of precision hardware supported cross timestamping is needed.

    The function get_device_system_crosstimestamp() allows device drivers
    to return a cross timestamp with system time properly scaled to
    nanoseconds. The realtime value is needed to discipline that clock
    using PTP and the monotonic raw value is used for applications that
    don't require a "real" time, but need an unadjusted clock time. The
    get_device_system_crosstimestamp() code calls back into the driver to
    ensure that the system counter is within the current timekeeping
    update interval.

    Modern Intel hardware provides an Always Running Timer (ART) which is
    exactly related to TSC through a known frequency ratio. The ART is
    routed to devices on the system and is used to precisely and
    simultaneously capture the device clock with the ART.

    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Andy Lutomirski
    Cc: kevin.b.stanton@intel.com
    Cc: kevin.j.clarke@intel.com
    Cc: hpa@zytor.com
    Cc: jeffrey.t.kirsher@intel.com
    Cc: netdev@vger.kernel.org
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Christopher S. Hall
    [jstultz: Reworked to remove extra structures and simplify calling]
    Signed-off-by: John Stultz

    Christopher S. Hall
     
  • The code in ktime_get_snapshot() is a superset of the code in
    ktime_get_raw_and_real() code. Further, ktime_get_raw_and_real() is
    called only by the PPS code, pps_get_ts(). Consolidate the
    pps_get_ts() code into a single function calling ktime_get_snapshot()
    and eliminate ktime_get_raw_and_real(). A side effect of this is that
    the raw and real results of pps_get_ts() correspond to exactly the
    same clock cycle. Previously these values represented separate reads
    of the system clock.

    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Andy Lutomirski
    Cc: kevin.b.stanton@intel.com
    Cc: kevin.j.clarke@intel.com
    Cc: hpa@zytor.com
    Cc: jeffrey.t.kirsher@intel.com
    Cc: netdev@vger.kernel.org
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Christopher S. Hall
    Signed-off-by: John Stultz

    Christopher S. Hall
     
  • In the current timekeeping code there isn't any interface to
    atomically capture the current relationship between the system counter
    and system time. ktime_get_snapshot() returns this triple (counter,
    monotonic raw, realtime) in the system_time_snapshot struct.

    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Andy Lutomirski
    Cc: kevin.b.stanton@intel.com
    Cc: kevin.j.clarke@intel.com
    Cc: hpa@zytor.com
    Cc: jeffrey.t.kirsher@intel.com
    Cc: netdev@vger.kernel.org
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Christopher S. Hall
    [jstultz: Moved structure definitions around to clean things up,
    fixed cycles_t/cycle_t confusion.]
    Signed-off-by: John Stultz

    Christopher S. Hall
     
  • The timekeeping code does not currently provide a way to translate
    externally provided clocksource cycles to system time. The cycle count
    is always provided by the result clocksource read() method internal to
    the timekeeping code. The added function timekeeping_cycles_to_ns()
    calculated a nanosecond value from a cycle count that can be added to
    tk_read_base.base value yielding the current system time. This allows
    clocksource cycle values external to the timekeeping code to provide a
    cycle count that can be transformed to system time.

    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Andy Lutomirski
    Cc: kevin.b.stanton@intel.com
    Cc: kevin.j.clarke@intel.com
    Cc: hpa@zytor.com
    Cc: jeffrey.t.kirsher@intel.com
    Cc: netdev@vger.kernel.org
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Christopher S. Hall
    Signed-off-by: John Stultz

    Christopher S. Hall
     

02 Mar, 2016

6 commits

  • Instead of checking sched_clock_stable from the nohz subsystem to verify
    its tick dependency, migrate it to the new mask in order to include it
    to the all-in-one check.

    Reviewed-by: Chris Metcalf
    Cc: Christoph Lameter
    Cc: Chris Metcalf
    Cc: Ingo Molnar
    Cc: Luiz Capitulino
    Cc: Peter Zijlstra
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: Viresh Kumar
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • Instead of providing asynchronous checks for the nohz subsystem to verify
    posix cpu timers tick dependency, migrate the latter to the new mask.

    In order to keep track of the running timers and expose the tick
    dependency accordingly, we must probe the timers queuing and dequeuing
    on threads and process lists.

    Unfortunately it implies both task and signal level dependencies. We
    should be able to further optimize this and merge all that on the task
    level dependency, at the cost of a bit of complexity and may be overhead.

    Reviewed-by: Chris Metcalf
    Cc: Christoph Lameter
    Cc: Chris Metcalf
    Cc: Ingo Molnar
    Cc: Luiz Capitulino
    Cc: Peter Zijlstra
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: Viresh Kumar
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • Instead of providing asynchronous checks for the nohz subsystem to verify
    sched tick dependency, migrate sched to the new mask.

    Everytime a task is enqueued or dequeued, we evaluate the state of the
    tick dependency on top of the policy of the tasks in the runqueue, by
    order of priority:

    SCHED_DEADLINE: Need the tick in order to periodically check for runtime
    SCHED_FIFO : Don't need the tick (no round-robin)
    SCHED_RR : Need the tick if more than 1 task of the same priority
    for round robin (simplified with checking if more than
    one SCHED_RR task no matter what priority).
    SCHED_NORMAL : Need the tick if more than 1 task for round-robin.

    We could optimize that further with one flag per sched policy on the tick
    dependency mask and perform only the checks relevant to the policy
    concerned by an enqueue/dequeue operation.

    Since the checks aren't based on the current task anymore, we could get
    rid of the task switch hook but it's still needed for posix cpu
    timers.

    Reviewed-by: Chris Metcalf
    Cc: Christoph Lameter
    Cc: Chris Metcalf
    Cc: Ingo Molnar
    Cc: Luiz Capitulino
    Cc: Peter Zijlstra
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: Viresh Kumar
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • Instead of providing asynchronous checks for the nohz subsystem to verify
    perf event tick dependency, migrate perf to the new mask.

    Perf needs the tick for two situations:

    1) Freq events. We could set the tick dependency when those are
    installed on a CPU context. But setting a global dependency on top of
    the global freq events accounting is much easier. If people want that
    to be optimized, we can still refine that on the per-CPU tick dependency
    level. This patch dooesn't change the current behaviour anyway.

    2) Throttled events: this is a per-cpu dependency.

    Reviewed-by: Chris Metcalf
    Cc: Christoph Lameter
    Cc: Chris Metcalf
    Cc: Ingo Molnar
    Cc: Luiz Capitulino
    Cc: Peter Zijlstra
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: Viresh Kumar
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • It makes nohz tracing more lightweight, standard and easier to parse.

    Examples:

    user_loop-2904 [007] d..1 517.701126: tick_stop: success=1 dependency=NONE
    user_loop-2904 [007] dn.1 518.021181: tick_stop: success=0 dependency=SCHED
    posix_timers-6142 [007] d..1 1739.027400: tick_stop: success=0 dependency=POSIX_TIMER
    user_loop-5463 [007] dN.1 1185.931939: tick_stop: success=0 dependency=PERF_EVENTS

    Suggested-by: Peter Zijlstra
    Reviewed-by: Chris Metcalf
    Cc: Christoph Lameter
    Cc: Chris Metcalf
    Cc: Ingo Molnar
    Cc: Luiz Capitulino
    Cc: Peter Zijlstra
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: Viresh Kumar
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • The tick dependency is evaluated on every IRQ and context switch. This
    consists is a batch of checks which determine whether it is safe to
    stop the tick or not. These checks are often split in many details:
    posix cpu timers, scheduler, sched clock, perf events.... each of which
    are made of smaller details: posix cpu timer involves checking process
    wide timers then thread wide timers. Perf involves checking freq events
    then more per cpu details.

    Checking these informations asynchronously every time we update the full
    dynticks state bring avoidable overhead and a messy layout.

    Let's introduce instead tick dependency masks: one for system wide
    dependency (unstable sched clock, freq based perf events), one for CPU
    wide dependency (sched, throttling perf events), and task/signal level
    dependencies (posix cpu timers). The subsystems are responsible
    for setting and clearing their dependency through a set of APIs that will
    take care of concurrent dependency mask modifications and kick targets
    to restart the relevant CPU tick whenever needed.

    This new dependency engine stays beside the old one until all subsystems
    having a tick dependency are converted to it.

    Suggested-by: Thomas Gleixner
    Suggested-by: Peter Zijlstra
    Reviewed-by: Chris Metcalf
    Cc: Christoph Lameter
    Cc: Chris Metcalf
    Cc: Ingo Molnar
    Cc: Luiz Capitulino
    Cc: Peter Zijlstra
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: Viresh Kumar
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     

29 Feb, 2016

1 commit

  • Handle the following ISO 8601 features in mktime64():

    (1) Leap seconds.

    Leap seconds are indicated by the seconds parameter being the value
    60. Handle this by treating it the same as 00 of the following
    minute.

    It has been pointed out that a minute may contain two leap seconds.
    However, pending discussion of what that looks like and how to handle
    it, I'm not going to concern myself with it.

    (2) Alternate encodings of midnight.

    Two different encodings of midnight are permitted - 00:00:00 and
    24:00:00 - the first is midnight today and the second is midnight
    tomorrow and is exactly equivalent to the first with tomorrow's date.

    As it happens, we don't actually need to change mktime64() to handle either
    of these - just comment them as valid parameters.

    These facility will be used by the X.509 parser. Doing it in mktime64()
    makes the policy common to the whole kernel and easier to find.

    Signed-off-by: David Howells
    Acked-by: Arnd Bergmann
    cc: John Stultz
    cc: Rudolf Polzer
    cc: One Thousand Gnomes

    David Howells
     

27 Feb, 2016

1 commit

  • The CLOCKSOURCE_MASK(32) macro expands to the same value, but
    makes code more readable.

    Signed-off-by: Alexander Kuleshov
    Signed-off-by: John Stultz
    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Link: http://lkml.kernel.org/r/1456542854-22104-3-git-send-email-john.stultz@linaro.org
    Signed-off-by: Thomas Gleixner

    Alexander Kuleshov
     

15 Feb, 2016

1 commit


13 Feb, 2016

1 commit

  • It simplifies it and allows wide kick to be performed, even when IRQs
    are disabled, without an asynchronous level in the middle.

    This comes at a cost of some more overhead on features like perf and
    posix cpu timers slow-paths, which is probably not much important
    for nohz full users.

    Requested-by: Peter Zijlstra
    Reviewed-by: Chris Metcalf
    Cc: Christoph Lameter
    Cc: Chris Metcalf
    Cc: Ingo Molnar
    Cc: Luiz Capitulino
    Cc: Peter Zijlstra
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: Viresh Kumar
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     

01 Feb, 2016

1 commit

  • Pull timer fixes from Thomas Gleixner:
    "The timer departement delivers:

    - a regression fix for the NTP code along with a proper selftest
    - prevent a spurious timer interrupt in the NOHZ lowres code
    - a fix for user space interfaces returning the remaining time on
    architectures with CONFIG_TIME_LOW_RES=y
    - a few patches to fix COMPILE_TEST fallout"

    * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    tick/nohz: Set the correct expiry when switching to nohz/lowres mode
    clocksource: Fix dependencies for archs w/o HAS_IOMEM
    clocksource: Select CLKSRC_MMIO where needed
    tick/sched: Hide unused oneshot timer code
    kselftests: timers: Add adjtimex SETOFFSET validity tests
    ntp: Fix ADJ_SETOFFSET being used w/ ADJ_NANO
    itimers: Handle relative timers with CONFIG_TIME_LOW_RES proper
    posix-timers: Handle relative timers with CONFIG_TIME_LOW_RES proper
    timerfd: Handle relative timers with CONFIG_TIME_LOW_RES proper
    hrtimer: Handle remaining time proper for TIME_LOW_RES
    clockevents/tcb_clksrc: Prevent disabling an already disabled clock

    Linus Torvalds
     

27 Jan, 2016

4 commits

  • commit 0ff53d096422 sets the next tick interrupt to the last jiffies update,
    i.e. in the past, because the forward operation is invoked before the set
    operation. There is no resulting damage (yet), but we get an extra pointless
    tick interrupt.

    Revert the order so we get the next tick interrupt in the future.

    Fixes: commit 0ff53d096422 "tick: sched: Force tick interrupt and get rid of softirq magic"
    Signed-off-by: Wanpeng Li
    Cc: Peter Zijlstra
    Cc: Frederic Weisbecker
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/1453893967-3458-1-git-send-email-wanpeng.li@hotmail.com
    Signed-off-by: Thomas Gleixner

    Wanpeng Li
     
  • Hyper-V vmbus module registers TSC page clocksource when loaded. This is
    the clocksource with the highest rating and thus it becomes the watchdog
    making unloading of the vmbus module impossible.
    Separate clocksource_select_watchdog() from clocksource_enqueue_watchdog()
    and use it on clocksource register/rating change/unregister.

    After all, lobotomized monkeys may need some love too.

    Signed-off-by: Vitaly Kuznetsov
    Cc: John Stultz
    Cc: Dexuan Cui
    Cc: K. Y. Srinivasan
    Link: http://lkml.kernel.org/r/1453483913-25672-1-git-send-email-vkuznets@redhat.com
    Signed-off-by: Thomas Gleixner

    Vitaly Kuznetsov
     
  • It is way too easy to take any random clockid and feed it to
    the hrtimer subsystem. At best, it gets mapped to a monotonic
    base, but it would be better to just catch illegal values as
    early as possible.

    This patch does exactly that, mapping illegal clockids to an
    illegal base index, and panicing when we detect the illegal
    condition.

    Signed-off-by: Marc Zyngier
    Cc: Tomasz Nowicki
    Cc: Christoffer Dall
    Link: http://lkml.kernel.org/r/1452879670-16133-3-git-send-email-marc.zyngier@arm.com
    Signed-off-by: Thomas Gleixner

    Marc Zyngier
     
  • The KVM/ARM timer implementation arms a hrtimer when a vcpu is
    blocked (usually because it is waiting for an interrupt)
    while its timer is going to kick in the future.

    It is essential that this timer doesn't get adjusted, or the
    guest will end up being woken-up at the wrong time (NTP running
    on the host seems to confuse the hell out of some guests).

    In order to allow this, let's add CLOCK_MONOTONIC_RAW support
    to hrtimer (it is so far only supported for posix timers). It also
    has the (limited) benefit of fixing de0421d53bfb ("mac80211_hwsim:
    shuffle code to prepare for dynamic radios"), which already uses
    this functionnality without realizing wasn't implemented (just being
    lucky...).

    Signed-off-by: Marc Zyngier
    Cc: Tomasz Nowicki
    Cc: Christoffer Dall
    Link: http://lkml.kernel.org/r/1452879670-16133-2-git-send-email-marc.zyngier@arm.com
    Signed-off-by: Thomas Gleixner

    Marc Zyngier
     

26 Jan, 2016

1 commit

  • A couple of functions in kernel/time/tick-sched.c are only
    relevant for oneshot timer mode, i.e. when hires-timers or
    nohz mode are enabled. If both are disabled, we get gcc warnings
    about them:

    kernel/time/tick-sched.c:98:16: warning: 'tick_init_jiffy_update' defined but not used [-Wunused-function]
    static ktime_t tick_init_jiffy_update(void)
    ^
    kernel/time/tick-sched.c:112:13: warning: 'tick_sched_do_timer' defined but not used [-Wunused-function]
    static void tick_sched_do_timer(ktime_t now)
    ^
    kernel/time/tick-sched.c:134:13: warning: 'tick_sched_handle' defined but not used [-Wunused-function]
    static void tick_sched_handle(struct tick_sched *ts, struct pt_regs *regs)
    ^

    This encloses the whole set of functions in an appropriate ifdef
    to avoid the warning and to make it clearer when they are used.

    Signed-off-by: Arnd Bergmann
    Cc: linux-arm-kernel@lists.infradead.org
    Link: http://lkml.kernel.org/r/1453736525-1959191-1-git-send-email-arnd@arndb.de
    Signed-off-by: Thomas Gleixner

    Arnd Bergmann
     

22 Jan, 2016

1 commit

  • Recently, in commit 37cf4dc3370f I forgot to check if the timeval being passed
    was actually a timespec (as is signaled with ADJ_NANO).

    This resulted in that patch breaking ADJ_SETOFFSET users who set
    ADJ_NANO, by rejecting valid timespecs that were compared with
    valid timeval ranges.

    This patch addresses this by checking for the ADJ_NANO flag and
    using the timepsec check instead in that case.

    Reported-by: Harald Hoyer
    Reported-by: Kay Sievers
    Fixes: 37cf4dc3370f "time: Verify time values in adjtimex ADJ_SETOFFSET to avoid overflow"
    Signed-off-by: John Stultz
    Cc: Sasha Levin
    Cc: Richard Cochran
    Cc: Prarit Bhargava
    Cc: David Herrmann
    Link: http://lkml.kernel.org/r/1453417415-19110-2-git-send-email-john.stultz@linaro.org
    Signed-off-by: Thomas Gleixner

    John Stultz
     

21 Jan, 2016

1 commit

  • * pm-cpuidle:
    cpuidle: menu: Avoid pointless checks in menu_select()
    sched / idle: Drop default_idle_call() fallback from call_cpuidle()
    cpuidle: Don't enable all governors by default
    cpuidle: Default to ladder governor on ticking systems
    time: nohz: Expose tick_nohz_enabled
    cpuidle: menu: Fix menu_select() for CPUIDLE_DRIVER_STATE_START == 0

    Rafael J. Wysocki
     

17 Jan, 2016

3 commits

  • As Helge reported for timerfd we have the same issue in itimers. We return
    remaining time larger than the programmed relative time to user space in case
    of CONFIG_TIME_LOW_RES=y. Use the proper function to adjust the extra time
    added in hrtimer_start_range_ns().

    Signed-off-by: Thomas Gleixner
    Cc: Peter Zijlstra
    Cc: Helge Deller
    Cc: John Stultz
    Cc: linux-m68k@lists.linux-m68k.org
    Cc: dhowells@redhat.com
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/20160114164159.528222587@linutronix.de
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • As Helge reported for timerfd we have the same issue in posix timers. We
    return remaining time larger than the programmed relative time to user space
    in case of CONFIG_TIME_LOW_RES=y. Use the proper function to adjust the extra
    time added in hrtimer_start_range_ns().

    Signed-off-by: Thomas Gleixner
    Cc: Peter Zijlstra
    Cc: Helge Deller
    Cc: John Stultz
    Cc: linux-m68k@lists.linux-m68k.org
    Cc: dhowells@redhat.com
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/20160114164159.450510905@linutronix.de
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • If CONFIG_TIME_LOW_RES is enabled we add a jiffie to the relative timeout to
    prevent short sleeps, but we do not account for that in interfaces which
    retrieve the remaining time.

    Helge observed that timerfd can return a remaining time larger than the
    relative timeout. That's not expected and breaks userland test programs.

    Store the information that the timer was armed relative and provide functions
    to adjust the remaining time. To avoid bloating the hrtimer struct make state
    a u8, which as a bonus results in better code on x86 at least.

    Reported-and-tested-by: Helge Deller
    Signed-off-by: Thomas Gleixner
    Cc: Peter Zijlstra
    Cc: John Stultz
    Cc: linux-m68k@lists.linux-m68k.org
    Cc: dhowells@redhat.com
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/20160114164159.273328486@linutronix.de
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

16 Jan, 2016

1 commit


12 Jan, 2016

1 commit