aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-24 07:16:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-24 07:16:42 -0400
commit6242258b6b472f8fdd8ed9b735cc1190c185d16d (patch)
treec8e4c5e31a9c142308d7aca9e920330e0b025d72
parent78fea6334f725f1a55cb5761730ceab64255cf1a (diff)
parentabcbcb80cd09cd40f2089d912764e315459b71f7 (diff)
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Thomas Gleixner: "A small set of fixes for time(r) related issues: - Fix a long standing conversion issue in jiffies_to_msecs() for odd HZ values like 1024 or 1200 which resulted in returning 0 for small jiffies values due to rounding down. - Use the proper CONFIG symbol in the new Y2038 safe compat code for posix-timers. Not yet a visible breakage, but this will immediately trigger when the architecture support for the new interfaces is merged. - Return an error code in the STM32 clocksource driver on failure instead of success. - Remove the redundant and stale irq disabled check in the posix cpu timer code. The check is at the wrong place anyway and lockdep already covers it via the sighand lock locking coverage" * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: time: Make sure jiffies_to_msecs() preserves non-zero time periods posix-timers: Fix nanosleep_copyout() for CONFIG_COMPAT_32BIT_TIME clocksource/drivers/stm32: Fix error return code posix-cpu-timers: Remove lockdep_assert_irqs_disabled()
-rw-r--r--drivers/clocksource/timer-stm32.c4
-rw-r--r--kernel/time/hrtimer.c2
-rw-r--r--kernel/time/posix-cpu-timers.c2
-rw-r--r--kernel/time/time.c6
4 files changed, 8 insertions, 6 deletions
diff --git a/drivers/clocksource/timer-stm32.c b/drivers/clocksource/timer-stm32.c
index e5cdc3af684c..2717f88c7904 100644
--- a/drivers/clocksource/timer-stm32.c
+++ b/drivers/clocksource/timer-stm32.c
@@ -304,8 +304,10 @@ static int __init stm32_timer_init(struct device_node *node)
304 304
305 to->private_data = kzalloc(sizeof(struct stm32_timer_private), 305 to->private_data = kzalloc(sizeof(struct stm32_timer_private),
306 GFP_KERNEL); 306 GFP_KERNEL);
307 if (!to->private_data) 307 if (!to->private_data) {
308 ret = -ENOMEM;
308 goto deinit; 309 goto deinit;
310 }
309 311
310 rstc = of_reset_control_get(node, NULL); 312 rstc = of_reset_control_get(node, NULL);
311 if (!IS_ERR(rstc)) { 313 if (!IS_ERR(rstc)) {
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 055a4a728c00..3e93c54bd3a1 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1659,7 +1659,7 @@ EXPORT_SYMBOL_GPL(hrtimer_init_sleeper);
1659int nanosleep_copyout(struct restart_block *restart, struct timespec64 *ts) 1659int nanosleep_copyout(struct restart_block *restart, struct timespec64 *ts)
1660{ 1660{
1661 switch(restart->nanosleep.type) { 1661 switch(restart->nanosleep.type) {
1662#ifdef CONFIG_COMPAT 1662#ifdef CONFIG_COMPAT_32BIT_TIME
1663 case TT_COMPAT: 1663 case TT_COMPAT:
1664 if (compat_put_timespec64(ts, restart->nanosleep.compat_rmtp)) 1664 if (compat_put_timespec64(ts, restart->nanosleep.compat_rmtp))
1665 return -EFAULT; 1665 return -EFAULT;
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 5a6251ac6f7a..9cdf54b04ca8 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -604,7 +604,6 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
604 /* 604 /*
605 * Disarm any old timer after extracting its expiry time. 605 * Disarm any old timer after extracting its expiry time.
606 */ 606 */
607 lockdep_assert_irqs_disabled();
608 607
609 ret = 0; 608 ret = 0;
610 old_incr = timer->it.cpu.incr; 609 old_incr = timer->it.cpu.incr;
@@ -1049,7 +1048,6 @@ static void posix_cpu_timer_rearm(struct k_itimer *timer)
1049 /* 1048 /*
1050 * Now re-arm for the new expiry time. 1049 * Now re-arm for the new expiry time.
1051 */ 1050 */
1052 lockdep_assert_irqs_disabled();
1053 arm_timer(timer); 1051 arm_timer(timer);
1054unlock: 1052unlock:
1055 unlock_task_sighand(p, &flags); 1053 unlock_task_sighand(p, &flags);
diff --git a/kernel/time/time.c b/kernel/time/time.c
index 6fa99213fc72..2b41e8e2d31d 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -28,6 +28,7 @@
28 */ 28 */
29 29
30#include <linux/export.h> 30#include <linux/export.h>
31#include <linux/kernel.h>
31#include <linux/timex.h> 32#include <linux/timex.h>
32#include <linux/capability.h> 33#include <linux/capability.h>
33#include <linux/timekeeper_internal.h> 34#include <linux/timekeeper_internal.h>
@@ -314,9 +315,10 @@ unsigned int jiffies_to_msecs(const unsigned long j)
314 return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC); 315 return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);
315#else 316#else
316# if BITS_PER_LONG == 32 317# if BITS_PER_LONG == 32
317 return (HZ_TO_MSEC_MUL32 * j) >> HZ_TO_MSEC_SHR32; 318 return (HZ_TO_MSEC_MUL32 * j + (1ULL << HZ_TO_MSEC_SHR32) - 1) >>
319 HZ_TO_MSEC_SHR32;
318# else 320# else
319 return (j * HZ_TO_MSEC_NUM) / HZ_TO_MSEC_DEN; 321 return DIV_ROUND_UP(j * HZ_TO_MSEC_NUM, HZ_TO_MSEC_DEN);
320# endif 322# endif
321#endif 323#endif
322} 324}