aboutsummaryrefslogtreecommitdiffstats
path: root/unmodified_drivers
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-08-06 11:16:14 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-08-06 11:16:14 +0100
commit647f41c70db5a47e3376d2ad0892e43814aaf4db (patch)
tree4717041d1c9f35fba70f4af2bbdba18c96a98872 /unmodified_drivers
parentb12c493fd8591cd69825d97079e8590b3196d163 (diff)
downloadxen-647f41c70db5a47e3376d2ad0892e43814aaf4db.tar.gz
xen-647f41c70db5a47e3376d2ad0892e43814aaf4db.tar.bz2
xen-647f41c70db5a47e3376d2ad0892e43814aaf4db.zip
hvm: Fix PV-on-HVM drivers to not execuite hypercall page while it is
being re-initialised. Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Diffstat (limited to 'unmodified_drivers')
-rw-r--r--unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c b/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c
index 15ceef8da6..bd58d2ceb5 100644
--- a/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c
+++ b/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c
@@ -12,6 +12,12 @@ struct ap_suspend_info {
};
/*
+ * Use a rwlock to protect the hypercall page from being executed in AP context
+ * while the BSP is re-initializing it after restore.
+ */
+static DEFINE_RWLOCK(suspend_lock);
+
+/*
* Spinning prevents, for example, APs touching grant table entries while
* the shared grant table is not mapped into the address space imemdiately
* after resume.
@@ -27,7 +33,9 @@ static void ap_suspend(void *_info)
while (info->do_spin) {
cpu_relax();
+ read_lock(&suspend_lock);
HYPERVISOR_yield();
+ read_unlock(&suspend_lock);
}
mb();
@@ -43,7 +51,9 @@ static int bp_suspend(void)
suspend_cancelled = HYPERVISOR_shutdown(SHUTDOWN_suspend);
if (!suspend_cancelled) {
+ write_lock(&suspend_lock);
platform_pci_resume();
+ write_unlock(&suspend_lock);
gnttab_resume();
irq_resume();
}