History

Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer updates from Thomas Gleixner: "The time/timekeeping/timer folks deliver with this update: - Fix a reintroduced signed/unsigned issue and cleanup the whole signed/unsigned mess in the timekeeping core so this wont happen accidentaly again. - Add a new trace clock based on boot time - Prevent injection of random sleep times when PM tracing abuses the RTC for storage - Make posix timers configurable for real tiny systems - Add tracepoints for the alarm timer subsystem so timer based suspend wakeups can be instrumented - The usual pile of fixes and updates to core and drivers" * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits) timekeeping: Use mul_u64_u32_shr() instead of open coding it timekeeping: Get rid of pointless typecasts timekeeping: Make the conversion call chain consistently unsigned timekeeping_Force_unsigned_clocksource_to_nanoseconds_conversion alarmtimer: Add tracepoints for alarm timers trace: Update documentation for mono, mono_raw and boot clock trace: Add an option for boot clock as trace clock timekeeping: Add a fast and NMI safe boot clock timekeeping/clocksource_cyc2ns: Document intended range limitation timekeeping: Ignore the bogus sleep time if pm_trace is enabled selftests/timers: Fix spelling mistake "Asyncrhonous" -> "Asynchronous" clocksource/drivers/bcm2835_timer: Unmap region obtained by of_iomap clocksource/drivers/arm_arch_timer: Map frame with of_io_request_and_map() arm64: dts: rockchip: Arch counter doesn't tick in system suspend clocksource/drivers/arm_arch_timer: Don't assume clock runs in suspend posix-timers: Make them configurable posix_cpu_timers: Move the add_device_randomness() call to a proper place timer: Move sys_alarm from timer.c to itimer.c ptp_clock: Allow for it to be optional Kconfig: Regenerate *.c_shipped files after previous changes ...

Linus Torvalds committed 9 years ago

Commit 9465d9c2 parents e71c397 c029a2b61 files · +1479 −1041Browse files

Showing the changes to kernel/time/timer.c (1 of 61 files). Show all

Unified · Split

kernel/time/timer.c+18−30
@@ -1615,7 +1615,8 @@ void update_process_times(int user_tick) · 1614 unmodified lines
1615 irq_work_tick();1615 irq_work_tick();
1616#endif1616#endif
1617 scheduler_tick();1617 scheduler_tick();
1618 run_posix_cpu_timers(p);1618 if (IS_ENABLED(CONFIG_POSIX_TIMERS))
1619 run_posix_cpu_timers(p);
1619}1620}
1620 1621
1621/**1622/**
@@ -1676,19 +1677,6 @@ void run_local_timers(void) · 54 unmodified lines
1676 raise_softirq(TIMER_SOFTIRQ);1677 raise_softirq(TIMER_SOFTIRQ);
1677}1678}
1678 1679
1679#ifdef __ARCH_WANT_SYS_ALARM
1680
1681/*
1682 * For backwards compatibility? This can be done in libc so Alpha
1683 * and all newer ports shouldn't need it.
1684 */
1685SYSCALL_DEFINE1(alarm, unsigned int, seconds)
1686{
1687 return alarm_setitimer(seconds);
1688}
1689
1690#endif
1691
1692static void process_timeout(unsigned long __data)1680static void process_timeout(unsigned long __data)
1693{1681{
1694 wake_up_process((struct task_struct *)__data);1682 wake_up_process((struct task_struct *)__data);
@@ -1705,11 +1693,12 @@ static void process_timeout(unsigned long __data) · 10 unmodified lines
1705 * You can set the task state as follows -1693 * You can set the task state as follows -
1706 *1694 *
1707 * %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to1695 * %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to
1708 * pass before the routine returns. The routine will return 01696 * pass before the routine returns unless the current task is explicitly
1697 * woken up, (e.g. by wake_up_process())".
1709 *1698 *
1710 * %TASK_INTERRUPTIBLE - the routine may return early if a signal is1699 * %TASK_INTERRUPTIBLE - the routine may return early if a signal is
1711 * delivered to the current task. In this case the remaining time1700 * delivered to the current task or the current task is explicitly woken
1712 * in jiffies will be returned, or 0 if the timer expired in time1701 * up.
1713 *1702 *
1714 * The current task state is guaranteed to be TASK_RUNNING when this1703 * The current task state is guaranteed to be TASK_RUNNING when this
1715 * routine returns.1704 * routine returns.
@@ -1718,7 +1707,9 @@ static void process_timeout(unsigned long __data) · 2 unmodified lines
1718 * the CPU away without a bound on the timeout. In this case the return1707 * the CPU away without a bound on the timeout. In this case the return
1719 * value will be %MAX_SCHEDULE_TIMEOUT.1708 * value will be %MAX_SCHEDULE_TIMEOUT.
1720 *1709 *
1721 * In all cases the return value is guaranteed to be non-negative.1710 * Returns 0 when the timer has expired otherwise the remaining time in
1711 * jiffies will be returned. In all cases the return value is guaranteed
1712 * to be non-negative.
1722 */1713 */
1723signed long __sched schedule_timeout(signed long timeout)1714signed long __sched schedule_timeout(signed long timeout)
1724{1715{
@@ -1910,16 +1901,6 @@ unsigned long msleep_interruptible(unsigned int msecs) · 185 unmodified lines
1910 1901
1911EXPORT_SYMBOL(msleep_interruptible);1902EXPORT_SYMBOL(msleep_interruptible);
1912 1903
1913static void __sched do_usleep_range(unsigned long min, unsigned long max)
1914{
1915 ktime_t kmin;
1916 u64 delta;
1917
1918 kmin = ktime_set(0, min * NSEC_PER_USEC);
1919 delta = (u64)(max - min) * NSEC_PER_USEC;
1920 schedule_hrtimeout_range(&kmin, delta, HRTIMER_MODE_REL);
1921}
1922
1923/**1904/**
1924 * usleep_range - Sleep for an approximate time1905 * usleep_range - Sleep for an approximate time
1925 * @min: Minimum time in usecs to sleep1906 * @min: Minimum time in usecs to sleep
@@ -1933,7 +1914,14 @@ static void __sched do_usleep_range(unsigned long min, unsigned long max) · 7 unmodified lines
1933 */1914 */
1934void __sched usleep_range(unsigned long min, unsigned long max)1915void __sched usleep_range(unsigned long min, unsigned long max)
1935{1916{
1936 __set_current_state(TASK_UNINTERRUPTIBLE);1917 ktime_t exp = ktime_add_us(ktime_get(), min);
1937 do_usleep_range(min, max);1918 u64 delta = (u64)(max - min) * NSEC_PER_USEC;
1919
1920 for (;;) {
1921 __set_current_state(TASK_UNINTERRUPTIBLE);
1922 /* Do not return before the requested sleep time has elapsed */
1923 if (!schedule_hrtimeout_range(&exp, delta, HRTIMER_MODE_ABS))
1924 break;
1925 }
1938}1926}
1939EXPORT_SYMBOL(usleep_range);1927EXPORT_SYMBOL(usleep_range);