@@ -128,6 +128,7 @@ void vcpu_resume(struct vcpu *v)
/* Initialize VCPU registers */
arch_set_info_guest(v, &ctxt);
+ watchdog_domain_resume(v->domain);
clear_bit(_VPF_suspended, &v->pause_flags);
}
@@ -162,6 +163,9 @@ int32_t domain_suspend(register_t epoint, register_t cid)
*/
vcpu_suspend(epoint, cid);
+ /* Disable watchdogs of this domain */
+ watchdog_domain_suspend(d);
+
/*
* The calling domain is suspended by blocking its last running VCPU. If an
* event is pending the domain will resume right away (VCPU will not block,
@@ -1616,6 +1616,42 @@ void watchdog_domain_destroy(struct domain *d)
kill_timer(&d->watchdog_timer[i].timer);
}
+void watchdog_domain_suspend(struct domain *d)
+{
+ unsigned int i;
+
+ spin_lock(&d->watchdog_lock);
+
+ for ( i = 0; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ )
+ {
+ if ( test_bit(i, &d->watchdog_inuse_map) )
+ {
+ stop_timer(&d->watchdog_timer[i].timer);
+ }
+ }
+
+ spin_unlock(&d->watchdog_lock);
+}
+
+void watchdog_domain_resume(struct domain *d)
+{
+ unsigned int i;
+
+ spin_lock(&d->watchdog_lock);
+
+ for ( i = 0; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ )
+ {
+ if ( test_bit(i, &d->watchdog_inuse_map) )
+ {
+ set_timer(&d->watchdog_timer[i].timer,
+ NOW() + SECONDS(d->watchdog_timer[i].timeout));
+ }
+ }
+
+ spin_unlock(&d->watchdog_lock);
+}
+
+
/*
* Pin a vcpu temporarily to a specific CPU (or restore old pinning state if
* cpu is NR_CPUS).
@@ -1025,6 +1025,13 @@ void scheduler_disable(void);
void watchdog_domain_init(struct domain *d);
void watchdog_domain_destroy(struct domain *d);
+/*
+ * Suspend/resume watchdogs of domain (while the domain is suspended its
+ * watchdogs should be on pause)
+ */
+void watchdog_domain_suspend(struct domain *d);
+void watchdog_domain_resume(struct domain *d);
+
/*
* Use this check when the following are both true:
* - Using this feature or interface requires full access to the hardware