ia64/xen-unstable

changeset 15716:b82e6818fb31

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>
author kfraser@localhost.localdomain
date Mon Aug 06 11:16:14 2007 +0100 (2007-08-06)
parents e1435c1f3382
children c229802cedbb
files unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c
line diff
     1.1 --- a/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c	Mon Aug 06 11:08:57 2007 +0100
     1.2 +++ b/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c	Mon Aug 06 11:16:14 2007 +0100
     1.3 @@ -12,6 +12,12 @@ struct ap_suspend_info {
     1.4  };
     1.5  
     1.6  /*
     1.7 + * Use a rwlock to protect the hypercall page from being executed in AP context
     1.8 + * while the BSP is re-initializing it after restore.
     1.9 + */
    1.10 +static DEFINE_RWLOCK(suspend_lock);
    1.11 +
    1.12 +/*
    1.13   * Spinning prevents, for example, APs touching grant table entries while
    1.14   * the shared grant table is not mapped into the address space imemdiately
    1.15   * after resume.
    1.16 @@ -27,7 +33,9 @@ static void ap_suspend(void *_info)
    1.17  
    1.18  	while (info->do_spin) {
    1.19  		cpu_relax();
    1.20 +		read_lock(&suspend_lock);
    1.21  		HYPERVISOR_yield();
    1.22 +		read_unlock(&suspend_lock);
    1.23  	}
    1.24  
    1.25  	mb();
    1.26 @@ -43,7 +51,9 @@ static int bp_suspend(void)
    1.27  	suspend_cancelled = HYPERVISOR_shutdown(SHUTDOWN_suspend);
    1.28  
    1.29  	if (!suspend_cancelled) {
    1.30 +		write_lock(&suspend_lock);
    1.31  		platform_pci_resume();
    1.32 +		write_unlock(&suspend_lock);
    1.33  		gnttab_resume();
    1.34  		irq_resume();
    1.35  	}