Re: [PATCH 07/35] clockevents: Make suspend/resume calls explicit

From: Rafael J. Wysocki
Date: Mon Feb 16 2015 - 13:43:55 EST


On Monday, February 16, 2015 01:14:42 PM Peter Zijlstra wrote:
> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
>
> clockevents_notify() is a leftover from the early design of the
> clockevents facility. It's really not a notification mechanism, it's a
> multiplex call.
>
> We are way better off to have explicit calls instead of this
> monstrosity. Split out the suspend/resume() calls and invoke them
> directly from the call sites.
>
> No locking required at this point because these calls happen with
> interrupts disabled and a single cpu online.
>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> ---
> arch/x86/xen/suspend.c | 11 ++++-------
> include/linux/clockchips.h | 2 --
> include/linux/tick.h | 3 +++
> kernel/time/clockevents.c | 9 ---------
> kernel/time/tick-common.c | 23 +++++++++++++++++++++--
> kernel/time/tick-internal.h | 3 ++-
> kernel/time/timekeeping.c | 6 ++----
> 7 files changed, 32 insertions(+), 25 deletions(-)

[cut]

> Index: linux/include/linux/tick.h
> ===================================================================
> --- linux.orig/include/linux/tick.h
> +++ linux/include/linux/tick.h
> @@ -27,8 +27,11 @@ extern struct tick_device *tick_get_devi
>
> #ifdef CONFIG_GENERIC_CLOCKEVENTS
> extern void __init tick_init(void);
> +/* Should be core only, but XEN resume magic abuses this interface */
> +extern void tick_resume(void);
> #else /* CONFIG_GENERIC_CLOCKEVENTS */
> static inline void tick_init(void) { }
> +static inline void tick_resume(void) { }
> #endif /* !CONFIG_GENERIC_CLOCKEVENTS */
>
> #ifdef CONFIG_TICK_ONESHOT

[cut]

> Index: linux/kernel/time/tick-common.c
> ===================================================================
> --- linux.orig/kernel/time/tick-common.c
> +++ linux/kernel/time/tick-common.c
> @@ -372,18 +372,37 @@ void tick_shutdown(unsigned int *cpup)
> }
> }
>
> +/**
> + * tick_suspend - Suspend the tick and the broadcast device
> + *
> + * Called from syscore_suspend() via timekeeping_suspend with only one
> + * CPU online and interrupts disabled.
> + *
> + * No locks required. Nothing can change the per cpu device.
> + */
> void tick_suspend(void)
> {
> struct tick_device *td = this_cpu_ptr(&tick_cpu_device);
>
> clockevents_shutdown(td->evtdev);
> + tick_suspend_broadcast();
> }
>

The above will slightly conflict with that commit of mine:

http://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/commit/?h=linux-next&id=124cf9117c5f93cc5b324530b7e105b09c729d5d

but that's not a big deal I guess.

Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/