timer updates for 4.2
Subsystems (5)
Linus,
please pull the latest timers-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-for-linus
This update from the timer departement contains:
- A series of patches which address a shortcoming in the tick broadcast code. If the broadcast device is not available or an hrtimer emulated broadcast device, some of the original assumptions lead to boot failures. I rather plugged all of the corner cases instead of only addressing the issue reported, so the change got a little larger. Has been extensivly tested on x86 and arm.
- Get rid of the last holdouts using do_posix_clock_monotonic_gettime()
- A regression fix for the imx clocksource driver
- An update to the new state callbacks mechanism for clockevents. This is required to simplify the conversion, which will take place in 4.3
Thanks,
tglx
------------------>
Philippe Reynes (1):
clocksource/imx: Define clocksource for mx27
Thomas Gleixner (13):
tick/broadcast: Prevent hrtimer recursion
tick/broadcast: Sanity check the shutdown of the local clock_event tick/broadcast: Make idle check independent from mode and config tick/broadcast: Prevent deep idle if no broadcast device available tick/broadcast: Move the check for periodic mode inside state handling tick/broadcast: Return busy if periodic mode and hrtimer broadcast tick/broadcast: Return busy when IPI is pending tick/broadcast: Check for hrtimer broadcast active early tick/broadcast: Handle spurious interrupts gracefully tick/broadcast: Unbreak CONFIG_GENERIC_CLOCKEVENTS=n build
cris: Replace do_posix_clock_monotonic_gettime()
time: Get rid of do_posix_clock_monotonic_gettime tick/broadcast: Prevent NULL pointer dereference
Viresh Kumar (1):
clockevents: Allow set-state callbacks to be optional
arch/cris/arch-v32/drivers/sync_serial.c | 2 +- drivers/clocksource/timer-imx-gpt.c | 1 + include/linux/tick.h | 7 +- include/linux/timekeeping.h | 1 - kernel/time/clockevents.c | 24 ++--- kernel/time/tick-broadcast.c | 163 ++++++++++++++++++++----------- kernel/time/tick-common.c | 21 ++++ kernel/time/tick-sched.h | 10 ++ 8 files changed, 155 insertions(+), 74 deletions(-)
arch/cris/arch-v32/drivers/sync_serial.c +1 -1
@@ -1464,7 +1464,7 @@ static inline void handle_rx_packet(struct sync_port *port)if (port->write_ts_idx ==NBR_IN_DESCR ) port->write_ts_idx =0 ; idx = port->write_ts_idx++; -do_posix_clock_monotonic_gettime (&port->timestamp[idx]); +ktime_get_ts (&port->timestamp[idx]); port->in_buffer_len += port->inbufchunk; }spin_unlock_irqrestore (&port->lock, flags);
drivers/clocksource/timer-imx-gpt.c +1 -0
@@ -529,6 +529,7 @@ static void __init imx6dl_timer_init_dt(struct device_node *np)CLOCKSOURCE_OF_DECLARE (imx1_timer,"fsl,imx1-gpt" , imx1_timer_init_dt);CLOCKSOURCE_OF_DECLARE (imx21_timer,"fsl,imx21-gpt" , imx21_timer_init_dt); +CLOCKSOURCE_OF_DECLARE (imx27_timer,"fsl,imx27-gpt" , imx21_timer_init_dt);CLOCKSOURCE_OF_DECLARE (imx31_timer,"fsl,imx31-gpt" , imx31_timer_init_dt);CLOCKSOURCE_OF_DECLARE (imx25_timer,"fsl,imx25-gpt" , imx31_timer_init_dt);CLOCKSOURCE_OF_DECLARE (imx50_timer,"fsl,imx50-gpt" , imx31_timer_init_dt);
include/linux/tick.h +5 -2
@@ -67,10 +67,13 @@ extern void tick_broadcast_control(enum tick_broadcast_mode mode);static inline void tick_broadcast_control (enum tick_broadcast_mode mode) { }#endif /* BROADCAST */ -#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST ) && defined(CONFIG_TICK_ONESHOT ) +#ifdef CONFIG_GENERIC_CLOCKEVENTS extern int tick_broadcast_oneshot_control (enum tick_broadcast_state state);#else -static inline int tick_broadcast_oneshot_control (enum tick_broadcast_state state) {return 0 ; } +static inline int tick_broadcast_oneshot_control (enum tick_broadcast_state state) +{ +return 0 ; +}#endif static inline void tick_broadcast_enable (void )
include/linux/timekeeping.h +0 -1
@@ -145,7 +145,6 @@ static inline void getboottime(struct timespec *ts) }#endif -#define do_posix_clock_monotonic_gettime (ts) ktime_get_ts(ts)#define ktime_get_real_ts64 (ts) getnstimeofday64(ts)/*
kernel/time/clockevents.c +9 -15
@@ -120,19 +120,25 @@ static int __clockevents_switch_state(struct clock_event_device *dev,/* The clockevent device is getting replaced. Shut it down. */ case CLOCK_EVT_STATE_SHUTDOWN : -return dev->set_state_shutdown (dev); +if (dev->set_state_shutdown) +return dev->set_state_shutdown (dev); +return 0 ;case CLOCK_EVT_STATE_PERIODIC :/* Core internal bug */ if (!(dev->features &CLOCK_EVT_FEAT_PERIODIC ))return -ENOSYS ; -return dev->set_state_periodic (dev); +if (dev->set_state_periodic) +return dev->set_state_periodic (dev); +return 0 ;case CLOCK_EVT_STATE_ONESHOT :/* Core internal bug */ if (!(dev->features &CLOCK_EVT_FEAT_ONESHOT ))return -ENOSYS ; -return dev->set_state_oneshot (dev); +if (dev->set_state_oneshot) +return dev->set_state_oneshot (dev); +return 0 ;case CLOCK_EVT_STATE_ONESHOT_STOPPED :/* Core internal bug */
@@ -471,18 +477,6 @@ static int clockevents_sanity_check(struct clock_event_device *dev)if (dev->features &CLOCK_EVT_FEAT_DUMMY )return 0 ; -/* New state-specific callbacks */ -if (!dev->set_state_shutdown) -return -EINVAL ; - -if ((dev->features &CLOCK_EVT_FEAT_PERIODIC ) && - !dev->set_state_periodic) -return -EINVAL ; - -if ((dev->features &CLOCK_EVT_FEAT_ONESHOT ) && - !dev->set_state_oneshot) -return -EINVAL ; -return 0 ; }
kernel/time/tick-broadcast.c +108 -55
241 lines not on this page · raw message
kernel/time/tick-common.c +21 -0
@@ -343,6 +343,27 @@ out_bc:tick_install_broadcast_device (newdev); } +/** +* tick_broadcast_oneshot_control - Enter/exit broadcast oneshot mode +* @state: The target state (enter/exit) +* +* The system enters/leaves a state, where affected devices might stop +* Returns 0 on success, -EBUSY if the cpu is used to broadcast wakeups. +* +* Called with interrupts disabled, so clockevents_lock is not +* required here because the local clock event device cannot go away +* under us. +*/ +int tick_broadcast_oneshot_control (enum tick_broadcast_state state) +{ +struct tick_device *td =this_cpu_ptr (&tick_cpu_device); + +if (!(td->evtdev->features &CLOCK_EVT_FEAT_C3STOP )) +return 0 ; + +return __tick_broadcast_oneshot_control (state); +} +#ifdef CONFIG_HOTPLUG_CPU /* * Transfer the do_timer job away from a dying cpu.
kernel/time/tick-sched.h +10 -0
@@ -71,4 +71,14 @@ extern void tick_cancel_sched_timer(int cpu);static inline void tick_cancel_sched_timer (int cpu) { }#endif +#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST +extern int __tick_broadcast_oneshot_control (enum tick_broadcast_state state); +#else +static inline int +__tick_broadcast_oneshot_control (enum tick_broadcast_state state) +{ +return -EBUSY ; +} +#endif +#endif