Skip to content

Commit

Permalink
xen: Suspend ticks on all CPUs during suspend
Browse files Browse the repository at this point in the history
Commit 77e32c8 ("clockevents: Manage device's state separately for
the core") decouples clockevent device's modes from states. With this
change when a Xen guest tries to resume, it won't be calling its
set_mode op which needs to be done on each VCPU in order to make the
hypervisor aware that we are in oneshot mode.

This happens because clockevents_tick_resume() (which is an intermediate
step of resuming ticks on a processor) doesn't call clockevents_set_state()
anymore and because during suspend clockevent devices on all VCPUs (except
for the one doing the suspend) are left in ONESHOT state. As result, during
resume the clockevents state machine will assume that device is already
where it should be and doesn't need to be updated.

To avoid this problem we should suspend ticks on all VCPUs during
suspend.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
  • Loading branch information
Boris Ostrovsky authored and David Vrabel committed Apr 29, 2015
1 parent b44166c commit 2b953a5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
10 changes: 10 additions & 0 deletions arch/x86/xen/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,17 @@ static void xen_vcpu_notify_restore(void *data)
tick_resume_local();
}

static void xen_vcpu_notify_suspend(void *data)
{
tick_suspend_local();
}

void xen_arch_resume(void)
{
on_each_cpu(xen_vcpu_notify_restore, NULL, 1);
}

void xen_arch_suspend(void)
{
on_each_cpu(xen_vcpu_notify_suspend, NULL, 1);
}
9 changes: 6 additions & 3 deletions drivers/xen/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ static void do_suspend(void)
goto out_resume;
}

xen_arch_suspend();

si.cancelled = 1;

err = stop_machine(xen_suspend, &si, cpumask_of(0));
Expand All @@ -148,11 +150,12 @@ static void do_suspend(void)
si.cancelled = 1;
}

xen_arch_resume();

out_resume:
if (!si.cancelled) {
xen_arch_resume();
if (!si.cancelled)
xs_resume();
} else
else
xs_suspend_cancel();

dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE);
Expand Down
1 change: 1 addition & 0 deletions include/xen/xen-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ void xen_arch_post_suspend(int suspend_cancelled);

void xen_timer_resume(void);
void xen_arch_resume(void);
void xen_arch_suspend(void);

void xen_resume_notifier_register(struct notifier_block *nb);
void xen_resume_notifier_unregister(struct notifier_block *nb);
Expand Down

0 comments on commit 2b953a5

Please sign in to comment.