From: "Jan Beulich" Subject: [PATCH 1/6] remove direct cpumask_t members from struct vcpu and struct domain Date: Tue, 05 Apr 2011 09:19:54 +0100 Message-ID: <4D9AECCA0200007800039F2A@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartD5F90FBA.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartD5F90FBA.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline The CPU masks embedded in these structures prevent NR_CPUS-independent sizing of these structures. Basic concept (in xen/include/cpumask.h) taken from recent Linux. For scalability purposes, many other uses of cpumask_t should be replaced by cpumask_var_t, particularly local variables of functions. This implies that no functions should have by-value cpumask_t parameters, and that the whole old cpumask interface (cpus_...()) should go away in favor of the new (cpumask_...()) one. Signed-off-by: Jan Beulich --- a/xen/arch/ia64/xen/mm.c +++ b/xen/arch/ia64/xen/mm.c @@ -3191,8 +3191,9 @@ int get_page_type(struct page_info *page * may be unnecessary (e.g., page was GDT/LDT) but = those=20 * circumstances should be very rare. */ - cpumask_t mask =3D - page_get_owner(page)->domain_dirty_cpumask; + cpumask_t mask; + + cpumask_copy(&mask, page_get_owner(page)->domain_dirty_cpu= mask); tlbflush_filter(mask, page->tlbflush_timestamp); =20 if ( unlikely(!cpus_empty(mask)) ) --- a/xen/arch/ia64/xen/vhpt.c +++ b/xen/arch/ia64/xen/vhpt.c @@ -516,7 +516,7 @@ void domain_flush_tlb_vhpt(struct domain on_each_cpu((void (*)(void *))local_flush_tlb_all, NULL, = 1); else on_each_cpu((void (*)(void *))flush_tlb_vhpt_all, d, 1); - cpus_clear (d->domain_dirty_cpumask); + cpumask_clear_cpu(d->domain_dirty_cpumask); } =20 void flush_tlb_for_log_dirty(struct domain *d) @@ -545,7 +545,7 @@ void flush_tlb_for_log_dirty(struct doma } else { on_each_cpu((void (*)(void *))flush_tlb_vhpt_all, d, 1); } - cpus_clear (d->domain_dirty_cpumask); + cpumask_clear_cpu(d->domain_dirty_cpumask); } =20 void flush_tlb_mask(const cpumask_t *mask) --- a/xen/arch/x86/cpu/mcheck/vmce.c +++ b/xen/arch/x86/cpu/mcheck/vmce.c @@ -321,8 +321,8 @@ int inject_vmce(struct domain *d) d->domain_id); if ( guest_has_trap_callback(d, 0, TRAP_machine_check) ) { - d->vcpu[0]->cpu_affinity_tmp =3D - d->vcpu[0]->cpu_affinity; + cpumask_copy(d->vcpu[0]->cpu_affinity_tmp, + d->vcpu[0]->cpu_affinity); cpus_clear(affinity); cpu_set(cpu, affinity); mce_printk(MCE_VERBOSE, "MCE: CPU%d set affinity, old = %d\n", --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -132,8 +132,8 @@ void startup_cpu_idle_loop(void) struct vcpu *v =3D current; =20 ASSERT(is_idle_vcpu(v)); - cpu_set(smp_processor_id(), v->domain->domain_dirty_cpumask); - cpu_set(smp_processor_id(), v->vcpu_dirty_cpumask); + cpumask_set_cpu(v->processor, v->domain->domain_dirty_cpumask); + cpumask_set_cpu(v->processor, v->vcpu_dirty_cpumask); =20 reset_stack_and_jump(idle_loop); } @@ -1391,7 +1391,7 @@ static void __context_switch(void) struct desc_ptr gdt_desc; =20 ASSERT(p !=3D n); - ASSERT(cpus_empty(n->vcpu_dirty_cpumask)); + ASSERT(cpumask_empty(n->vcpu_dirty_cpumask)); =20 if ( !is_idle_vcpu(p) ) { @@ -1408,8 +1408,8 @@ static void __context_switch(void) * which is synchronised on that function. */ if ( p->domain !=3D n->domain ) - cpu_set(cpu, n->domain->domain_dirty_cpumask); - cpu_set(cpu, n->vcpu_dirty_cpumask); + cpumask_set_cpu(cpu, n->domain->domain_dirty_cpumask); + cpumask_set_cpu(cpu, n->vcpu_dirty_cpumask); =20 if ( !is_idle_vcpu(n) ) { @@ -1452,8 +1452,8 @@ static void __context_switch(void) } =20 if ( p->domain !=3D n->domain ) - cpu_clear(cpu, p->domain->domain_dirty_cpumask); - cpu_clear(cpu, p->vcpu_dirty_cpumask); + cpumask_clear_cpu(cpu, p->domain->domain_dirty_cpumask); + cpumask_clear_cpu(cpu, p->vcpu_dirty_cpumask); =20 per_cpu(curr_vcpu, cpu) =3D n; } @@ -1462,10 +1462,11 @@ static void __context_switch(void) void context_switch(struct vcpu *prev, struct vcpu *next) { unsigned int cpu =3D smp_processor_id(); - cpumask_t dirty_mask =3D next->vcpu_dirty_cpumask; + cpumask_t dirty_mask; =20 ASSERT(local_irq_is_enabled()); =20 + cpumask_copy(&dirty_mask, next->vcpu_dirty_cpumask); /* Allow at most one CPU at a time to be dirty. */ ASSERT(cpus_weight(dirty_mask) <=3D 1); if ( unlikely(!cpu_isset(cpu, dirty_mask) && !cpus_empty(dirty_mask)) = ) @@ -1557,11 +1558,11 @@ void sync_local_execstate(void) =20 void sync_vcpu_execstate(struct vcpu *v) { - if ( cpu_isset(smp_processor_id(), v->vcpu_dirty_cpumask) ) + if ( cpumask_test_cpu(smp_processor_id(), v->vcpu_dirty_cpumask) ) sync_local_execstate(); =20 /* Other cpus call __sync_local_execstate from flush ipi handler. */ - flush_tlb_mask(&v->vcpu_dirty_cpumask); + flush_tlb_mask(v->vcpu_dirty_cpumask); } =20 #define next_arg(fmt, args) ({ = \ @@ -1922,7 +1923,7 @@ int domain_relinquish_resources(struct d int ret; struct vcpu *v; =20 - BUG_ON(!cpus_empty(d->domain_dirty_cpumask)); + BUG_ON(!cpumask_empty(d->domain_dirty_cpumask)); =20 switch ( d->arch.relmem ) { --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3089,7 +3089,7 @@ static int hvmop_flush_tlb_all(void) paging_update_cr3(v); =20 /* Flush all dirty TLBs. */ - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); =20 /* Done. */ for_each_vcpu ( d, v ) --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1348,7 +1348,7 @@ static int svm_is_erratum_383(struct cpu wrmsrl(MSR_IA32_MCG_STATUS, msr_content & ~(1ULL << 2)); =20 /* flush TLB */ - flush_tlb_mask(&v->domain->domain_dirty_cpumask); + flush_tlb_mask(v->domain->domain_dirty_cpumask); =20 return 1; } --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -88,8 +88,14 @@ static int vmx_domain_initialise(struct=20 d->arch.hvm_domain.vmx.ept_control.asr =3D pagetable_get_pfn(p2m_get_pagetable(p2m_get_hostp2m(d))); =20 + if ( !zalloc_cpumask_var(&d->arch.hvm_domain.vmx.ept_synced) ) + return -ENOMEM; + if ( (rc =3D vmx_alloc_vlapic_mapping(d)) !=3D 0 ) + { + free_cpumask_var(d->arch.hvm_domain.vmx.ept_synced); return rc; + } =20 return 0; } @@ -98,6 +104,7 @@ static void vmx_domain_destroy(struct do { if ( paging_mode_hap(d) ) on_each_cpu(__ept_sync_domain, d, 1); + free_cpumask_var(d->arch.hvm_domain.vmx.ept_synced); vmx_free_vlapic_mapping(d); } =20 @@ -660,8 +667,9 @@ static void vmx_ctxt_switch_to(struct vc { unsigned int cpu =3D smp_processor_id(); /* Test-and-test-and-set this CPU in the EPT-is-synced mask. */ - if ( !cpu_isset(cpu, d->arch.hvm_domain.vmx.ept_synced) && - !cpu_test_and_set(cpu, d->arch.hvm_domain.vmx.ept_synced) ) + if ( !cpumask_test_cpu(cpu, d->arch.hvm_domain.vmx.ept_synced) && + !cpumask_test_and_set_cpu(cpu, + d->arch.hvm_domain.vmx.ept_synced) = ) __invept(INVEPT_SINGLE_CONTEXT, ept_get_eptp(d), 0); } =20 @@ -1217,10 +1225,10 @@ 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. */ - cpus_and(d->arch.hvm_domain.vmx.ept_synced, - d->domain_dirty_cpumask, cpu_online_map); + cpumask_and(d->arch.hvm_domain.vmx.ept_synced, + d->domain_dirty_cpumask, &cpu_online_map); =20 - on_selected_cpus(&d->arch.hvm_domain.vmx.ept_synced, + on_selected_cpus(d->arch.hvm_domain.vmx.ept_synced, __ept_sync_domain, d, 1); } =20 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -612,7 +612,7 @@ static void invalidate_shadow_ldt(struct =20 /* Rid TLBs of stale mappings (guest mappings and shadow mappings). = */ if ( flush ) - flush_tlb_mask(&v->vcpu_dirty_cpumask); + flush_tlb_mask(v->vcpu_dirty_cpumask); =20 out: spin_unlock(&v->arch.shadow_ldt_lock); @@ -1338,7 +1338,7 @@ static void pae_flush_pgd( if ( pagetable_get_pfn(v->arch.guest_table) =3D=3D mfn ) { paging_update_cr3(v); - cpus_or(m, m, v->vcpu_dirty_cpumask); + cpumask_or(&m, &m, v->vcpu_dirty_cpumask); } flush_tlb_mask(&m); } @@ -1365,7 +1365,7 @@ static void pae_flush_pgd( spin_unlock(&cache->lock); } =20 - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); } #else # define pae_flush_pgd(mfn, idx, nl3e) ((void)0) @@ -2421,7 +2421,9 @@ static int __get_page_type(struct page_i * may be unnecessary (e.g., page was GDT/LDT) but = those=20 * circumstances should be very rare. */ - cpumask_t mask =3D d->domain_dirty_cpumask; + cpumask_t mask; + + cpumask_copy(&mask, d->domain_dirty_cpumask); =20 /* Don't flush if the timestamp is old enough */ tlbflush_filter(mask, page->tlbflush_timestamp); @@ -2903,7 +2905,7 @@ static inline int vcpumask_to_pcpumask( if ( (vcpu_id >=3D d->max_vcpus) ) return 0; if ( ((v =3D d->vcpu[vcpu_id]) !=3D NULL) ) - cpus_or(*pmask, *pmask, v->vcpu_dirty_cpumask); + cpumask_or(pmask, pmask, v->vcpu_dirty_cpumask); } } } @@ -3161,11 +3163,11 @@ int do_mmuext_op( } =20 case MMUEXT_TLB_FLUSH_ALL: - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); break; =20 case MMUEXT_INVLPG_ALL: - flush_tlb_one_mask(&d->domain_dirty_cpumask, op.arg1.linear_ad= dr); + flush_tlb_one_mask(d->domain_dirty_cpumask, op.arg1.linear_add= r); break; =20 case MMUEXT_FLUSH_CACHE: @@ -4345,7 +4347,7 @@ static int __do_update_va_mapping( flush_tlb_local(); break; case UVMF_ALL: - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); break; default: rc =3D vcpumask_to_pcpumask(d, const_guest_handle_from_ptr(bma= p_ptr, @@ -4365,7 +4367,7 @@ static int __do_update_va_mapping( flush_tlb_one_local(va); break; case UVMF_ALL: - flush_tlb_one_mask(&d->domain_dirty_cpumask, va); + flush_tlb_one_mask(d->domain_dirty_cpumask, va); break; default: rc =3D vcpumask_to_pcpumask(d, const_guest_handle_from_ptr(bma= p_ptr, --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -72,7 +72,7 @@ static int hap_enable_vram_tracking(stru for (i =3D dirty_vram->begin_pfn; i < dirty_vram->end_pfn; i++) p2m_change_type(p2m_get_hostp2m(d), i, p2m_ram_rw, p2m_ram_logdirt= y); =20 - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); return 0; } =20 @@ -92,7 +92,7 @@ static int hap_disable_vram_tracking(str for (i =3D dirty_vram->begin_pfn; i < dirty_vram->end_pfn; i++) p2m_change_type(p2m_get_hostp2m(d), i, p2m_ram_logdirty, = p2m_ram_rw); =20 - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); return 0; } =20 @@ -108,7 +108,7 @@ static void hap_clean_vram_tracking(stru for (i =3D dirty_vram->begin_pfn; i < dirty_vram->end_pfn; i++) p2m_change_type(p2m_get_hostp2m(d), i, p2m_ram_rw, p2m_ram_logdirt= y); =20 - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); } =20 static void hap_vram_tracking_init(struct domain *d) @@ -202,7 +202,7 @@ static int hap_enable_log_dirty(struct d /* set l1e entries of P2M table to be read-only. */ p2m_change_entry_type_global(p2m_get_hostp2m(d), p2m_ram_rw, p2m_ram_logdirty); - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); return 0; } =20 @@ -223,7 +223,7 @@ static void hap_clean_dirty_bitmap(struc /* set l1e entries of P2M table to be read-only. */ p2m_change_entry_type_global(p2m_get_hostp2m(d), p2m_ram_rw, p2m_ram_logdirty); - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); } =20 void hap_logdirty_init(struct domain *d) @@ -842,7 +842,7 @@ hap_write_p2m_entry(struct vcpu *v, unsi safe_write_pte(p, new); if ( (old_flags & _PAGE_PRESENT) && (level =3D=3D 1 || (level =3D=3D 2 && (old_flags & _PAGE_PSE))= ) ) - flush_tlb_mask(&v->domain->domain_dirty_cpumask); + flush_tlb_mask(v->domain->domain_dirty_cpumask); =20 #if CONFIG_PAGING_LEVELS =3D=3D 3 /* install P2M in monitor table for PAE Xen */ --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -703,7 +703,7 @@ static int oos_remove_write_access(struc } =20 if ( ftlb ) - flush_tlb_mask(&v->domain->domain_dirty_cpumask); + flush_tlb_mask(v->domain->domain_dirty_cpumask); =20 return 0; } @@ -1153,7 +1153,7 @@ sh_validate_guest_pt_write(struct vcpu * rc =3D sh_validate_guest_entry(v, gmfn, entry, size); if ( rc & SHADOW_SET_FLUSH ) /* Need to flush TLBs to pick up shadow PT changes */ - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); if ( rc & SHADOW_SET_ERROR )=20 { /* This page is probably not a pagetable any more: tear it out of = the=20 @@ -1369,7 +1369,7 @@ static void _shadow_prealloc( /* See if that freed up enough space */ if ( d->arch.paging.shadow.free_pages >=3D pages ) { - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); return; } } @@ -1422,7 +1422,7 @@ static void shadow_blow_tables(struct do pagetable_get_mfn(v->arch.shadow_table[i]),= 0); =20 /* Make sure everyone sees the unshadowings */ - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); } =20 void shadow_blow_tables_per_domain(struct domain *d) @@ -1535,7 +1535,7 @@ mfn_t shadow_alloc(struct domain *d, =20 sp =3D page_list_remove_head(&d->arch.paging.shadow.freelist); /* Before we overwrite the old contents of this page,=20 * we need to be sure that no TLB holds a pointer to it. */ - mask =3D d->domain_dirty_cpumask; + cpumask_copy(&mask, d->domain_dirty_cpumask); tlbflush_filter(mask, sp->tlbflush_timestamp); if ( unlikely(!cpus_empty(mask)) ) { @@ -2767,7 +2767,7 @@ void sh_remove_shadows(struct vcpu *v, m =20 /* Need to flush TLBs now, so that linear maps are safe next time = we=20 * take a fault. */ - flush_tlb_mask(&v->domain->domain_dirty_cpumask); + flush_tlb_mask(v->domain->domain_dirty_cpumask); =20 if ( do_locking ) shadow_unlock(v->domain); } @@ -3474,7 +3474,7 @@ static void sh_unshadow_for_p2m_change(s { sh_remove_all_shadows_and_parents(v, mfn); if ( sh_remove_all_mappings(v, mfn) ) - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); } } =20 @@ -3509,7 +3509,8 @@ static void sh_unshadow_for_p2m_change(s /* This GFN->MFN mapping has gone away */ sh_remove_all_shadows_and_parents(v, omfn); if ( sh_remove_all_mappings(v, omfn) ) - cpus_or(flushmask, flushmask, d->domain_dirty_cpum= ask); + cpumask_or(&flushmask, &flushmask, + d->domain_dirty_cpumask); } omfn =3D _mfn(mfn_x(omfn) + 1); } @@ -3806,7 +3807,7 @@ int shadow_track_dirty_vram(struct domai } } if ( flush_tlb ) - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); goto out; =20 out_sl1ma: --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -3248,7 +3248,7 @@ static int sh_page_fault(struct vcpu *v, */ perfc_incr(shadow_rm_write_flush_tlb); atomic_inc(&d->arch.paging.shadow.gtable_dirty_version); - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); } =20 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) @@ -4294,7 +4294,7 @@ sh_update_cr3(struct vcpu *v, int do_loc * (old) shadow linear maps in the writeable mapping heuristics. */ #if GUEST_PAGING_LEVELS =3D=3D 2 if ( sh_remove_write_access(v, gmfn, 2, 0) !=3D 0 ) - flush_tlb_mask(&v->domain->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l2_shadow); #elif GUEST_PAGING_LEVELS =3D=3D 3 /* PAE guests have four shadow_table entries, based on the=20 @@ -4317,7 +4317,7 @@ sh_update_cr3(struct vcpu *v, int do_loc } } if ( flush )=20 - flush_tlb_mask(&v->domain->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); /* Now install the new shadows. */ for ( i =3D 0; i < 4; i++ )=20 { @@ -4338,7 +4338,7 @@ sh_update_cr3(struct vcpu *v, int do_loc } #elif GUEST_PAGING_LEVELS =3D=3D 4 if ( sh_remove_write_access(v, gmfn, 4, 0) !=3D 0 ) - flush_tlb_mask(&v->domain->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow); #else #error This should never happen=20 @@ -4755,7 +4755,7 @@ static void sh_pagetable_dying(struct vc } } if ( flush ) - flush_tlb_mask(&v->domain->domain_dirty_cpumask); + flush_tlb_mask(v->domain->domain_dirty_cpumask); =20 /* Remember that we've seen the guest use this interface, so we * can rely on it using it in future, instead of guessing at @@ -4788,7 +4788,7 @@ static void sh_pagetable_dying(struct vc mfn_to_page(gmfn)->shadow_flags |=3D SHF_pagetable_dying; shadow_unhook_mappings(v, smfn, 1/* user pages only */); /* Now flush the TLB: we removed toplevel mappings. */ - flush_tlb_mask(&v->domain->domain_dirty_cpumask); + flush_tlb_mask(v->domain->domain_dirty_cpumask); } =20 /* Remember that we've seen the guest use this interface, so we --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -2965,7 +2965,7 @@ static void nmi_mce_softirq(void) =20 /* Set the tmp value unconditionally, so that * the check in the iret hypercall works. */ - st->vcpu->cpu_affinity_tmp =3D st->vcpu->cpu_affinity; + cpumask_copy(st->vcpu->cpu_affinity_tmp, st->vcpu->cpu_affinity); =20 if ((cpu !=3D st->processor) || (st->processor !=3D st->vcpu->processor)) @@ -2996,11 +2996,11 @@ void async_exception_cleanup(struct vcpu return; =20 /* Restore affinity. */ - if ( !cpus_empty(curr->cpu_affinity_tmp) && - !cpus_equal(curr->cpu_affinity_tmp, curr->cpu_affinity) ) + if ( !cpumask_empty(curr->cpu_affinity_tmp) && + !cpumask_equal(curr->cpu_affinity_tmp, curr->cpu_affinity) ) { - vcpu_set_affinity(curr, &curr->cpu_affinity_tmp); - cpus_clear(curr->cpu_affinity_tmp); + vcpu_set_affinity(curr, curr->cpu_affinity_tmp); + cpumask_clear(curr->cpu_affinity_tmp); } =20 if ( !(curr->async_exception_mask & (curr->async_exception_mask - 1)) = ) @@ -3048,7 +3048,7 @@ void async_exception_cleanup(struct vcpu int cpu =3D smp_processor_id(); cpumask_t affinity; =20 - curr->cpu_affinity_tmp =3D curr->cpu_affinity; + cpumask_copy(curr->cpu_affinity_tmp, curr->cpu_affinity); cpus_clear(affinity); cpu_set(cpu, affinity); printk(XENLOG_DEBUG "MCE: CPU%d set affinity, old %d\n", --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -151,6 +151,11 @@ struct vcpu *alloc_vcpu( =20 tasklet_init(&v->continue_hypercall_tasklet, NULL, 0); =20 + if ( !zalloc_cpumask_var(&v->cpu_affinity) || + !zalloc_cpumask_var(&v->cpu_affinity_tmp) || + !zalloc_cpumask_var(&v->vcpu_dirty_cpumask) ) + goto fail_free; + if ( is_idle_domain(d) ) { v->runstate.state =3D RUNSTATE_running; @@ -167,16 +172,17 @@ struct vcpu *alloc_vcpu( } =20 if ( sched_init_vcpu(v, cpu_id) !=3D 0 ) - { - destroy_waitqueue_vcpu(v); - free_vcpu_struct(v); - return NULL; - } + goto fail_wq; =20 if ( vcpu_initialise(v) !=3D 0 ) { sched_destroy_vcpu(v); + fail_wq: destroy_waitqueue_vcpu(v); + fail_free: + free_cpumask_var(v->cpu_affinity); + free_cpumask_var(v->cpu_affinity_tmp); + free_cpumask_var(v->vcpu_dirty_cpumask); free_vcpu_struct(v); return NULL; } @@ -246,6 +252,9 @@ struct domain *domain_create( spin_lock_init(&d->shutdown_lock); d->shutdown_code =3D -1; =20 + if ( !zalloc_cpumask_var(&d->domain_dirty_cpumask) ) + goto fail; + if ( domcr_flags & DOMCRF_hvm ) d->is_hvm =3D 1; =20 @@ -346,6 +355,7 @@ struct domain *domain_create( xsm_free_security_domain(d); xfree(d->pirq_mask); xfree(d->pirq_to_evtchn); + free_cpumask_var(d->domain_dirty_cpumask); free_domain_struct(d); return NULL; } @@ -361,7 +371,7 @@ void domain_update_node_affinity(struct=20 spin_lock(&d->node_affinity_lock); =20 for_each_vcpu ( d, v ) - cpus_or(cpumask, cpumask, v->cpu_affinity); + cpumask_or(&cpumask, &cpumask, v->cpu_affinity); =20 for_each_online_node ( node ) if ( cpus_intersects(node_to_cpumask(node), cpumask) ) @@ -658,7 +668,12 @@ static void complete_domain_destroy(stru =20 for ( i =3D d->max_vcpus - 1; i >=3D 0; i-- ) if ( (v =3D d->vcpu[i]) !=3D NULL ) + { + free_cpumask_var(v->cpu_affinity); + free_cpumask_var(v->cpu_affinity_tmp); + free_cpumask_var(v->vcpu_dirty_cpumask); free_vcpu_struct(v); + } =20 if ( d->target !=3D NULL ) put_domain(d->target); @@ -669,6 +684,7 @@ static void complete_domain_destroy(stru xfree(d->pirq_to_evtchn); =20 xsm_free_security_domain(d); + free_cpumask_var(d->domain_dirty_cpumask); free_domain_struct(d); =20 send_guest_global_virq(dom0, VIRQ_DOM_EXC); @@ -789,7 +805,7 @@ void vcpu_reset(struct vcpu *v) v->async_exception_mask =3D 0; memset(v->async_exception_state, 0, sizeof(v->async_exception_state));= #endif - cpus_clear(v->cpu_affinity_tmp); + cpumask_clear(v->cpu_affinity_tmp); clear_bit(_VPF_blocked, &v->pause_flags); =20 domain_unlock(v->domain); --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -589,7 +589,7 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc else { ret =3D cpumask_to_xenctl_cpumap( - &op->u.vcpuaffinity.cpumap, &v->cpu_affinity); + &op->u.vcpuaffinity.cpumap, v->cpu_affinity); } =20 vcpuaffinity_out: --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -1013,7 +1013,7 @@ gnttab_unmap_grant_ref( goto fault; } =20 - flush_tlb_mask(¤t->domain->domain_dirty_cpumask); + flush_tlb_mask(current->domain->domain_dirty_cpumask); =20 for ( i =3D 0; i < partial_done; i++ ) __gnttab_unmap_common_complete(&(common[i])); @@ -1028,7 +1028,7 @@ gnttab_unmap_grant_ref( return 0; =20 fault: - flush_tlb_mask(¤t->domain->domain_dirty_cpumask); + flush_tlb_mask(current->domain->domain_dirty_cpumask); =20 for ( i =3D 0; i < partial_done; i++ ) __gnttab_unmap_common_complete(&(common[i])); @@ -1075,7 +1075,7 @@ gnttab_unmap_and_replace( goto fault; } =20 - flush_tlb_mask(¤t->domain->domain_dirty_cpumask); + flush_tlb_mask(current->domain->domain_dirty_cpumask); =20 for ( i =3D 0; i < partial_done; i++ ) __gnttab_unmap_common_complete(&(common[i])); @@ -1090,7 +1090,7 @@ gnttab_unmap_and_replace( return 0; =20 fault: - flush_tlb_mask(¤t->domain->domain_dirty_cpumask); + flush_tlb_mask(current->domain->domain_dirty_cpumask); =20 for ( i =3D 0; i < partial_done; i++ ) __gnttab_unmap_common_complete(&(common[i])); @@ -1496,7 +1496,7 @@ gnttab_transfer( #ifndef __ia64__ /* IA64 implicitly replaces the old page in steal_page().= */ guest_physmap_remove_page(d, gop.mfn, mfn, 0); #endif - flush_tlb_mask(&d->domain_dirty_cpumask); + flush_tlb_mask(d->domain_dirty_cpumask); =20 /* Find the target domain. */ if ( unlikely((e =3D rcu_lock_domain_by_id(gop.domid)) =3D=3D = NULL) ) --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -243,7 +243,7 @@ static void dump_domains(unsigned char k { unsigned int i; printk("General information for domain %u:\n", d->domain_id); - cpuset_print(tmpstr, sizeof(tmpstr), d->domain_dirty_cpumask); + cpuset_print(tmpstr, sizeof(tmpstr), *d->domain_dirty_cpumask); printk(" refcnt=3D%d dying=3D%d nr_pages=3D%d xenheap_pages=3D%= d " "dirty_cpus=3D%s max_pages=3D%u\n", atomic_read(&d->refcnt), d->is_dying, @@ -277,9 +277,9 @@ static void dump_domains(unsigned char k v->pause_flags, v->poll_evtchn, vcpu_info(v, evtchn_upcall_pending), vcpu_info(v, evtchn_upcall_mask)); - cpuset_print(tmpstr, sizeof(tmpstr), v->vcpu_dirty_cpumask); + cpuset_print(tmpstr, sizeof(tmpstr), *v->vcpu_dirty_cpumask); printk("dirty_cpus=3D%s ", tmpstr); - cpuset_print(tmpstr, sizeof(tmpstr), v->cpu_affinity); + cpuset_print(tmpstr, sizeof(tmpstr), *v->cpu_affinity); printk("cpu_affinity=3D%s\n", tmpstr); arch_dump_vcpu_info(v); periodic_timer_print(tmpstr, sizeof(tmpstr), v->periodic_perio= d); --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -292,7 +292,7 @@ __runq_tickle(unsigned int cpu, struct c { cpumask_t idle_mask; =20 - cpus_and(idle_mask, prv->idlers, new->vcpu->cpu_affinity); + cpumask_and(&idle_mask, &prv->idlers, new->vcpu->cpu_affinity)= ; if ( !cpus_empty(idle_mask) ) { CSCHED_STAT_CRANK(tickle_idlers_some); @@ -305,7 +305,7 @@ __runq_tickle(unsigned int cpu, struct c else cpus_or(mask, mask, idle_mask); } - cpus_and(mask, mask, new->vcpu->cpu_affinity); + cpumask_and(&mask, &mask, new->vcpu->cpu_affinity); } } =20 @@ -455,7 +455,7 @@ __csched_vcpu_is_migrateable(struct vcpu */ return !vc->is_running && !__csched_vcpu_is_cache_hot(vc) && - cpu_isset(dest_cpu, vc->cpu_affinity); + cpumask_test_cpu(dest_cpu, vc->cpu_affinity); } =20 static int @@ -472,7 +472,7 @@ _csched_cpu_pick(const struct scheduler=20 * preference to its current processor if it's in there. */ online =3D CSCHED_CPUONLINE(vc->domain->cpupool); - cpus_and(cpus, *online, vc->cpu_affinity); + cpumask_and(&cpus, online, vc->cpu_affinity); cpu =3D cpu_isset(vc->processor, cpus) ? vc->processor : cycle_cpu(vc->processor, cpus); --- a/xen/common/sched_sedf.c +++ b/xen/common/sched_sedf.c @@ -448,7 +448,7 @@ static int sedf_pick_cpu(const struct sc cpumask_t *online; =20 online =3D SEDF_CPUONLINE(v->domain->cpupool); - cpus_and(online_affinity, v->cpu_affinity, *online); + cpumask_and(&online_affinity, v->cpu_affinity, online); return first_cpu(online_affinity); } =20 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -196,9 +196,9 @@ int sched_init_vcpu(struct vcpu *v, unsi */ v->processor =3D processor; if ( is_idle_domain(d) || d->is_pinned ) - v->cpu_affinity =3D cpumask_of_cpu(processor); + cpumask_copy(v->cpu_affinity, cpumask_of(processor)); else - cpus_setall(v->cpu_affinity); + cpumask_setall(v->cpu_affinity); =20 /* Initialise the per-vcpu timers. */ init_timer(&v->periodic_timer, vcpu_periodic_timer_fn, @@ -273,7 +273,7 @@ int sched_move_domain(struct domain *d,=20 SCHED_OP(VCPU2OP(v), remove_vcpu, v); SCHED_OP(VCPU2OP(v), free_vdata, v->sched_priv); =20 - cpus_setall(v->cpu_affinity); + cpumask_setall(v->cpu_affinity); v->processor =3D new_p; v->sched_priv =3D vcpu_priv[v->vcpu_id]; evtchn_move_pirqs(v); @@ -435,7 +435,7 @@ static void vcpu_migrate(struct vcpu *v) */ if ( pick_called && (new_lock =3D=3D per_cpu(schedule_data, new_cpu).schedule= _lock) && - cpu_isset(new_cpu, v->cpu_affinity) && + cpumask_test_cpu(new_cpu, v->cpu_affinity) && cpu_isset(new_cpu, v->domain->cpupool->cpu_valid) ) break; =20 @@ -550,13 +550,13 @@ int cpu_disable_scheduler(unsigned int c { vcpu_schedule_lock_irq(v); =20 - cpus_and(online_affinity, v->cpu_affinity, c->cpu_valid); + cpumask_and(&online_affinity, v->cpu_affinity, &c->cpu_valid);= if ( cpus_empty(online_affinity) && - cpu_isset(cpu, v->cpu_affinity) ) + cpumask_test_cpu(cpu, v->cpu_affinity) ) { printk("Breaking vcpu affinity for domain %d vcpu %d\n", v->domain->domain_id, v->vcpu_id); - cpus_setall(v->cpu_affinity); + cpumask_setall(v->cpu_affinity); affinity_broken =3D 1; } =20 @@ -602,10 +602,10 @@ int vcpu_set_affinity(struct vcpu *v, cp =20 vcpu_schedule_lock_irq(v); =20 - old_affinity =3D v->cpu_affinity; - v->cpu_affinity =3D *affinity; - *affinity =3D old_affinity; - if ( !cpu_isset(v->processor, v->cpu_affinity) ) + cpumask_copy(&old_affinity, v->cpu_affinity); + cpumask_copy(v->cpu_affinity, affinity); + cpumask_copy(affinity, &old_affinity); + if ( !cpumask_test_cpu(v->processor, v->cpu_affinity) ) set_bit(_VPF_migrating, &v->pause_flags); =20 vcpu_schedule_unlock_irq(v); --- a/xen/include/asm-x86/hvm/vmx/vmcs.h +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h @@ -68,7 +68,7 @@ struct vmx_domain { }; u64 eptp; } ept_control; - cpumask_t ept_synced; + cpumask_var_t ept_synced; }; =20 #define ept_get_wl(d) \ --- a/xen/include/xen/cpumask.h +++ b/xen/include/xen/cpumask.h @@ -81,24 +81,26 @@ =20 typedef struct cpumask{ DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; =20 -#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst)) -static inline void __cpu_set(int cpu, volatile cpumask_t *dstp) +#define cpu_set(cpu, dst) cpumask_set_cpu(cpu, &(dst)) +static inline void cpumask_set_cpu(int cpu, volatile cpumask_t *dstp) { set_bit(cpu, dstp->bits); } =20 -#define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst)) -static inline void __cpu_clear(int cpu, volatile cpumask_t *dstp) +#define cpu_clear(cpu, dst) cpumask_clear_cpu(cpu, &(dst)) +static inline void cpumask_clear_cpu(int cpu, volatile cpumask_t *dstp) { clear_bit(cpu, dstp->bits); } =20 +#define cpumask_setall(dst) __cpus_setall(dst, NR_CPUS) #define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS) static inline void __cpus_setall(cpumask_t *dstp, int nbits) { bitmap_fill(dstp->bits, nbits); } =20 +#define cpumask_clear(dst) __cpus_clear(dst, NR_CPUS) #define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS) static inline void __cpus_clear(cpumask_t *dstp, int nbits) { @@ -109,18 +111,21 @@ static inline void __cpus_clear(cpumask_ #define cpumask_test_cpu(cpu, cpumask) test_bit(cpu, (cpumask)->bits) #define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits) =20 -#define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), = &(cpumask)) -static inline int __cpu_test_and_set(int cpu, cpumask_t *addr) +#define cpu_test_and_set(cpu, cpumask) \ + cpumask_test_and_set_cpu(cpu, &(cpumask)) +static inline int cpumask_test_and_set_cpu(int cpu, cpumask_t *addr) { return test_and_set_bit(cpu, addr->bits); } =20 -#define cpu_test_and_clear(cpu, cpumask) __cpu_test_and_clear((cpu), = &(cpumask)) -static inline int __cpu_test_and_clear(int cpu, cpumask_t *addr) +#define cpu_test_and_clear(cpu, cpumask) \ + cpumask_test_and_clear_cpu(cpu, &(cpumask)) +static inline int cpumask_test_and_clear_cpu(int cpu, cpumask_t *addr) { return test_and_clear_bit(cpu, addr->bits); } =20 +#define cpumask_and(dst, src1, src2) __cpus_and(dst, src1, src2, NR_CPUS) #define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), = NR_CPUS) static inline void __cpus_and(cpumask_t *dstp, const cpumask_t *src1p, const cpumask_t *src2p, int nbits) @@ -128,6 +133,7 @@ static inline void __cpus_and(cpumask_t=20 bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits); } =20 +#define cpumask_or(dst, src1, src2) __cpus_or(dst, src1, src2, NR_CPUS) #define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), = NR_CPUS) static inline void __cpus_or(cpumask_t *dstp, const cpumask_t *src1p, const cpumask_t *src2p, int nbits) @@ -135,6 +141,7 @@ static inline void __cpus_or(cpumask_t * bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits); } =20 +#define cpumask_xor(dst, src1, src2) __cpus_xor(dst, src1, src2, NR_CPUS) #define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), = NR_CPUS) static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p, const cpumask_t *src2p, int nbits) @@ -142,6 +149,7 @@ static inline void __cpus_xor(cpumask_t=20 bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits); } =20 +#define cpumask_andnot(dst, src1, src2) __cpus_andnot(dst, src1, src2, = NR_CPUS) #define cpus_andnot(dst, src1, src2) \ __cpus_andnot(&(dst), &(src1), &(src2), = NR_CPUS) static inline void __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p, @@ -150,6 +158,7 @@ static inline void __cpus_andnot(cpumask bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits); } =20 +#define cpumask_complement(dst, src) __cpus_complement(dst, src, NR_CPUS) #define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), = NR_CPUS) static inline void __cpus_complement(cpumask_t *dstp, const cpumask_t *srcp, int nbits) @@ -186,6 +195,7 @@ static inline int __cpus_empty(const cpu return bitmap_empty(srcp->bits, nbits); } =20 +#define cpumask_full(cpumask) __cpus_full(cpumask, NR_CPUS) #define cpus_full(cpumask) __cpus_full(&(cpumask), NR_CPUS) static inline int __cpus_full(const cpumask_t *srcp, int nbits) { @@ -199,8 +209,8 @@ static inline int __cpus_weight(const cp return bitmap_weight(srcp->bits, nbits); } =20 -#define cpus_copy(dest, src) __cpus_copy(&(dest), &(src)) -static inline void __cpus_copy(cpumask_t *dstp, const cpumask_t *srcp) +#define cpus_copy(dest, src) cpumask_copy(&(dest), &(src)) +static inline void cpumask_copy(cpumask_t *dstp, const cpumask_t *srcp) { bitmap_copy(dstp->bits, srcp->bits, NR_CPUS); } @@ -322,6 +332,57 @@ static inline int __cpulist_scnprintf(ch return bitmap_scnlistprintf(buf, len, srcp->bits, nbits); } =20 +/* + * cpumask_var_t: struct cpumask for stack usage. + * + * Oh, the wicked games we play! In order to make kernel coding a + * little more difficult, we typedef cpumask_var_t to an array or a + * pointer: doing &mask on an array is a noop, so it still works. + * + * ie. + * cpumask_var_t tmpmask; + * if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL)) + * return -ENOMEM; + * + * ... use 'tmpmask' like a normal struct cpumask * ... + * + * free_cpumask_var(tmpmask); + */ +#if NR_CPUS > 2 * BITS_PER_LONG +#include + +typedef cpumask_t *cpumask_var_t; + +static inline bool_t alloc_cpumask_var(cpumask_var_t *mask) +{ + return (*mask =3D xmalloc(cpumask_t)) !=3D NULL; +} + +static inline void free_cpumask_var(cpumask_var_t mask) +{ + xfree(mask); +} +#else +typedef cpumask_t cpumask_var_t[1]; + +static inline bool_t alloc_cpumask_var(cpumask_var_t *mask) +{ + return 1; +} + +static inline void free_cpumask_var(cpumask_var_t mask) +{ +} +#endif + +static inline bool_t zalloc_cpumask_var(cpumask_var_t *mask) +{ + if (!alloc_cpumask_var(mask)) + return 0; + cpumask_clear(*mask); + return 1; +} + #if NR_CPUS > 1 #define for_each_cpu_mask(cpu, mask) \ for ((cpu) =3D first_cpu(mask); \ --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -161,12 +161,12 @@ struct vcpu=20 spinlock_t virq_lock; =20 /* Bitmask of CPUs on which this VCPU may run. */ - cpumask_t cpu_affinity; + cpumask_var_t cpu_affinity; /* Used to change affinity temporarily. */ - cpumask_t cpu_affinity_tmp; + cpumask_var_t cpu_affinity_tmp; =20 /* Bitmask of CPUs which are holding onto this VCPU's state. */ - cpumask_t vcpu_dirty_cpumask; + cpumask_var_t vcpu_dirty_cpumask; =20 /* Tasklet for continue_hypercall_on_cpu(). */ struct tasklet continue_hypercall_tasklet; @@ -289,7 +289,7 @@ struct domain struct vcpu **vcpu; =20 /* Bitmask of CPUs which are holding onto this domain's state. */ - cpumask_t domain_dirty_cpumask; + cpumask_var_t domain_dirty_cpumask; =20 struct arch_domain arch; =20 @@ -641,7 +641,7 @@ void watchdog_domain_destroy(struct doma #define is_hvm_domain(d) ((d)->is_hvm) #define is_hvm_vcpu(v) (is_hvm_domain(v->domain)) #define is_pinned_vcpu(v) ((v)->domain->is_pinned || \ - cpus_weight((v)->cpu_affinity) =3D=3D 1) + cpumask_weight((v)->cpu_affinity) =3D=3D 1) #define need_iommu(d) ((d)->need_iommu) =20 void set_vcpu_migration_delay(unsigned int delay); --=__PartD5F90FBA.0__= Content-Type: text/plain; name="cpumask-var.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cpumask-var.patch" The CPU masks embedded in these structures prevent NR_CPUS-independent=0Asi= zing of these structures.=0A=0ABasic concept (in xen/include/cpumask.h) = taken from recent Linux.=0A=0AFor scalability purposes, many other uses of = cpumask_t should be=0Areplaced by cpumask_var_t, particularly local = variables of functions.=0AThis implies that no functions should have = by-value cpumask_t=0Aparameters, and that the whole old cpumask interface = (cpus_...())=0Ashould go away in favor of the new (cpumask_...()) = one.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- = a/xen/arch/ia64/xen/mm.c=0A+++ b/xen/arch/ia64/xen/mm.c=0A@@ -3191,8 = +3191,9 @@ int get_page_type(struct page_info *page=0A * = may be unnecessary (e.g., page was GDT/LDT) but those =0A = * circumstances should be very rare.=0A */=0A- = cpumask_t mask =3D=0A- page_get_owner(page)->domain_= dirty_cpumask;=0A+ cpumask_t mask;=0A+=0A+ = cpumask_copy(&mask, page_get_owner(page)->domain_dirty_cpumask);=0A = tlbflush_filter(mask, page->tlbflush_timestamp);=0A =0A = if ( unlikely(!cpus_empty(mask)) )=0A--- a/xen/arch/ia64/xen/vhpt.c= =0A+++ b/xen/arch/ia64/xen/vhpt.c=0A@@ -516,7 +516,7 @@ void domain_flush_t= lb_vhpt(struct domain=0A on_each_cpu((void (*)(void = *))local_flush_tlb_all, NULL, 1);=0A else=0A on_each_cpu= ((void (*)(void *))flush_tlb_vhpt_all, d, 1);=0A- cpus_clear = (d->domain_dirty_cpumask);=0A+ cpumask_clear_cpu(d->domain_dirty_cpumask);= =0A }=0A =0A void flush_tlb_for_log_dirty(struct domain *d)=0A@@ -545,7 = +545,7 @@ void flush_tlb_for_log_dirty(struct doma=0A } else {=0A = on_each_cpu((void (*)(void *))flush_tlb_vhpt_all, d, 1);=0A }=0A- = cpus_clear (d->domain_dirty_cpumask);=0A+ cpumask_clear_cpu(d->domain= _dirty_cpumask);=0A }=0A =0A void flush_tlb_mask(const cpumask_t *mask)=0A-= -- a/xen/arch/x86/cpu/mcheck/vmce.c=0A+++ b/xen/arch/x86/cpu/mcheck/vmce.c= =0A@@ -321,8 +321,8 @@ int inject_vmce(struct domain *d)=0A = d->domain_id);=0A if ( guest_has_trap_callback(d, 0, = TRAP_machine_check) )=0A {=0A- d->vcpu[0]->cpu_a= ffinity_tmp =3D=0A- d->vcpu[0]->cpu_affinity;=0A+ = cpumask_copy(d->vcpu[0]->cpu_affinity_tmp,=0A+ = d->vcpu[0]->cpu_affinity);=0A cpus_clear(affinity)= ;=0A cpu_set(cpu, affinity);=0A mce_printk(= MCE_VERBOSE, "MCE: CPU%d set affinity, old %d\n",=0A--- a/xen/arch/x86/doma= in.c=0A+++ b/xen/arch/x86/domain.c=0A@@ -132,8 +132,8 @@ void startup_cpu_i= dle_loop(void)=0A struct vcpu *v =3D current;=0A =0A ASSERT(is_idle= _vcpu(v));=0A- cpu_set(smp_processor_id(), v->domain->domain_dirty_cpuma= sk);=0A- cpu_set(smp_processor_id(), v->vcpu_dirty_cpumask);=0A+ = cpumask_set_cpu(v->processor, v->domain->domain_dirty_cpumask);=0A+ = cpumask_set_cpu(v->processor, v->vcpu_dirty_cpumask);=0A =0A reset_stac= k_and_jump(idle_loop);=0A }=0A@@ -1391,7 +1391,7 @@ static void __context_s= witch(void)=0A struct desc_ptr gdt_desc;=0A =0A ASSERT(p = !=3D n);=0A- ASSERT(cpus_empty(n->vcpu_dirty_cpumask));=0A+ = ASSERT(cpumask_empty(n->vcpu_dirty_cpumask));=0A =0A if ( !is_idle_vcpu= (p) )=0A {=0A@@ -1408,8 +1408,8 @@ static void __context_switch(void)= =0A * which is synchronised on that function.=0A */=0A if ( = p->domain !=3D n->domain )=0A- cpu_set(cpu, n->domain->domain_dirty_= cpumask);=0A- cpu_set(cpu, n->vcpu_dirty_cpumask);=0A+ cpumask_se= t_cpu(cpu, n->domain->domain_dirty_cpumask);=0A+ cpumask_set_cpu(cpu, = n->vcpu_dirty_cpumask);=0A =0A if ( !is_idle_vcpu(n) )=0A {=0A@@ = -1452,8 +1452,8 @@ static void __context_switch(void)=0A }=0A =0A = if ( p->domain !=3D n->domain )=0A- cpu_clear(cpu, p->domain->domain= _dirty_cpumask);=0A- cpu_clear(cpu, p->vcpu_dirty_cpumask);=0A+ = cpumask_clear_cpu(cpu, p->domain->domain_dirty_cpumask);=0A+ cpumask_cle= ar_cpu(cpu, p->vcpu_dirty_cpumask);=0A =0A per_cpu(curr_vcpu, cpu) =3D = n;=0A }=0A@@ -1462,10 +1462,11 @@ static void __context_switch(void)=0A = void context_switch(struct vcpu *prev, struct vcpu *next)=0A {=0A = unsigned int cpu =3D smp_processor_id();=0A- cpumask_t dirty_mask =3D = next->vcpu_dirty_cpumask;=0A+ cpumask_t dirty_mask;=0A =0A = ASSERT(local_irq_is_enabled());=0A =0A+ cpumask_copy(&dirty_mask, = next->vcpu_dirty_cpumask);=0A /* Allow at most one CPU at a time to be = dirty. */=0A ASSERT(cpus_weight(dirty_mask) <=3D 1);=0A if ( = unlikely(!cpu_isset(cpu, dirty_mask) && !cpus_empty(dirty_mask)) )=0A@@ = -1557,11 +1558,11 @@ void sync_local_execstate(void)=0A =0A void sync_vcpu_= execstate(struct vcpu *v)=0A {=0A- if ( cpu_isset(smp_processor_id(), = v->vcpu_dirty_cpumask) )=0A+ if ( cpumask_test_cpu(smp_processor_id(), = v->vcpu_dirty_cpumask) )=0A sync_local_execstate();=0A =0A /* = Other cpus call __sync_local_execstate from flush ipi handler. */=0A- = flush_tlb_mask(&v->vcpu_dirty_cpumask);=0A+ flush_tlb_mask(v->vcpu_dirty= _cpumask);=0A }=0A =0A #define next_arg(fmt, args) ({ = \=0A@@ -1922,7 +1923,7 @@ int domain_relinquish_res= ources(struct d=0A int ret;=0A struct vcpu *v;=0A =0A- = BUG_ON(!cpus_empty(d->domain_dirty_cpumask));=0A+ BUG_ON(!cpumask_empty(= d->domain_dirty_cpumask));=0A =0A switch ( d->arch.relmem )=0A = {=0A--- a/xen/arch/x86/hvm/hvm.c=0A+++ b/xen/arch/x86/hvm/hvm.c=0A@@ = -3089,7 +3089,7 @@ static int hvmop_flush_tlb_all(void)=0A = paging_update_cr3(v);=0A =0A /* Flush all dirty TLBs. */=0A- = flush_tlb_mask(&d->domain_dirty_cpumask);=0A+ flush_tlb_mask(d->domain_d= irty_cpumask);=0A =0A /* Done. */=0A for_each_vcpu ( d, v )=0A--- = a/xen/arch/x86/hvm/svm/svm.c=0A+++ b/xen/arch/x86/hvm/svm/svm.c=0A@@ = -1348,7 +1348,7 @@ static int svm_is_erratum_383(struct cpu=0A = wrmsrl(MSR_IA32_MCG_STATUS, msr_content & ~(1ULL << 2));=0A =0A /* = flush TLB */=0A- flush_tlb_mask(&v->domain->domain_dirty_cpumask);=0A+ = flush_tlb_mask(v->domain->domain_dirty_cpumask);=0A =0A return 1;=0A = }=0A--- a/xen/arch/x86/hvm/vmx/vmx.c=0A+++ b/xen/arch/x86/hvm/vmx/vmx.c=0A@= @ -88,8 +88,14 @@ static int vmx_domain_initialise(struct =0A = d->arch.hvm_domain.vmx.ept_control.asr =3D=0A pagetable_get_pfn(p2= m_get_pagetable(p2m_get_hostp2m(d)));=0A =0A+ if ( !zalloc_cpumask_var(&= d->arch.hvm_domain.vmx.ept_synced) )=0A+ return -ENOMEM;=0A+=0A = if ( (rc =3D vmx_alloc_vlapic_mapping(d)) !=3D 0 )=0A+ {=0A+ = free_cpumask_var(d->arch.hvm_domain.vmx.ept_synced);=0A return = rc;=0A+ }=0A =0A return 0;=0A }=0A@@ -98,6 +104,7 @@ static void = vmx_domain_destroy(struct do=0A {=0A if ( paging_mode_hap(d) )=0A = on_each_cpu(__ept_sync_domain, d, 1);=0A+ free_cpumask_var(d->arch.hv= m_domain.vmx.ept_synced);=0A vmx_free_vlapic_mapping(d);=0A }=0A =0A@@ = -660,8 +667,9 @@ static void vmx_ctxt_switch_to(struct vc=0A {=0A = unsigned int cpu =3D smp_processor_id();=0A /* Test-and-test-and= -set this CPU in the EPT-is-synced mask. */=0A- if ( !cpu_isset(cpu,= d->arch.hvm_domain.vmx.ept_synced) &&=0A- !cpu_test_and_set(cp= u, d->arch.hvm_domain.vmx.ept_synced) )=0A+ if ( !cpumask_test_cpu(c= pu, d->arch.hvm_domain.vmx.ept_synced) &&=0A+ !cpumask_test_and= _set_cpu(cpu,=0A+ d->arch.hvm_domain.= vmx.ept_synced) )=0A __invept(INVEPT_SINGLE_CONTEXT, ept_get_ep= tp(d), 0);=0A }=0A =0A@@ -1217,10 +1225,10 @@ void ept_sync_domain(stru= ct domain *d)=0A * the ept_synced mask before on_selected_cpus() = reads it, resulting in=0A * unnecessary extra flushes, to avoid = allocating a cpumask_t on the stack.=0A */=0A- cpus_and(d->arch.hvm= _domain.vmx.ept_synced,=0A- d->domain_dirty_cpumask, cpu_online= _map);=0A+ cpumask_and(d->arch.hvm_domain.vmx.ept_synced,=0A+ = d->domain_dirty_cpumask, &cpu_online_map);=0A =0A- on_selected_cpus= (&d->arch.hvm_domain.vmx.ept_synced,=0A+ on_selected_cpus(d->arch.hvm_do= main.vmx.ept_synced,=0A __ept_sync_domain, d, 1);=0A = }=0A =0A--- a/xen/arch/x86/mm.c=0A+++ b/xen/arch/x86/mm.c=0A@@ -612,7 = +612,7 @@ static void invalidate_shadow_ldt(struct=0A =0A /* Rid TLBs = of stale mappings (guest mappings and shadow mappings). */=0A if ( = flush )=0A- flush_tlb_mask(&v->vcpu_dirty_cpumask);=0A+ = flush_tlb_mask(v->vcpu_dirty_cpumask);=0A =0A out:=0A spin_unlock(&v->= arch.shadow_ldt_lock);=0A@@ -1338,7 +1338,7 @@ static void pae_flush_pgd(= =0A if ( pagetable_get_pfn(v->arch.guest_table) =3D=3D mfn = )=0A {=0A paging_update_cr3(v);=0A- = cpus_or(m, m, v->vcpu_dirty_cpumask);=0A+ cpumask_or(&m,= &m, v->vcpu_dirty_cpumask);=0A }=0A flush_tlb_mask(&m)= ;=0A }=0A@@ -1365,7 +1365,7 @@ static void pae_flush_pgd(=0A = spin_unlock(&cache->lock);=0A }=0A =0A- flush_tlb_mask(&d->domain_di= rty_cpumask);=0A+ flush_tlb_mask(d->domain_dirty_cpumask);=0A }=0A = #else=0A # define pae_flush_pgd(mfn, idx, nl3e) ((void)0)=0A@@ -2421,7 = +2421,9 @@ static int __get_page_type(struct page_i=0A * = may be unnecessary (e.g., page was GDT/LDT) but those =0A = * circumstances should be very rare.=0A */=0A- = cpumask_t mask =3D d->domain_dirty_cpumask;=0A+ = cpumask_t mask;=0A+=0A+ cpumask_copy(&mask, d->domain_dirty_= cpumask);=0A =0A /* Don't flush if the timestamp is old = enough */=0A tlbflush_filter(mask, page->tlbflush_timestamp= );=0A@@ -2903,7 +2905,7 @@ static inline int vcpumask_to_pcpumask(=0A = if ( (vcpu_id >=3D d->max_vcpus) )=0A return 0;=0A = if ( ((v =3D d->vcpu[vcpu_id]) !=3D NULL) )=0A- = cpus_or(*pmask, *pmask, v->vcpu_dirty_cpumask);=0A+ = cpumask_or(pmask, pmask, v->vcpu_dirty_cpumask);=0A }=0A }=0A = }=0A@@ -3161,11 +3163,11 @@ int do_mmuext_op(=0A }=0A =0A = case MMUEXT_TLB_FLUSH_ALL:=0A- flush_tlb_mask(&d->domain_dirty_c= pumask);=0A+ flush_tlb_mask(d->domain_dirty_cpumask);=0A = break;=0A =0A case MMUEXT_INVLPG_ALL:=0A- = flush_tlb_one_mask(&d->domain_dirty_cpumask, op.arg1.linear_addr);=0A+ = flush_tlb_one_mask(d->domain_dirty_cpumask, op.arg1.linear_addr);=0A= break;=0A =0A case MMUEXT_FLUSH_CACHE:=0A@@ -4345,7 = +4347,7 @@ static int __do_update_va_mapping(=0A flush_tlb_loca= l();=0A break;=0A case UVMF_ALL:=0A- = flush_tlb_mask(&d->domain_dirty_cpumask);=0A+ flush_tlb_mask(d->= domain_dirty_cpumask);=0A break;=0A default:=0A = rc =3D vcpumask_to_pcpumask(d, const_guest_handle_from_ptr(bmap_ptr,= =0A@@ -4365,7 +4367,7 @@ static int __do_update_va_mapping(=0A = flush_tlb_one_local(va);=0A break;=0A case = UVMF_ALL:=0A- flush_tlb_one_mask(&d->domain_dirty_cpumask, = va);=0A+ flush_tlb_one_mask(d->domain_dirty_cpumask, va);=0A = break;=0A default:=0A rc =3D vcpumask_to_pcpum= ask(d, const_guest_handle_from_ptr(bmap_ptr,=0A--- a/xen/arch/x86/mm/hap/ha= p.c=0A+++ b/xen/arch/x86/mm/hap/hap.c=0A@@ -72,7 +72,7 @@ static int = hap_enable_vram_tracking(stru=0A for (i =3D dirty_vram->begin_pfn; i < = dirty_vram->end_pfn; i++)=0A p2m_change_type(p2m_get_hostp2m(d), = i, p2m_ram_rw, p2m_ram_logdirty);=0A =0A- flush_tlb_mask(&d->domain_dirt= y_cpumask);=0A+ flush_tlb_mask(d->domain_dirty_cpumask);=0A return = 0;=0A }=0A =0A@@ -92,7 +92,7 @@ static int hap_disable_vram_tracking(str=0A= for (i =3D dirty_vram->begin_pfn; i < dirty_vram->end_pfn; i++)=0A = p2m_change_type(p2m_get_hostp2m(d), i, p2m_ram_logdirty, p2m_ram_rw);= =0A =0A- flush_tlb_mask(&d->domain_dirty_cpumask);=0A+ flush_tlb_mask= (d->domain_dirty_cpumask);=0A return 0;=0A }=0A =0A@@ -108,7 +108,7 @@ = static void hap_clean_vram_tracking(stru=0A for (i =3D dirty_vram->begi= n_pfn; i < dirty_vram->end_pfn; i++)=0A p2m_change_type(p2m_get_hos= tp2m(d), i, p2m_ram_rw, p2m_ram_logdirty);=0A =0A- flush_tlb_mask(&d->do= main_dirty_cpumask);=0A+ flush_tlb_mask(d->domain_dirty_cpumask);=0A = }=0A =0A static void hap_vram_tracking_init(struct domain *d)=0A@@ -202,7 = +202,7 @@ static int hap_enable_log_dirty(struct d=0A /* set l1e = entries of P2M table to be read-only. */=0A p2m_change_entry_type_globa= l(p2m_get_hostp2m(d),=0A p2m_ram_rw, p2m_ram_logdirty);=0A- = flush_tlb_mask(&d->domain_dirty_cpumask);=0A+ flush_tlb_mask(d->domain_d= irty_cpumask);=0A return 0;=0A }=0A =0A@@ -223,7 +223,7 @@ static void = hap_clean_dirty_bitmap(struc=0A /* set l1e entries of P2M table to be = read-only. */=0A p2m_change_entry_type_global(p2m_get_hostp2m(d),=0A = p2m_ram_rw, p2m_ram_logdirty);=0A- flush_tlb_mask(&d->domain_dirty= _cpumask);=0A+ flush_tlb_mask(d->domain_dirty_cpumask);=0A }=0A =0A = void hap_logdirty_init(struct domain *d)=0A@@ -842,7 +842,7 @@ hap_write_p2= m_entry(struct vcpu *v, unsi=0A safe_write_pte(p, new);=0A if ( = (old_flags & _PAGE_PRESENT)=0A && (level =3D=3D 1 || (level = =3D=3D 2 && (old_flags & _PAGE_PSE))) )=0A- flush_tlb_mask(&v->= domain->domain_dirty_cpumask);=0A+ flush_tlb_mask(v->domain->do= main_dirty_cpumask);=0A =0A #if CONFIG_PAGING_LEVELS =3D=3D 3=0A /* = install P2M in monitor table for PAE Xen */=0A--- a/xen/arch/x86/mm/shadow/= common.c=0A+++ b/xen/arch/x86/mm/shadow/common.c=0A@@ -703,7 +703,7 @@ = static int oos_remove_write_access(struc=0A }=0A =0A if ( ftlb = )=0A- flush_tlb_mask(&v->domain->domain_dirty_cpumask);=0A+ = flush_tlb_mask(v->domain->domain_dirty_cpumask);=0A =0A return 0;=0A = }=0A@@ -1153,7 +1153,7 @@ sh_validate_guest_pt_write(struct vcpu *=0A = rc =3D sh_validate_guest_entry(v, gmfn, entry, size);=0A if ( rc & = SHADOW_SET_FLUSH )=0A /* Need to flush TLBs to pick up shadow PT = changes */=0A- flush_tlb_mask(&d->domain_dirty_cpumask);=0A+ = flush_tlb_mask(d->domain_dirty_cpumask);=0A if ( rc & SHADOW_SET_ERROR = ) =0A {=0A /* This page is probably not a pagetable any more: = tear it out of the =0A@@ -1369,7 +1369,7 @@ static void _shadow_prealloc(= =0A /* See if that freed up enough space */=0A = if ( d->arch.paging.shadow.free_pages >=3D pages )=0A = {=0A- flush_tlb_mask(&d->domain_dirty_cpumask);=0A+ = flush_tlb_mask(d->domain_dirty_cpumask);=0A = return;=0A }=0A }=0A@@ -1422,7 +1422,7 @@ = static void shadow_blow_tables(struct do=0A = pagetable_get_mfn(v->arch.shadow_table[i]), 0);=0A =0A /* Make sure = everyone sees the unshadowings */=0A- flush_tlb_mask(&d->domain_dirty_cp= umask);=0A+ flush_tlb_mask(d->domain_dirty_cpumask);=0A }=0A =0A void = shadow_blow_tables_per_domain(struct domain *d)=0A@@ -1535,7 +1535,7 @@ = mfn_t shadow_alloc(struct domain *d, =0A sp =3D page_list_remove_h= ead(&d->arch.paging.shadow.freelist);=0A /* Before we overwrite = the old contents of this page, =0A * we need to be sure that no = TLB holds a pointer to it. */=0A- mask =3D d->domain_dirty_cpumask;= =0A+ cpumask_copy(&mask, d->domain_dirty_cpumask);=0A = tlbflush_filter(mask, sp->tlbflush_timestamp);=0A if ( unlikely(!cp= us_empty(mask)) )=0A {=0A@@ -2767,7 +2767,7 @@ void sh_remove_shado= ws(struct vcpu *v, m=0A =0A /* Need to flush TLBs now, so that linear = maps are safe next time we =0A * take a fault. */=0A- flush_tlb_mas= k(&v->domain->domain_dirty_cpumask);=0A+ flush_tlb_mask(v->domain->domai= n_dirty_cpumask);=0A =0A if ( do_locking ) shadow_unlock(v->domain);=0A= }=0A@@ -3474,7 +3474,7 @@ static void sh_unshadow_for_p2m_change(s=0A = {=0A sh_remove_all_shadows_and_parents(v, mfn);=0A = if ( sh_remove_all_mappings(v, mfn) )=0A- flush_tlb_mask= (&d->domain_dirty_cpumask);=0A+ flush_tlb_mask(d->domain_dir= ty_cpumask);=0A }=0A }=0A =0A@@ -3509,7 +3509,8 @@ static void = sh_unshadow_for_p2m_change(s=0A /* This GFN->MFN = mapping has gone away */=0A sh_remove_all_shadows_and_p= arents(v, omfn);=0A if ( sh_remove_all_mappings(v, = omfn) )=0A- cpus_or(flushmask, flushmask, d->domain_= dirty_cpumask);=0A+ cpumask_or(&flushmask, = &flushmask,=0A+ d->domain_dirty_cpumask);= =0A }=0A omfn =3D _mfn(mfn_x(omfn) + = 1);=0A }=0A@@ -3806,7 +3807,7 @@ int shadow_track_dirty_vram(st= ruct domai=0A }=0A }=0A if ( flush_tlb )=0A- = flush_tlb_mask(&d->domain_dirty_cpumask);=0A+ flush_tlb_mask(d->doma= in_dirty_cpumask);=0A goto out;=0A =0A out_sl1ma:=0A--- a/xen/arch/x86/= mm/shadow/multi.c=0A+++ b/xen/arch/x86/mm/shadow/multi.c=0A@@ -3248,7 = +3248,7 @@ static int sh_page_fault(struct vcpu *v,=0A */=0A = perfc_incr(shadow_rm_write_flush_tlb);=0A atomic_inc(&d->arch.pa= ging.shadow.gtable_dirty_version);=0A- flush_tlb_mask(&d->domain_dir= ty_cpumask);=0A+ flush_tlb_mask(d->domain_dirty_cpumask);=0A = }=0A =0A #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)=0A@@ -4294,7 = +4294,7 @@ sh_update_cr3(struct vcpu *v, int do_loc=0A * (old) shadow = linear maps in the writeable mapping heuristics. */=0A #if GUEST_PAGING_LEV= ELS =3D=3D 2=0A if ( sh_remove_write_access(v, gmfn, 2, 0) !=3D 0 = )=0A- flush_tlb_mask(&v->domain->domain_dirty_cpumask);=0A+ = flush_tlb_mask(d->domain_dirty_cpumask);=0A sh_set_toplevel_shadow(v, = 0, gmfn, SH_type_l2_shadow);=0A #elif GUEST_PAGING_LEVELS =3D=3D 3=0A = /* PAE guests have four shadow_table entries, based on the =0A@@ -4317,7 = +4317,7 @@ sh_update_cr3(struct vcpu *v, int do_loc=0A }=0A = }=0A if ( flush ) =0A- flush_tlb_mask(&v->domain->d= omain_dirty_cpumask);=0A+ flush_tlb_mask(d->domain_dirty_cpumask= );=0A /* Now install the new shadows. */=0A for ( i =3D 0; = i < 4; i++ ) =0A {=0A@@ -4338,7 +4338,7 @@ sh_update_cr3(struct = vcpu *v, int do_loc=0A }=0A #elif GUEST_PAGING_LEVELS =3D=3D 4=0A = if ( sh_remove_write_access(v, gmfn, 4, 0) !=3D 0 )=0A- flush_tlb_ma= sk(&v->domain->domain_dirty_cpumask);=0A+ flush_tlb_mask(d->domain_d= irty_cpumask);=0A sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow)= ;=0A #else=0A #error This should never happen =0A@@ -4755,7 +4755,7 @@ = static void sh_pagetable_dying(struct vc=0A }=0A }=0A if ( = flush )=0A- flush_tlb_mask(&v->domain->domain_dirty_cpumask);=0A+ = flush_tlb_mask(v->domain->domain_dirty_cpumask);=0A =0A /* = Remember that we've seen the guest use this interface, so we=0A * can = rely on it using it in future, instead of guessing at=0A@@ -4788,7 +4788,7 = @@ static void sh_pagetable_dying(struct vc=0A mfn_to_page(gmfn)->s= hadow_flags |=3D SHF_pagetable_dying;=0A shadow_unhook_mappings(v, = smfn, 1/* user pages only */);=0A /* Now flush the TLB: we removed = toplevel mappings. */=0A- flush_tlb_mask(&v->domain->domain_dirty_cp= umask);=0A+ flush_tlb_mask(v->domain->domain_dirty_cpumask);=0A = }=0A =0A /* Remember that we've seen the guest use this interface, so = we=0A--- a/xen/arch/x86/traps.c=0A+++ b/xen/arch/x86/traps.c=0A@@ -2965,7 = +2965,7 @@ static void nmi_mce_softirq(void)=0A =0A /* Set the tmp = value unconditionally, so that=0A * the check in the iret hypercall = works. */=0A- st->vcpu->cpu_affinity_tmp =3D st->vcpu->cpu_affinity;=0A+= cpumask_copy(st->vcpu->cpu_affinity_tmp, st->vcpu->cpu_affinity);=0A = =0A if ((cpu !=3D st->processor)=0A || (st->processor !=3D = st->vcpu->processor))=0A@@ -2996,11 +2996,11 @@ void async_exception_cleanu= p(struct vcpu=0A return;=0A =0A /* Restore affinity. */=0A- = if ( !cpus_empty(curr->cpu_affinity_tmp) &&=0A- !cpus_equal(curr->= cpu_affinity_tmp, curr->cpu_affinity) )=0A+ if ( !cpumask_empty(curr->cp= u_affinity_tmp) &&=0A+ !cpumask_equal(curr->cpu_affinity_tmp, = curr->cpu_affinity) )=0A {=0A- vcpu_set_affinity(curr, = &curr->cpu_affinity_tmp);=0A- cpus_clear(curr->cpu_affinity_tmp);=0A= + vcpu_set_affinity(curr, curr->cpu_affinity_tmp);=0A+ = cpumask_clear(curr->cpu_affinity_tmp);=0A }=0A =0A if ( !(curr->asy= nc_exception_mask & (curr->async_exception_mask - 1)) )=0A@@ -3048,7 = +3048,7 @@ void async_exception_cleanup(struct vcpu=0A int = cpu =3D smp_processor_id();=0A cpumask_t affinity;=0A =0A- = curr->cpu_affinity_tmp =3D curr->cpu_affinity;=0A+ = cpumask_copy(curr->cpu_affinity_tmp, curr->cpu_affinity);=0A = cpus_clear(affinity);=0A cpu_set(cpu, affinity);=0A= printk(XENLOG_DEBUG "MCE: CPU%d set affinity, old = %d\n",=0A--- a/xen/common/domain.c=0A+++ b/xen/common/domain.c=0A@@ -151,6 = +151,11 @@ struct vcpu *alloc_vcpu(=0A =0A tasklet_init(&v->continue_hy= percall_tasklet, NULL, 0);=0A =0A+ if ( !zalloc_cpumask_var(&v->cpu_affi= nity) ||=0A+ !zalloc_cpumask_var(&v->cpu_affinity_tmp) ||=0A+ = !zalloc_cpumask_var(&v->vcpu_dirty_cpumask) )=0A+ goto fail_free;= =0A+=0A if ( is_idle_domain(d) )=0A {=0A v->runstate.state = =3D RUNSTATE_running;=0A@@ -167,16 +172,17 @@ struct vcpu *alloc_vcpu(=0A = }=0A =0A if ( sched_init_vcpu(v, cpu_id) !=3D 0 )=0A- {=0A- = destroy_waitqueue_vcpu(v);=0A- free_vcpu_struct(v);=0A- = return NULL;=0A- }=0A+ goto fail_wq;=0A =0A if ( vcpu_initial= ise(v) !=3D 0 )=0A {=0A sched_destroy_vcpu(v);=0A+ fail_wq:=0A = destroy_waitqueue_vcpu(v);=0A+ fail_free:=0A+ free_cpumask_v= ar(v->cpu_affinity);=0A+ free_cpumask_var(v->cpu_affinity_tmp);=0A+ = free_cpumask_var(v->vcpu_dirty_cpumask);=0A free_vcpu_struct= (v);=0A return NULL;=0A }=0A@@ -246,6 +252,9 @@ struct domain = *domain_create(=0A spin_lock_init(&d->shutdown_lock);=0A d->shutdow= n_code =3D -1;=0A =0A+ if ( !zalloc_cpumask_var(&d->domain_dirty_cpumask= ) )=0A+ goto fail;=0A+=0A if ( domcr_flags & DOMCRF_hvm )=0A = d->is_hvm =3D 1;=0A =0A@@ -346,6 +355,7 @@ struct domain *domain_creat= e(=0A xsm_free_security_domain(d);=0A xfree(d->pirq_mask);=0A = xfree(d->pirq_to_evtchn);=0A+ free_cpumask_var(d->domain_dirty_cpumas= k);=0A free_domain_struct(d);=0A return NULL;=0A }=0A@@ -361,7 = +371,7 @@ void domain_update_node_affinity(struct =0A spin_lock(&d->nod= e_affinity_lock);=0A =0A for_each_vcpu ( d, v )=0A- cpus_or(cpum= ask, cpumask, v->cpu_affinity);=0A+ cpumask_or(&cpumask, &cpumask, = v->cpu_affinity);=0A =0A for_each_online_node ( node )=0A if ( = cpus_intersects(node_to_cpumask(node), cpumask) )=0A@@ -658,7 +668,12 @@ = static void complete_domain_destroy(stru=0A =0A for ( i =3D d->max_vcpu= s - 1; i >=3D 0; i-- )=0A if ( (v =3D d->vcpu[i]) !=3D NULL )=0A+ = {=0A+ free_cpumask_var(v->cpu_affinity);=0A+ = free_cpumask_var(v->cpu_affinity_tmp);=0A+ free_cpumask_var(v->v= cpu_dirty_cpumask);=0A free_vcpu_struct(v);=0A+ }=0A = =0A if ( d->target !=3D NULL )=0A put_domain(d->target);=0A@@ = -669,6 +684,7 @@ static void complete_domain_destroy(stru=0A xfree(d->p= irq_to_evtchn);=0A =0A xsm_free_security_domain(d);=0A+ free_cpumask= _var(d->domain_dirty_cpumask);=0A free_domain_struct(d);=0A =0A = send_guest_global_virq(dom0, VIRQ_DOM_EXC);=0A@@ -789,7 +805,7 @@ void = vcpu_reset(struct vcpu *v)=0A v->async_exception_mask =3D 0;=0A = memset(v->async_exception_state, 0, sizeof(v->async_exception_state));=0A = #endif=0A- cpus_clear(v->cpu_affinity_tmp);=0A+ cpumask_clear(v->cpu_= affinity_tmp);=0A clear_bit(_VPF_blocked, &v->pause_flags);=0A =0A = domain_unlock(v->domain);=0A--- a/xen/common/domctl.c=0A+++ b/xen/common/do= mctl.c=0A@@ -589,7 +589,7 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc=0A = else=0A {=0A ret =3D cpumask_to_xenctl_cpumap(=0A= - &op->u.vcpuaffinity.cpumap, &v->cpu_affinity);=0A+ = &op->u.vcpuaffinity.cpumap, v->cpu_affinity);=0A }=0A =0A = vcpuaffinity_out:=0A--- a/xen/common/grant_table.c=0A+++ b/xen/common/gr= ant_table.c=0A@@ -1013,7 +1013,7 @@ gnttab_unmap_grant_ref(=0A = goto fault;=0A }=0A =0A- flush_tlb_mask(¤t->domain= ->domain_dirty_cpumask);=0A+ flush_tlb_mask(current->domain->domain_= dirty_cpumask);=0A =0A for ( i =3D 0; i < partial_done; i++ )=0A = __gnttab_unmap_common_complete(&(common[i]));=0A@@ -1028,7 = +1028,7 @@ gnttab_unmap_grant_ref(=0A return 0;=0A =0A fault:=0A- = flush_tlb_mask(¤t->domain->domain_dirty_cpumask);=0A+ flush_tlb_ma= sk(current->domain->domain_dirty_cpumask);=0A =0A for ( i =3D 0; i < = partial_done; i++ )=0A __gnttab_unmap_common_complete(&(common[i]))= ;=0A@@ -1075,7 +1075,7 @@ gnttab_unmap_and_replace(=0A = goto fault;=0A }=0A =0A- flush_tlb_mask(¤t->do= main->domain_dirty_cpumask);=0A+ flush_tlb_mask(current->domain->dom= ain_dirty_cpumask);=0A =0A for ( i =3D 0; i < partial_done;= i++ )=0A __gnttab_unmap_common_complete(&(common[i]));=0A@@ = -1090,7 +1090,7 @@ gnttab_unmap_and_replace(=0A return 0;=0A =0A = fault:=0A- flush_tlb_mask(¤t->domain->domain_dirty_cpumask);=0A+ = flush_tlb_mask(current->domain->domain_dirty_cpumask);=0A =0A for ( = i =3D 0; i < partial_done; i++ )=0A __gnttab_unmap_common_complete(= &(common[i]));=0A@@ -1496,7 +1496,7 @@ gnttab_transfer(=0A #ifndef = __ia64__ /* IA64 implicitly replaces the old page in steal_page(). */=0A = guest_physmap_remove_page(d, gop.mfn, mfn, 0);=0A #endif=0A- = flush_tlb_mask(&d->domain_dirty_cpumask);=0A+ flush_tlb_mask(d->doma= in_dirty_cpumask);=0A =0A /* Find the target domain. */=0A = if ( unlikely((e =3D rcu_lock_domain_by_id(gop.domid)) =3D=3D NULL) = )=0A--- a/xen/common/keyhandler.c=0A+++ b/xen/common/keyhandler.c=0A@@ = -243,7 +243,7 @@ static void dump_domains(unsigned char k=0A {=0A = unsigned int i;=0A printk("General information for domain = %u:\n", d->domain_id);=0A- cpuset_print(tmpstr, sizeof(tmpstr), = d->domain_dirty_cpumask);=0A+ cpuset_print(tmpstr, sizeof(tmpstr), = *d->domain_dirty_cpumask);=0A printk(" refcnt=3D%d dying=3D%d = nr_pages=3D%d xenheap_pages=3D%d "=0A "dirty_cpus=3D%s = max_pages=3D%u\n",=0A atomic_read(&d->refcnt), d->is_dying,= =0A@@ -277,9 +277,9 @@ static void dump_domains(unsigned char k=0A = v->pause_flags, v->poll_evtchn,=0A vcpu_info(= v, evtchn_upcall_pending),=0A vcpu_info(v, evtchn_upcall= _mask));=0A- cpuset_print(tmpstr, sizeof(tmpstr), v->vcpu_dirty_= cpumask);=0A+ cpuset_print(tmpstr, sizeof(tmpstr), *v->vcpu_dirt= y_cpumask);=0A printk("dirty_cpus=3D%s ", tmpstr);=0A- = cpuset_print(tmpstr, sizeof(tmpstr), v->cpu_affinity);=0A+ = cpuset_print(tmpstr, sizeof(tmpstr), *v->cpu_affinity);=0A = printk("cpu_affinity=3D%s\n", tmpstr);=0A arch_dump_vcpu_info(v= );=0A periodic_timer_print(tmpstr, sizeof(tmpstr), v->periodic_= period);=0A--- a/xen/common/sched_credit.c=0A+++ b/xen/common/sched_credit.= c=0A@@ -292,7 +292,7 @@ __runq_tickle(unsigned int cpu, struct c=0A = {=0A cpumask_t idle_mask;=0A =0A- cpus_and(idle_mas= k, prv->idlers, new->vcpu->cpu_affinity);=0A+ cpumask_and(&idle_= mask, &prv->idlers, new->vcpu->cpu_affinity);=0A if ( = !cpus_empty(idle_mask) )=0A {=0A CSCHED_STAT_CR= ANK(tickle_idlers_some);=0A@@ -305,7 +305,7 @@ __runq_tickle(unsigned int = cpu, struct c=0A else=0A cpus_or(mask, = mask, idle_mask);=0A }=0A- cpus_and(mask, mask, = new->vcpu->cpu_affinity);=0A+ cpumask_and(&mask, &mask, = new->vcpu->cpu_affinity);=0A }=0A }=0A =0A@@ -455,7 +455,7 @@ = __csched_vcpu_is_migrateable(struct vcpu=0A */=0A return = !vc->is_running &&=0A !__csched_vcpu_is_cache_hot(vc) &&=0A- = cpu_isset(dest_cpu, vc->cpu_affinity);=0A+ cpumask_test_cp= u(dest_cpu, vc->cpu_affinity);=0A }=0A =0A static int=0A@@ -472,7 +472,7 = @@ _csched_cpu_pick(const struct scheduler =0A * preference to its = current processor if it's in there.=0A */=0A online =3D CSCHED_CPU= ONLINE(vc->domain->cpupool);=0A- cpus_and(cpus, *online, vc->cpu_affinit= y);=0A+ cpumask_and(&cpus, online, vc->cpu_affinity);=0A cpu =3D = cpu_isset(vc->processor, cpus)=0A ? vc->processor=0A = : cycle_cpu(vc->processor, cpus);=0A--- a/xen/common/sched_sedf.c=0A+++ = b/xen/common/sched_sedf.c=0A@@ -448,7 +448,7 @@ static int sedf_pick_cpu(co= nst struct sc=0A cpumask_t *online;=0A =0A online =3D SEDF_CPUONLIN= E(v->domain->cpupool);=0A- cpus_and(online_affinity, v->cpu_affinity, = *online);=0A+ cpumask_and(&online_affinity, v->cpu_affinity, online);=0A= return first_cpu(online_affinity);=0A }=0A =0A--- a/xen/common/schedul= e.c=0A+++ b/xen/common/schedule.c=0A@@ -196,9 +196,9 @@ int sched_init_vcpu= (struct vcpu *v, unsi=0A */=0A v->processor =3D processor;=0A = if ( is_idle_domain(d) || d->is_pinned )=0A- v->cpu_affinity =3D = cpumask_of_cpu(processor);=0A+ cpumask_copy(v->cpu_affinity, = cpumask_of(processor));=0A else=0A- cpus_setall(v->cpu_affinity)= ;=0A+ cpumask_setall(v->cpu_affinity);=0A =0A /* Initialise the = per-vcpu timers. */=0A init_timer(&v->periodic_timer, vcpu_periodic_tim= er_fn,=0A@@ -273,7 +273,7 @@ int sched_move_domain(struct domain *d, =0A = SCHED_OP(VCPU2OP(v), remove_vcpu, v);=0A SCHED_OP(VCPU2OP(v),= free_vdata, v->sched_priv);=0A =0A- cpus_setall(v->cpu_affinity);= =0A+ cpumask_setall(v->cpu_affinity);=0A v->processor =3D = new_p;=0A v->sched_priv =3D vcpu_priv[v->vcpu_id];=0A = evtchn_move_pirqs(v);=0A@@ -435,7 +435,7 @@ static void vcpu_migrate(struct= vcpu *v)=0A */=0A if ( pick_called &&=0A = (new_lock =3D=3D per_cpu(schedule_data, new_cpu).schedule_lock) = &&=0A- cpu_isset(new_cpu, v->cpu_affinity) &&=0A+ = cpumask_test_cpu(new_cpu, v->cpu_affinity) &&=0A = cpu_isset(new_cpu, v->domain->cpupool->cpu_valid) )=0A = break;=0A =0A@@ -550,13 +550,13 @@ int cpu_disable_scheduler(unsigned int = c=0A {=0A vcpu_schedule_lock_irq(v);=0A =0A- = cpus_and(online_affinity, v->cpu_affinity, c->cpu_valid);=0A+ = cpumask_and(&online_affinity, v->cpu_affinity, &c->cpu_valid);=0A = if ( cpus_empty(online_affinity) &&=0A- cpu_isset(cpu, = v->cpu_affinity) )=0A+ cpumask_test_cpu(cpu, v->cpu_affinit= y) )=0A {=0A printk("Breaking vcpu affinity = for domain %d vcpu %d\n",=0A v->domain->domain_id, = v->vcpu_id);=0A- cpus_setall(v->cpu_affinity);=0A+ = cpumask_setall(v->cpu_affinity);=0A affinity_broken = =3D 1;=0A }=0A =0A@@ -602,10 +602,10 @@ int vcpu_set_affinity(s= truct vcpu *v, cp=0A =0A vcpu_schedule_lock_irq(v);=0A =0A- = old_affinity =3D v->cpu_affinity;=0A- v->cpu_affinity =3D *affinity;=0A-= *affinity =3D old_affinity;=0A- if ( !cpu_isset(v->processor, = v->cpu_affinity) )=0A+ cpumask_copy(&old_affinity, v->cpu_affinity);=0A+= cpumask_copy(v->cpu_affinity, affinity);=0A+ cpumask_copy(affinity, = &old_affinity);=0A+ if ( !cpumask_test_cpu(v->processor, v->cpu_affinity= ) )=0A set_bit(_VPF_migrating, &v->pause_flags);=0A =0A = vcpu_schedule_unlock_irq(v);=0A--- a/xen/include/asm-x86/hvm/vmx/vmcs.h=0A+= ++ b/xen/include/asm-x86/hvm/vmx/vmcs.h=0A@@ -68,7 +68,7 @@ struct = vmx_domain {=0A };=0A u64 eptp;=0A } ept_control;=0A- = cpumask_t ept_synced;=0A+ cpumask_var_t ept_synced;=0A };=0A =0A = #define ept_get_wl(d) \=0A--- a/xen/include/xen/cpumask.h=0A+++ = b/xen/include/xen/cpumask.h=0A@@ -81,24 +81,26 @@=0A =0A typedef struct = cpumask{ DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;=0A =0A-#define = cpu_set(cpu, dst) __cpu_set((cpu), &(dst))=0A-static inline void __cpu_set(= int cpu, volatile cpumask_t *dstp)=0A+#define cpu_set(cpu, dst) cpumask_set= _cpu(cpu, &(dst))=0A+static inline void cpumask_set_cpu(int cpu, volatile = cpumask_t *dstp)=0A {=0A set_bit(cpu, dstp->bits);=0A }=0A = =0A-#define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst))=0A-static = inline void __cpu_clear(int cpu, volatile cpumask_t *dstp)=0A+#define = cpu_clear(cpu, dst) cpumask_clear_cpu(cpu, &(dst))=0A+static inline void = cpumask_clear_cpu(int cpu, volatile cpumask_t *dstp)=0A {=0A clear_bit(c= pu, dstp->bits);=0A }=0A =0A+#define cpumask_setall(dst) __cpus_setall(dst,= NR_CPUS)=0A #define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)=0A = static inline void __cpus_setall(cpumask_t *dstp, int nbits)=0A {=0A = bitmap_fill(dstp->bits, nbits);=0A }=0A =0A+#define cpumask_clear(dst) = __cpus_clear(dst, NR_CPUS)=0A #define cpus_clear(dst) __cpus_clear(&(dst), = NR_CPUS)=0A static inline void __cpus_clear(cpumask_t *dstp, int nbits)=0A = {=0A@@ -109,18 +111,21 @@ static inline void __cpus_clear(cpumask_=0A = #define cpumask_test_cpu(cpu, cpumask) test_bit(cpu, (cpumask)->bits)=0A = #define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits)=0A = =0A-#define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), = &(cpumask))=0A-static inline int __cpu_test_and_set(int cpu, cpumask_t = *addr)=0A+#define cpu_test_and_set(cpu, cpumask) \=0A+ cpumask_test_and_se= t_cpu(cpu, &(cpumask))=0A+static inline int cpumask_test_and_set_cpu(int = cpu, cpumask_t *addr)=0A {=0A return test_and_set_bit(cpu, addr->bits);= =0A }=0A =0A-#define cpu_test_and_clear(cpu, cpumask) __cpu_test_and_clear(= (cpu), &(cpumask))=0A-static inline int __cpu_test_and_clear(int cpu, = cpumask_t *addr)=0A+#define cpu_test_and_clear(cpu, cpumask) \=0A+ = cpumask_test_and_clear_cpu(cpu, &(cpumask))=0A+static inline int cpumask_te= st_and_clear_cpu(int cpu, cpumask_t *addr)=0A {=0A return test_and_cle= ar_bit(cpu, addr->bits);=0A }=0A =0A+#define cpumask_and(dst, src1, src2) = __cpus_and(dst, src1, src2, NR_CPUS)=0A #define cpus_and(dst, src1, src2) = __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)=0A static inline void = __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,=0A = const cpumask_t *src2p, int nbits)=0A@@ -128,6 +133,7 @@ static = inline void __cpus_and(cpumask_t =0A bitmap_and(dstp->bits, src1p->bits,= src2p->bits, nbits);=0A }=0A =0A+#define cpumask_or(dst, src1, src2) = __cpus_or(dst, src1, src2, NR_CPUS)=0A #define cpus_or(dst, src1, src2) = __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)=0A static inline void = __cpus_or(cpumask_t *dstp, const cpumask_t *src1p,=0A = const cpumask_t *src2p, int nbits)=0A@@ -135,6 +141,7 @@ static = inline void __cpus_or(cpumask_t *=0A bitmap_or(dstp->bits, src1p->bits, = src2p->bits, nbits);=0A }=0A =0A+#define cpumask_xor(dst, src1, src2) = __cpus_xor(dst, src1, src2, NR_CPUS)=0A #define cpus_xor(dst, src1, src2) = __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)=0A static inline void = __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,=0A = const cpumask_t *src2p, int nbits)=0A@@ -142,6 +149,7 @@ static = inline void __cpus_xor(cpumask_t =0A bitmap_xor(dstp->bits, src1p->bits,= src2p->bits, nbits);=0A }=0A =0A+#define cpumask_andnot(dst, src1, src2) = __cpus_andnot(dst, src1, src2, NR_CPUS)=0A #define cpus_andnot(dst, src1, = src2) \=0A __cpus_andnot(&(dst), &(src1), = &(src2), NR_CPUS)=0A static inline void __cpus_andnot(cpumask_t *dstp, = const cpumask_t *src1p,=0A@@ -150,6 +158,7 @@ static inline void __cpus_and= not(cpumask=0A bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, = nbits);=0A }=0A =0A+#define cpumask_complement(dst, src) __cpus_complement(= dst, src, NR_CPUS)=0A #define cpus_complement(dst, src) __cpus_complement(&= (dst), &(src), NR_CPUS)=0A static inline void __cpus_complement(cpumask_t = *dstp,=0A const cpumask_t *srcp, int = nbits)=0A@@ -186,6 +195,7 @@ static inline int __cpus_empty(const cpu=0A = return bitmap_empty(srcp->bits, nbits);=0A }=0A =0A+#define cpumask_full(cp= umask) __cpus_full(cpumask, NR_CPUS)=0A #define cpus_full(cpumask) = __cpus_full(&(cpumask), NR_CPUS)=0A static inline int __cpus_full(const = cpumask_t *srcp, int nbits)=0A {=0A@@ -199,8 +209,8 @@ static inline int = __cpus_weight(const cp=0A return bitmap_weight(srcp->bits, nbits);=0A= }=0A =0A-#define cpus_copy(dest, src) __cpus_copy(&(dest), &(src))=0A-stat= ic inline void __cpus_copy(cpumask_t *dstp, const cpumask_t *srcp)=0A+#defi= ne cpus_copy(dest, src) cpumask_copy(&(dest), &(src))=0A+static inline = void cpumask_copy(cpumask_t *dstp, const cpumask_t *srcp)=0A {=0A = bitmap_copy(dstp->bits, srcp->bits, NR_CPUS);=0A }=0A@@ -322,6 +332,57 @@ = static inline int __cpulist_scnprintf(ch=0A return bitmap_scnlistprintf= (buf, len, srcp->bits, nbits);=0A }=0A =0A+/*=0A+ * cpumask_var_t: struct = cpumask for stack usage.=0A+ *=0A+ * Oh, the wicked games we play! In = order to make kernel coding a=0A+ * little more difficult, we typedef = cpumask_var_t to an array or a=0A+ * pointer: doing &mask on an array is a = noop, so it still works.=0A+ *=0A+ * ie.=0A+ * cpumask_var_t tmpmask;=0A+ = * if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL))=0A+ * = return -ENOMEM;=0A+ *=0A+ * ... use 'tmpmask' like a normal struct = cpumask * ...=0A+ *=0A+ * free_cpumask_var(tmpmask);=0A+ */=0A+#if = NR_CPUS > 2 * BITS_PER_LONG=0A+#include =0A+=0A+typedef = cpumask_t *cpumask_var_t;=0A+=0A+static inline bool_t alloc_cpumask_var(cpu= mask_var_t *mask)=0A+{=0A+ return (*mask =3D xmalloc(cpumask_t)) !=3D = NULL;=0A+}=0A+=0A+static inline void free_cpumask_var(cpumask_var_t = mask)=0A+{=0A+ xfree(mask);=0A+}=0A+#else=0A+typedef cpumask_t cpumask_var= _t[1];=0A+=0A+static inline bool_t alloc_cpumask_var(cpumask_var_t = *mask)=0A+{=0A+ return 1;=0A+}=0A+=0A+static inline void free_cpumask_var(c= pumask_var_t mask)=0A+{=0A+}=0A+#endif=0A+=0A+static inline bool_t = zalloc_cpumask_var(cpumask_var_t *mask)=0A+{=0A+ if (!alloc_cpumask_= var(mask))=0A+ return 0;=0A+ cpumask_clear(*mask);=0A+ = return 1;=0A+}=0A+=0A #if NR_CPUS > 1=0A #define for_each_cpu_mask(cpu, = mask) \=0A for ((cpu) =3D first_cpu(mask); \=0A--- = a/xen/include/xen/sched.h=0A+++ b/xen/include/xen/sched.h=0A@@ -161,12 = +161,12 @@ struct vcpu =0A spinlock_t virq_lock;=0A =0A /* = Bitmask of CPUs on which this VCPU may run. */=0A- cpumask_t = cpu_affinity;=0A+ cpumask_var_t cpu_affinity;=0A /* Used to = change affinity temporarily. */=0A- cpumask_t cpu_affinity_tmp;= =0A+ cpumask_var_t cpu_affinity_tmp;=0A =0A /* Bitmask of CPUs = which are holding onto this VCPU's state. */=0A- cpumask_t = vcpu_dirty_cpumask;=0A+ cpumask_var_t vcpu_dirty_cpumask;=0A =0A = /* Tasklet for continue_hypercall_on_cpu(). */=0A struct tasklet = continue_hypercall_tasklet;=0A@@ -289,7 +289,7 @@ struct domain=0A = struct vcpu **vcpu;=0A =0A /* Bitmask of CPUs which are holding = onto this domain's state. */=0A- cpumask_t domain_dirty_cpumask;= =0A+ cpumask_var_t domain_dirty_cpumask;=0A =0A struct arch_domai= n arch;=0A =0A@@ -641,7 +641,7 @@ void watchdog_domain_destroy(struct = doma=0A #define is_hvm_domain(d) ((d)->is_hvm)=0A #define is_hvm_vcpu(v) = (is_hvm_domain(v->domain))=0A #define is_pinned_vcpu(v) ((v)->domain->is_pi= nned || \=0A- cpus_weight((v)->cpu_affinity) = =3D=3D 1)=0A+ cpumask_weight((v)->cpu_affinity) = =3D=3D 1)=0A #define need_iommu(d) ((d)->need_iommu)=0A =0A void = set_vcpu_migration_delay(unsigned int delay);=0A --=__PartD5F90FBA.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__PartD5F90FBA.0__=--