Mailing List Archive

[xen-unstable] When flush tlb mask, we need consider the cpu_online_map.
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1269934276 -3600
# Node ID 8ab60a883fd5ea6294227adbeddcc124dab67df6
# Parent f3db0ae08304d0707eda8cfc08182f444f12b35b
When flush tlb mask, we need consider the cpu_online_map.

The same is true for EPT flushes.

We noticed sometime system hang on cpu online/offline stress test. The
reason is because flush_tlb_mask from __get_page_type is deadloop.

This should be caused by a small windows in cpu offline. The
cpu_online_map is changed and the interrupt is disabled at
take_cpu_down() for the to-be-offline CPU.

However, the __sync_lazy_execstate() called from idle_task_exit() in
the idle_loop() for the to-be-offline CPU. At that time, the
stop_machine_run is finished already, and __get_page_type may be
called in other CPU before the __sync_lazy_execstate().

Thanks Jan pointing out issue in my original patch.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
---
xen/arch/x86/hvm/vmx/vmx.c | 4 +++-
xen/arch/x86/smp.c | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)

diff -r f3db0ae08304 -r 8ab60a883fd5 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Sat Mar 27 16:01:35 2010 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c Tue Mar 30 08:31:16 2010 +0100
@@ -1234,7 +1234,9 @@ void ept_sync_domain(struct domain *d)
* the ept_synced mask before on_selected_cpus() reads it, resulting in
* unnecessary extra flushes, to avoid allocating a cpumask_t on the stack.
*/
- d->arch.hvm_domain.vmx.ept_synced = d->domain_dirty_cpumask;
+ cpus_and(d->arch.hvm_domain.vmx.ept_synced,
+ d->domain_dirty_cpumask, cpu_online_map);
+
on_selected_cpus(&d->arch.hvm_domain.vmx.ept_synced,
__ept_sync_domain, d, 1);
}
diff -r f3db0ae08304 -r 8ab60a883fd5 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c Sat Mar 27 16:01:35 2010 +0000
+++ b/xen/arch/x86/smp.c Tue Mar 30 08:31:16 2010 +0100
@@ -228,7 +228,8 @@ void flush_area_mask(const cpumask_t *ma
if ( !cpus_subset(*mask, *cpumask_of(smp_processor_id())) )
{
spin_lock(&flush_lock);
- cpus_andnot(flush_cpumask, *mask, *cpumask_of(smp_processor_id()));
+ cpus_and(flush_cpumask, *mask, cpu_online_map);
+ cpu_clear(smp_processor_id(), flush_cpumask);
flush_va = va;
flush_flags = flags;
send_IPI_mask(&flush_cpumask, INVALIDATE_TLB_VECTOR);

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