Currently clock_was_set() is a nop but on newer kernels it is not and
cannot be called from interrupt context. Prepare for that by deferring
to a workqueue. Since a timer interrupt can occur before
init_workqueue() is called we need to protect against the possibility
that keventd hasn't started yet.
(drop unused variable max_ntp_tick).
Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
/* Must be signed, as it's compared with s64 quantities which can be -ve. */
#define NS_PER_TICK (1000000000LL/HZ)
+static void __clock_was_set(void *unused)
+{
+ clock_was_set();
+}
+static DECLARE_WORK(clock_was_set_work, __clock_was_set, NULL);
+
static inline void __normalize_time(time_t *sec, s64 *nsec)
{
while (*nsec >= NSEC_PER_SEC) {
{
unsigned long seq;
unsigned long usec, sec;
- unsigned long max_ntp_tick;
unsigned long flags;
s64 nsec;
unsigned int cpu;
if (shadow_tv_version != HYPERVISOR_shared_info->wc_version) {
update_wallclock();
- clock_was_set();
+ if (keventd_up())
+ schedule_work(&clock_was_set_work);
}
write_sequnlock(&xtime_lock);