Skip to content

Commit 4a89452

Browse files
committed
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Ingo Molnar: "Two clocksource driver fixes, and an idle loop RCU warning fix" * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: clocksource/drivers/sun5i: Fix cpufreq interaction with sched_clock() clocksource/drivers: Fix various !CONFIG_HAS_IOMEM build errors timers/tick/broadcast-hrtimer: Fix suspicious RCU usage in idle loop
2 parents 19dba4f + 6e20602 commit 4a89452

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

drivers/clocksource/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ config SYS_SUPPORTS_EM_STI
192192
config SH_TIMER_CMT
193193
bool "Renesas CMT timer driver" if COMPILE_TEST
194194
depends on GENERIC_CLOCKEVENTS
195+
depends on HAS_IOMEM
195196
default SYS_SUPPORTS_SH_CMT
196197
help
197198
This enables build of a clocksource and clockevent driver for
@@ -201,6 +202,7 @@ config SH_TIMER_CMT
201202
config SH_TIMER_MTU2
202203
bool "Renesas MTU2 timer driver" if COMPILE_TEST
203204
depends on GENERIC_CLOCKEVENTS
205+
depends on HAS_IOMEM
204206
default SYS_SUPPORTS_SH_MTU2
205207
help
206208
This enables build of a clockevent driver for the Multi-Function
@@ -210,6 +212,7 @@ config SH_TIMER_MTU2
210212
config SH_TIMER_TMU
211213
bool "Renesas TMU timer driver" if COMPILE_TEST
212214
depends on GENERIC_CLOCKEVENTS
215+
depends on HAS_IOMEM
213216
default SYS_SUPPORTS_SH_TMU
214217
help
215218
This enables build of a clocksource and clockevent driver for

drivers/clocksource/timer-sun5i.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <linux/irq.h>
1818
#include <linux/irqreturn.h>
1919
#include <linux/reset.h>
20-
#include <linux/sched_clock.h>
2120
#include <linux/of.h>
2221
#include <linux/of_address.h>
2322
#include <linux/of_irq.h>
@@ -137,11 +136,6 @@ static struct irqaction sun5i_timer_irq = {
137136
.dev_id = &sun5i_clockevent,
138137
};
139138

140-
static u64 sun5i_timer_sched_read(void)
141-
{
142-
return ~readl(timer_base + TIMER_CNTVAL_LO_REG(1));
143-
}
144-
145139
static void __init sun5i_timer_init(struct device_node *node)
146140
{
147141
struct reset_control *rstc;
@@ -172,7 +166,6 @@ static void __init sun5i_timer_init(struct device_node *node)
172166
writel(TIMER_CTL_ENABLE | TIMER_CTL_RELOAD,
173167
timer_base + TIMER_CTL_REG(1));
174168

175-
sched_clock_register(sun5i_timer_sched_read, 32, rate);
176169
clocksource_mmio_init(timer_base + TIMER_CNTVAL_LO_REG(1), node->name,
177170
rate, 340, 32, clocksource_mmio_readl_down);
178171

kernel/time/tick-broadcast-hrtimer.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ static void bc_set_mode(enum clock_event_mode mode,
4949
*/
5050
static int bc_set_next(ktime_t expires, struct clock_event_device *bc)
5151
{
52+
int bc_moved;
5253
/*
5354
* We try to cancel the timer first. If the callback is on
5455
* flight on some other cpu then we let it handle it. If we
@@ -60,9 +61,15 @@ static int bc_set_next(ktime_t expires, struct clock_event_device *bc)
6061
* restart the timer because we are in the callback, but we
6162
* can set the expiry time and let the callback return
6263
* HRTIMER_RESTART.
64+
*
65+
* Since we are in the idle loop at this point and because
66+
* hrtimer_{start/cancel} functions call into tracing,
67+
* calls to these functions must be bound within RCU_NONIDLE.
6368
*/
64-
if (hrtimer_try_to_cancel(&bctimer) >= 0) {
65-
hrtimer_start(&bctimer, expires, HRTIMER_MODE_ABS_PINNED);
69+
RCU_NONIDLE(bc_moved = (hrtimer_try_to_cancel(&bctimer) >= 0) ?
70+
!hrtimer_start(&bctimer, expires, HRTIMER_MODE_ABS_PINNED) :
71+
0);
72+
if (bc_moved) {
6673
/* Bind the "device" to the cpu */
6774
bc->bound_on = smp_processor_id();
6875
} else if (bc->bound_on == smp_processor_id()) {

0 commit comments

Comments
 (0)