@@ -289,7 +289,7 @@ static void dump_domains(unsigned char key)
for ( i = 0 ; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ )
if ( test_bit(i, &d->watchdog_inuse_map) )
printk(" watchdog %d expires in %d seconds\n",
- i, (u32)((d->watchdog_timer[i].expires - NOW()) >> 30));
+ i, (u32)((d->watchdog_timer[i].timer.expires - NOW()) >> 30));
arch_dump_domain_info(d);
@@ -1567,7 +1567,8 @@ static long domain_watchdog(struct domain *d, uint32_t id, uint32_t timeout)
{
if ( test_and_set_bit(id, &d->watchdog_inuse_map) )
continue;
- set_timer(&d->watchdog_timer[id], NOW() + SECONDS(timeout));
+ d->watchdog_timer[id].timeout = timeout;
+ set_timer(&d->watchdog_timer[id].timer, NOW() + SECONDS(timeout));
break;
}
spin_unlock(&d->watchdog_lock);
@@ -1583,12 +1584,12 @@ static long domain_watchdog(struct domain *d, uint32_t id, uint32_t timeout)
if ( timeout == 0 )
{
- stop_timer(&d->watchdog_timer[id]);
+ stop_timer(&d->watchdog_timer[id].timer);
clear_bit(id, &d->watchdog_inuse_map);
}
else
{
- set_timer(&d->watchdog_timer[id], NOW() + SECONDS(timeout));
+ set_timer(&d->watchdog_timer[id].timer, NOW() + SECONDS(timeout));
}
spin_unlock(&d->watchdog_lock);
@@ -1604,7 +1605,7 @@ void watchdog_domain_init(struct domain *d)
d->watchdog_inuse_map = 0;
for ( i = 0; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ )
- init_timer(&d->watchdog_timer[i], domain_watchdog_timeout, d, 0);
+ init_timer(&d->watchdog_timer[i].timer, domain_watchdog_timeout, d, 0);
}
void watchdog_domain_destroy(struct domain *d)
@@ -1612,7 +1613,7 @@ void watchdog_domain_destroy(struct domain *d)
unsigned int i;
for ( i = 0; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ )
- kill_timer(&d->watchdog_timer[i]);
+ kill_timer(&d->watchdog_timer[i].timer);
}
/*
@@ -24,6 +24,7 @@
#include <asm/atomic.h>
#include <xen/vpci.h>
#include <xen/wait.h>
+#include <xen/watchdog.h>
#include <public/xen.h>
#include <public/domctl.h>
#include <public/sysctl.h>
@@ -517,7 +518,7 @@ struct domain
#define NR_DOMAIN_WATCHDOG_TIMERS 2
spinlock_t watchdog_lock;
uint32_t watchdog_inuse_map;
- struct timer watchdog_timer[NR_DOMAIN_WATCHDOG_TIMERS];
+ struct watchdog_timer watchdog_timer[NR_DOMAIN_WATCHDOG_TIMERS];
struct rcu_head rcu;
@@ -8,6 +8,12 @@
#define __XEN_WATCHDOG_H__
#include <xen/types.h>
+#include <xen/timer.h>
+
+struct watchdog_timer {
+ struct timer timer;
+ uint32_t timeout;
+};
#ifdef CONFIG_WATCHDOG
This change is needed to properly implement the suspend/resume actions for the watchdog timers. To be able to restart watchdog timer after suspend we need to remember their frequency somewhere. To not bloat the struct timer a new struct watchdog_timer is introduced, containing the original timer and the last set timeout. Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com> --- xen/common/keyhandler.c | 2 +- xen/common/sched/core.c | 11 ++++++----- xen/include/xen/sched.h | 3 ++- xen/include/xen/watchdog.h | 6 ++++++ 4 files changed, 15 insertions(+), 7 deletions(-)