Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ffee521 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar
Browse files

clockevents: Make suspend/resume calls explicit



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: default avatarThomas Gleixner <tglx@linutronix.de>
[ Rebased on top of 4.0-rc5. ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/713674030.jVm1qaHuPf@vostro.rjw.lan


[ Rebased on top of latest timers/core. ]
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent db6f672e
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
#include <linux/types.h>
#include <linux/clockchips.h>
#include <linux/tick.h>

#include <xen/interface/xen.h>
#include <xen/grant_table.h>
@@ -81,17 +81,14 @@ void xen_arch_post_suspend(int cancelled)

static void xen_vcpu_notify_restore(void *data)
{
	unsigned long reason = (unsigned long)data;

	/* Boot processor notified via generic timekeeping_resume() */
	if (smp_processor_id() == 0)
		return;

	clockevents_notify(reason, NULL);
	tick_resume();
}

void xen_arch_resume(void)
{
	on_each_cpu(xen_vcpu_notify_restore,
		    (void *)CLOCK_EVT_NOTIFY_RESUME, 1);
	on_each_cpu(xen_vcpu_notify_restore, NULL, 1);
}
+0 −2
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@ enum clock_event_nofitiers {
	CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
	CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
	CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
	CLOCK_EVT_NOTIFY_SUSPEND,
	CLOCK_EVT_NOTIFY_RESUME,
	CLOCK_EVT_NOTIFY_CPU_DYING,
	CLOCK_EVT_NOTIFY_CPU_DEAD,
};
+3 −0
Original line number Diff line number Diff line
@@ -29,10 +29,13 @@ extern struct tick_device *tick_get_device(int cpu);
extern void __init tick_init(void);
extern void tick_freeze(void);
extern void tick_unfreeze(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_freeze(void) { }
static inline void tick_unfreeze(void) { }
static inline void tick_resume(void) { }
#endif /* !CONFIG_GENERIC_CLOCKEVENTS */

#ifdef CONFIG_TICK_ONESHOT
+0 −9
Original line number Diff line number Diff line
@@ -670,15 +670,6 @@ int clockevents_notify(unsigned long reason, void *arg)
		tick_handover_do_timer(arg);
		break;

	case CLOCK_EVT_NOTIFY_SUSPEND:
		tick_suspend();
		tick_suspend_broadcast();
		break;

	case CLOCK_EVT_NOTIFY_RESUME:
		tick_resume();
		break;

	case CLOCK_EVT_NOTIFY_CPU_DEAD:
		tick_shutdown_broadcast_oneshot(arg);
		tick_shutdown_broadcast(arg);
+23 −3
Original line number Diff line number Diff line
@@ -373,18 +373,39 @@ 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 or from tick_unfreeze() under
 * tick_freeze_lock.
 *
 * 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();
}

/**
 * tick_resume - Resume the tick and the broadcast device
 *
 * Called from syscore_resume() via timekeeping_resume with only one
 * CPU online and interrupts disabled or from tick_unfreeze() under
 * tick_freeze_lock.
 *
 * No locks required. Nothing can change the per cpu device.
 */
void tick_resume(void)
{
	struct tick_device *td = this_cpu_ptr(&tick_cpu_device);
	int broadcast = tick_resume_broadcast();
	struct tick_device *td;
	int broadcast;

	broadcast = tick_resume_broadcast();
	td = this_cpu_ptr(&tick_cpu_device);
	clockevents_tick_resume(td->evtdev);

	if (!broadcast) {
@@ -416,7 +437,6 @@ void tick_freeze(void)
		timekeeping_suspend();
	} else {
		tick_suspend();
		tick_suspend_broadcast();
	}

	raw_spin_unlock(&tick_freeze_lock);
Loading