Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 few updates for timers & co:

- prevent a livelock in the timekeeping code when debugging is
enabled

- prevent out of bounds access in the timekeeping debug code

- various fixes in clocksource drivers

- a new maintainers entry"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function
drivers/clocksource/pistachio: Fix memory corruption in init
clocksource/drivers/timer-atmel-pit: Enable mck clock
clocksource/drivers/pxa: Fix include files for compilation
MAINTAINERS: Add ARM ARCHITECTED TIMER entry
timekeeping: Cap array access in timekeeping_debug
timekeeping: Avoid taking lock in NMI path with CONFIG_DEBUG_TIMEKEEPING

+40 -8
+9
MAINTAINERS
··· 881 881 F: drivers/gpu/drm/arc/ 882 882 F: Documentation/devicetree/bindings/display/snps,arcpgu.txt 883 883 884 + ARM ARCHITECTED TIMER DRIVER 885 + M: Mark Rutland <mark.rutland@arm.com> 886 + M: Marc Zyngier <marc.zyngier@arm.com> 887 + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 888 + S: Maintained 889 + F: arch/arm/include/asm/arch_timer.h 890 + F: arch/arm64/include/asm/arch_timer.h 891 + F: drivers/clocksource/arm_arch_timer.c 892 + 884 893 ARM HDLCD DRM DRIVER 885 894 M: Liviu Dudau <liviu.dudau@arm.com> 886 895 S: Supported
+2
drivers/clocksource/pxa_timer.c
··· 21 21 #include <linux/of_irq.h> 22 22 #include <linux/sched_clock.h> 23 23 24 + #include <clocksource/pxa.h> 25 + 24 26 #include <asm/div64.h> 25 27 26 28 #define OSMR0 0x00 /* OS Timer 0 Match Register */
+8 -1
drivers/clocksource/sun4i_timer.c
··· 123 123 .set_next_event = sun4i_clkevt_next_event, 124 124 }; 125 125 126 + static void sun4i_timer_clear_interrupt(void) 127 + { 128 + writel(TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_ST_REG); 129 + } 126 130 127 131 static irqreturn_t sun4i_timer_interrupt(int irq, void *dev_id) 128 132 { 129 133 struct clock_event_device *evt = (struct clock_event_device *)dev_id; 130 134 131 - writel(0x1, timer_base + TIMER_IRQ_ST_REG); 135 + sun4i_timer_clear_interrupt(); 132 136 evt->event_handler(evt); 133 137 134 138 return IRQ_HANDLED; ··· 211 207 212 208 /* Make sure timer is stopped before playing with interrupts */ 213 209 sun4i_clkevt_time_stop(0); 210 + 211 + /* clear timer0 interrupt */ 212 + sun4i_timer_clear_interrupt(); 214 213 215 214 sun4i_clockevent.cpumask = cpu_possible_mask; 216 215 sun4i_clockevent.irq = irq;
+4 -4
drivers/clocksource/time-pistachio.c
··· 202 202 rate = clk_get_rate(fast_clk); 203 203 204 204 /* Disable irq's for clocksource usage */ 205 - gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 0); 206 - gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 1); 207 - gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 2); 208 - gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 3); 205 + gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 0); 206 + gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 1); 207 + gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 2); 208 + gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 3); 209 209 210 210 /* Enable timer block */ 211 211 writel(TIMER_ME_GLOBAL, pcs_gpt.base);
+6
drivers/clocksource/timer-atmel-pit.c
··· 261 261 return PTR_ERR(data->mck); 262 262 } 263 263 264 + ret = clk_prepare_enable(data->mck); 265 + if (ret) { 266 + pr_err("Unable to enable mck\n"); 267 + return ret; 268 + } 269 + 264 270 /* Get the interrupts property */ 265 271 data->irq = irq_of_parse_and_map(node, 0); 266 272 if (!data->irq) {
+4 -1
kernel/time/timekeeping.c
··· 401 401 do { 402 402 seq = raw_read_seqcount_latch(&tkf->seq); 403 403 tkr = tkf->base + (seq & 0x01); 404 - now = ktime_to_ns(tkr->base) + timekeeping_get_ns(tkr); 404 + now = ktime_to_ns(tkr->base); 405 + 406 + now += clocksource_delta(tkr->read(tkr->clock), 407 + tkr->cycle_last, tkr->mask); 405 408 } while (read_seqcount_retry(&tkf->seq, seq)); 406 409 407 410 return now;
+7 -2
kernel/time/timekeeping_debug.c
··· 23 23 24 24 #include "timekeeping_internal.h" 25 25 26 - static unsigned int sleep_time_bin[32] = {0}; 26 + #define NUM_BINS 32 27 + 28 + static unsigned int sleep_time_bin[NUM_BINS] = {0}; 27 29 28 30 static int tk_debug_show_sleep_time(struct seq_file *s, void *data) 29 31 { ··· 71 69 72 70 void tk_debug_account_sleep_time(struct timespec64 *t) 73 71 { 74 - sleep_time_bin[fls(t->tv_sec)]++; 72 + /* Cap bin index so we don't overflow the array */ 73 + int bin = min(fls(t->tv_sec), NUM_BINS-1); 74 + 75 + sleep_time_bin[bin]++; 75 76 } 76 77