[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] hvm: Fix PV-on-HVM drivers to not execuite hypercall page while it is



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1186395374 -3600
# Node ID b82e6818fb31c6373ccd3e840ef2f9719d5f21a3
# Parent  e1435c1f3382069ca5044808b3233bda8b09d150
hvm: Fix PV-on-HVM drivers to not execuite hypercall page while it is
being re-initialised.
Signed-off-by: Edwin Zhai <edwin.zhai@xxxxxxxxx>
---
 unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c |   10 ++++++++++
 1 files changed, 10 insertions(+)

diff -r e1435c1f3382 -r b82e6818fb31 
unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c
--- a/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c        Mon Aug 
06 11:08:57 2007 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c        Mon Aug 
06 11:16:14 2007 +0100
@@ -10,6 +10,12 @@ struct ap_suspend_info {
        int      do_spin;
        atomic_t nr_spinning;
 };
+
+/*
+ * 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
@@ -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();
        }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.