mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 12:12:16 +00:00
delete watchdog timer when deinit is called
to avoid system resource/memory leaked when guest os reboot. Signed-off-by: Minggui Cao <minggui.cao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
6b4ad0b449
commit
fdfb71e075
@ -132,7 +132,7 @@ wdt_expired_thread(union sigval v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stop_wdt_timer()
|
stop_wdt_timer(void)
|
||||||
{
|
{
|
||||||
struct itimerspec timer_val;
|
struct itimerspec timer_val;
|
||||||
|
|
||||||
@ -145,6 +145,19 @@ stop_wdt_timer()
|
|||||||
timer_settime(wdt_state.wdt_timerid, 0, &timer_val, NULL);
|
timer_settime(wdt_state.wdt_timerid, 0, &timer_val, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
delete_wdt_timer(void)
|
||||||
|
{
|
||||||
|
if (!wdt_state.timer_created)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DPRINTF("%s: timer %ld deleted\n", __func__,
|
||||||
|
(uint64_t)wdt_state.wdt_timerid);
|
||||||
|
|
||||||
|
timer_delete(wdt_state.wdt_timerid);
|
||||||
|
wdt_state.timer_created = false;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
reset_wdt_timer(int seconds)
|
reset_wdt_timer(int seconds)
|
||||||
{
|
{
|
||||||
@ -340,11 +353,10 @@ pci_wdt_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pci_wdt_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
pci_wdt_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
||||||
{
|
{
|
||||||
stop_wdt_timer();
|
delete_wdt_timer();
|
||||||
memset(&wdt_state, 0, sizeof(wdt_state));
|
memset(&wdt_state, 0, sizeof(wdt_state));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user