eliminate cpumask accessors referencing NR_CPUS
PATCH 2/12 eliminate cpumask accessors referencing NR_CPUS
... in favor of using the new, nr_cpumask_bits-based ones.
Signed-off-by Jan Beulich <[email protected]>
xen/arch/ia64/linux-xen/acpi.c +4 -4
@@ -957,14 +957,14 @@ int acpi_map_lsapic(acpi_handle handle, buffer.length =ACPI_ALLOCATE_BUFFER ; buffer.pointer =NULL ; -cpus_complement (tmp_map, cpu_present_map); - cpu =first_cpu (tmp_map); -if (cpu >=NR_CPUS ) +cpumask_complement (&tmp_map, &cpu_present_map); + cpu =cpumask_first (&tmp_map); +if (cpu >= nr_cpu_ids)return -EINVAL ;acpi_map_cpu2node (handle, cpu, physid); -cpu_set (cpu, cpu_present_map); +cpumask_set_cpu (cpu, &cpu_present_map); ia64_cpu_to_sapicid[cpu] = physid; *pcpu = cpu;
xen/arch/ia64/linux-xen/numa.c +2 -2
@@ -51,7 +51,7 @@ void __init build_cpu_to_node_map(void)int cpu, i, node;for (node=0 ; node <MAX_NUMNODES ; node++) -cpus_clear (node_to_cpu_mask[node]); +cpumask_clear (&node_to_cpu_mask[node]);for (cpu =0 ; cpu <NR_CPUS ; ++cpu) { node =-1 ;
@@ -62,6 +62,6 @@ void __init build_cpu_to_node_map(void) } cpu_to_node_map[cpu] = (node >=0 ) ? node :0 ;if (node >=0 ) -cpu_set (cpu, node_to_cpu_mask[node]); +cpumask_set_cpu (cpu, &node_to_cpu_mask[node]); } }
xen/arch/ia64/linux-xen/smpboot.c +15 -15
@@ -594,15 +594,15 @@ smp_build_cpu_map (void) } ia64_cpu_to_sapicid[0 ] = boot_cpu_id; -cpus_clear (cpu_present_map); -cpu_set (0 , cpu_present_map); -cpu_set (0 , cpu_possible_map); +cpumask_clear (&cpu_present_map); +cpumask_set_cpu (0 , &cpu_present_map); +cpumask_set_cpu (0 , &cpu_possible_map);for (cpu =1 , i =0 ; i < smp_boot_data.cpu_count; i++) { sapicid = smp_boot_data.cpu_phys_id[i];if (sapicid == boot_cpu_id)continue ; -cpu_set (cpu, cpu_present_map); -cpu_set (cpu, cpu_possible_map); +cpumask_set_cpu (cpu, &cpu_present_map); +cpumask_set_cpu (cpu, &cpu_possible_map); ia64_cpu_to_sapicid[cpu] = sapicid; cpu++; }
@@ -640,12 +640,12 @@ smp_prepare_cpus (unsigned int max_cpus)*/ if (!max_cpus) {printk (KERN_INFO "SMP mode deactivated.\n" ); -cpus_clear (cpu_online_map); -cpus_clear (cpu_present_map); -cpus_clear (cpu_possible_map); -cpu_set (0 , cpu_online_map); -cpu_set (0 , cpu_present_map); -cpu_set (0 , cpu_possible_map); +cpumask_clear (&cpu_online_map); +cpumask_clear (&cpu_present_map); +cpumask_clear (&cpu_possible_map); +cpumask_set_cpu (0 , &cpu_online_map); +cpumask_set_cpu (0 , &cpu_present_map); +cpumask_set_cpu (0 , &cpu_possible_map);return ; } }
@@ -688,12 +688,12 @@ clear_cpu_sibling_map(int cpu)int i;for_each_cpu_mask (i,per_cpu (cpu_sibling_map, cpu)) -cpu_clear (cpu,per_cpu (cpu_sibling_map, i)); +cpumask_clear_cpu (cpu, &per_cpu (cpu_sibling_map, i));for_each_cpu_mask (i,per_cpu (cpu_core_map, cpu)) -cpu_clear (cpu,per_cpu (cpu_core_map, i)); +cpumask_clear_cpu (cpu, &per_cpu (cpu_core_map, i)); -cpus_clear (per_cpu (cpu_sibling_map, cpu)); -cpus_clear (per_cpu (cpu_core_map, cpu)); +cpumask_clear (&per_cpu (cpu_sibling_map, cpu)); +cpumask_clear (&per_cpu (cpu_core_map, cpu)); } static void
xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c +1 -1
@@ -206,7 +206,7 @@ sn2_global_tlb_purge(unsigned long startstatic DEFINE_SPINLOCK (sn2_ptcg_lock2);nodes_clear (nodes_flushed); -cpus_clear (selected_cpus); +cpumask_clear (&selected_cpus);spin_lock (&sn2_ptcg_lock2);node_set (cpu_to_node (smp_processor_id ()), nodes_flushed);
xen/arch/ia64/xen/fw_emul.c +4 -4
@@ -866,10 +866,10 @@ xen_pal_emulator(unsigned long index, u6 "status %lx", status);if (in1 ==PAL_CACHE_TYPE_COHERENT ) { -cpus_setall (current->arch.cache_coherent_map); -cpu_clear (processor, current->arch.cache_coherent_map); -cpus_setall (cpu_cache_coherent_map); -cpu_clear (processor, cpu_cache_coherent_map); +cpumask_complement (¤t->arch.cache_coherent_map, +cpumask_of (processor)); +cpumask_complement (&cpu_cache_coherent_map, +cpumask_of (processor)); }break ;case PAL_PERF_MON_INFO :
xen/arch/ia64/xen/tlb_track.c +1 -1
@@ -374,7 +374,7 @@ tlb_track_insert_or_dirty(struct tlb_tra entry->pte_val = old_pte; entry->vaddr = vaddr; entry->rid = rid; -cpus_clear (entry->pcpu_dirty_mask); +cpumask_clear (&entry->pcpu_dirty_mask);vcpus_clear (entry->vcpu_dirty_mask);list_add (&entry->list, head);
xen/arch/ia64/xen/xensetup.c +1 -1
@@ -592,7 +592,7 @@ skip_move:smp_prepare_cpus (max_cpus);/* We aren't hotplug-capable yet. */ -cpus_or (cpu_present_map, cpu_present_map, cpu_possible_map); +cpumask_or (&cpu_present_map, &cpu_present_map, &cpu_possible_map);/* Enable IRQ to receive IPI (needed for ITC sync). */ local_irq_enable ();
xen/arch/x86/acpi/cpu_idle.c +2 -2
@@ -233,13 +233,13 @@ void cpuidle_wakeup_mwait(cpumask_t *mascpumask_t target;unsigned int cpu; -cpus_and (target, *mask, cpuidle_mwait_flags); +cpumask_and (&target, mask, &cpuidle_mwait_flags);/* CPU is MWAITing on the cpuidle_mwait_wakeup flag. */ for_each_cpu_mask (cpu, target)mwait_wakeup (cpu) =0 ; -cpus_andnot (*mask, *mask, target); +cpumask_andnot (mask, mask, &target); }static void mwait_idle_with_hints (unsigned long eax,unsigned long ecx)
xen/arch/x86/acpi/cpufreq/cpufreq.c +1 -1
@@ -446,7 +446,7 @@ static int acpi_cpufreq_target(struct cpif (unlikely (result))return -ENODEV ; -cpus_and (online_policy_cpus, cpu_online_map, policy->cpus); +cpumask_and (&online_policy_cpus, &cpu_online_map, &policy->cpus); next_perf_state = data->freq_table[next_state].index;if (perf->state == next_perf_state) {
xen/arch/x86/cpu/mcheck/mce.c +6 -7
@@ -1537,20 +1537,19 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) ureturn x86_mcerr ("do_mca #MC" , -ENODEV );if ( op->u.mc_inject_v2.flags &XEN_MC_INJECT_CPU_BROADCAST ) -cpus_copy (cpumap, cpu_online_map); +cpumask_copy (&cpumap, &cpu_online_map);else {int gcw; -cpus_clear (cpumap);xenctl_cpumap_to_cpumask (&cpumap, &op->u.mc_inject_v2.cpumap); - gcw =cpus_weight (cpumap); -cpus_and (cpumap, cpu_online_map, cpumap); + gcw =cpumask_weight (&cpumap); +cpumask_and (&cpumap, &cpu_online_map, &cpumap); -if (cpus_empty (cpumap) ) +if (cpumask_empty (&cpumap) )return x86_mcerr ("No online CPU passed\n" , -EINVAL ); -else if ( gcw !=cpus_weight (cpumap) ) +else if ( gcw !=cpumask_weight (&cpumap) )dprintk (XENLOG_INFO ,"Not all required CPUs are online\n" ); }
@@ -1559,7 +1558,7 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u {case XEN_MC_INJECT_TYPE_MCE :if ( mce_broadcast && - !cpus_equal (cpumap, cpu_online_map) ) + !cpumask_equal (&cpumap, &cpu_online_map) )printk ("Not trigger MCE on all CPUs, may HANG!\n" );on_selected_cpus (&cpumap, x86_mc_mceinject,NULL ,1 );break ;
xen/arch/x86/hpet.c +3 -3
@@ -178,7 +178,7 @@ again:spin_unlock_irq (&ch->lock); next_event =STIME_MAX ; - mask = (cpumask_t )CPU_MASK_NONE ; +cpumask_clear (&mask); now =NOW ();/* find all expired events */
@@ -189,11 +189,11 @@ again:rmb (); deadline =per_cpu (timer_deadline, cpu);rmb (); -if ( !cpu_isset (cpu, ch->cpumask) ) +if ( !cpumask_test_cpu (cpu, &ch->cpumask) )continue ;if ( deadline <= now ) -cpu_set (cpu, mask); +cpumask_set_cpu (cpu, &mask);else if ( deadline < next_event ) next_event = deadline; }
xen/arch/x86/hvm/nestedhvm.c +1 -1
@@ -116,7 +116,7 @@ nestedhvm_vmcx_flushtlb(struct p2m_domai {on_selected_cpus (&p2m->p2m_dirty_cpumask, nestedhvm_flushtlb_ipi, p2m->domain,1 ); -cpus_clear (p2m->p2m_dirty_cpumask); +cpumask_clear (&p2m->p2m_dirty_cpumask); } bool_t
xen/arch/x86/io_apic.c +2 -1
@@ -1850,7 +1850,7 @@ static void __init check_timer(void)int apic1, pin1, apic2, pin2;int vector, ret;unsigned long flags; -cpumask_t mask_all =CPU_MASK_ALL ; +cpumask_t mask_all;local_irq_save (flags);
@@ -1861,6 +1861,7 @@ static void __init check_timer(void) vector =FIRST_HIPRIORITY_VECTOR ;clear_irq_vector (0 ); +cpumask_setall (&mask_all);if ((ret =bind_irq_vector (0 , vector, &mask_all)))printk (KERN_ERR "..IRQ0 is not set correctly with ioapic!!!, err:%d\n" , ret);
xen/arch/x86/irq.c +28 -29
186 lines not on this page · raw message
xen/arch/x86/mm.c +10 -7
@@ -1339,8 +1339,10 @@ static void pae_flush_pgd(if (unlikely (shadow_mode_enabled (d)) ) { -cpumask_t m =CPU_MASK_NONE ; +cpumask_t m; +/* Re-shadow this l3 table on any vcpus that are using it */ +cpumask_clear (&m); for_each_vcpu ( d, v )if (pagetable_get_pfn (v->arch.guest_table) == mfn ) {
@@ -2887,7 +2889,7 @@ static inline int vcpumask_to_pcpumask(struct vcpu *v;bool_t is_native = !is_pv_32on64_domain (d); -cpus_clear (*pmask); +cpumask_clear (pmask);for ( vmask =0 , offs =0 ; ; ++offs) { vcpu_bias = offs * (is_native ?BITS_PER_LONG :32 );
@@ -2899,7 +2901,7 @@ static inline int vcpumask_to_pcpumask( copy_from_guest_offset((unsigned int *)&vmask, bmap, offs, 1)) ) { -cpus_clear (*pmask); +cpumask_clear (pmask);return -EFAULT ; }
@@ -3194,12 +3196,13 @@ int do_mmuext_op(else if (likely (cache_flush_permitted (d)) ) {unsigned int cpu; -cpumask_t mask =CPU_MASK_NONE ; +cpumask_t mask; +cpumask_clear (&mask);for_each_online_cpu (cpu) -if ( !cpus_intersects (mask, -per_cpu (cpu_sibling_map, cpu)) ) -cpu_set (cpu, mask); +if ( !cpumask_intersects (&mask, + &per_cpu (cpu_sibling_map, cpu)) ) +cpumask_set_cpu (cpu, &mask);flush_mask (&mask,FLUSH_CACHE ); }else
xen/arch/x86/mm/p2m.c +1 -1
@@ -81,7 +81,7 @@ static void p2m_initialise(struct domain p2m->default_access = p2m_access_rwx; p2m->cr3 =CR3_EADDR ; -cpus_clear (p2m->p2m_dirty_cpumask); +cpumask_clear (&p2m->p2m_dirty_cpumask);if (hap_enabled (d) && (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL ) )ept_p2m_init (p2m);
xen/arch/x86/mm/shadow/common.c +1 -1
@@ -3459,7 +3459,7 @@ static void sh_unshadow_for_p2m_change(sp2m_type_t p2mt =p2m_flags_to_type (l1e_get_flags (*p));if (p2m_is_valid (p2mt) &&mfn_valid (omfn) ) { -cpus_clear (flushmask); +cpumask_clear (&flushmask);/* If we're replacing a superpage with a normal L1 page, map it */ if ( (l1e_get_flags(new) & _PAGE_PRESENT)
xen/arch/x86/smp.c +3 -3
@@ -240,12 +240,12 @@ void flush_area_mask(const cpumask_t *maif ( !cpus_subset (*mask, *cpumask_of (smp_processor_id ())) ) {spin_lock (&flush_lock); -cpus_and (flush_cpumask, *mask, cpu_online_map); -cpu_clear (smp_processor_id (), flush_cpumask); +cpumask_and (&flush_cpumask, mask, &cpu_online_map); +cpumask_clear_cpu (smp_processor_id (), &flush_cpumask); flush_va = va; flush_flags = flags;send_IPI_mask (&flush_cpumask,INVALIDATE_TLB_VECTOR ); -while ( !cpus_empty (flush_cpumask) ) +while ( !cpumask_empty (&flush_cpumask) )cpu_relax ();spin_unlock (&flush_lock); }
xen/arch/x86/smpboot.c +8 -7
@@ -533,8 +533,9 @@ int alloc_cpu_id(void) {cpumask_t tmp_map;int cpu; -cpus_complement (tmp_map, cpu_present_map); - cpu =first_cpu (tmp_map); + +cpumask_complement (&tmp_map, &cpu_present_map); + cpu =cpumask_first (&tmp_map);return (cpu < nr_cpu_ids) ? cpu : -ENODEV ; }
@@ -818,18 +819,18 @@ remove_siblinginfo(int cpu) {cpu_clear (cpu,per_cpu (cpu_core_map, sibling));/* Last thread sibling in this cpu core going down. */ -if (cpus_weight (per_cpu (cpu_sibling_map, cpu)) ==1 ) +if (cpumask_weight (&per_cpu (cpu_sibling_map, cpu)) ==1 ) c[sibling].booted_cores--; }for_each_cpu_mask (sibling,per_cpu (cpu_sibling_map, cpu)) -cpu_clear (cpu,per_cpu (cpu_sibling_map, sibling)); -cpus_clear (per_cpu (cpu_sibling_map, cpu)); -cpus_clear (per_cpu (cpu_core_map, cpu)); +cpumask_clear_cpu (cpu, &per_cpu (cpu_sibling_map, sibling)); +cpumask_clear (&per_cpu (cpu_sibling_map, cpu)); +cpumask_clear (&per_cpu (cpu_core_map, cpu)); c[cpu].phys_proc_id =BAD_APICID ; c[cpu].cpu_core_id =BAD_APICID ; c[cpu].compute_unit_id =BAD_APICID ; -cpu_clear (cpu, cpu_sibling_setup_map); +cpumask_clear_cpu (cpu, &cpu_sibling_setup_map); }void __cpu_disable (void )
xen/arch/x86/time.c +5 -5
@@ -185,15 +185,15 @@ static void smp_send_timer_broadcast_ipiint cpu =smp_processor_id ();cpumask_t mask; -cpus_and (mask, cpu_online_map, pit_broadcast_mask); +cpumask_and (&mask, &cpu_online_map, &pit_broadcast_mask); -if (cpu_isset (cpu, mask) ) +if (cpumask_test_cpu (cpu, &mask) ) { -cpu_clear (cpu, mask); +cpumask_clear_cpu (cpu, &mask);raise_softirq (TIMER_SOFTIRQ ); } -if ( !cpus_empty (mask) ) +if ( !cpumask_empty (&mask) ) {cpumask_raise_softirq (&mask,TIMER_SOFTIRQ ); }
@@ -1226,7 +1226,7 @@ void check_tsc_warp(unsigned long tsc_kh }static unsigned long tsc_max_warp, tsc_check_count; -static cpumask_t tsc_check_cpumask =CPU_MASK_NONE ; +static cpumask_t tsc_check_cpumask;static void tsc_check_slave (void *unused) {
xen/common/cpu.c +3 -3
@@ -176,7 +176,7 @@ int disable_nonboot_cpus(void)BUG_ON (smp_processor_id () !=0 ); -cpus_clear (frozen_cpus); +cpumask_clear (&frozen_cpus);printk ("Disabling non-boot CPUs ...\n" );
@@ -192,7 +192,7 @@ int disable_nonboot_cpus(void)break ; } -cpu_set (cpu, frozen_cpus); +cpumask_set_cpu (cpu, &frozen_cpus); }BUG_ON (!error && (num_online_cpus () !=1 ));
@@ -214,5 +214,5 @@ void enable_nonboot_cpus(void) } } -cpus_clear (frozen_cpus); +cpumask_clear (&frozen_cpus); }
xen/common/cpupool.c +1 -1
@@ -29,7 +29,7 @@ static struct cpupool *cpupool_list;static int cpupool_moving_cpu =-1 ;static struct cpupool *cpupool_cpu_moving =NULL ; -static cpumask_t cpupool_locked_cpus =CPU_MASK_NONE ; +static cpumask_t cpupool_locked_cpus;static DEFINE_SPINLOCK (cpupool_lock);
xen/common/domain.c +2 -1
@@ -359,11 +359,12 @@ struct domain *domain_create(void domain_update_node_affinity (struct domain *d) { -cpumask_t cpumask =CPU_MASK_NONE ; +cpumask_t cpumask;nodemask_t nodemask =NODE_MASK_NONE ;struct vcpu *v;unsigned int node; +cpumask_clear (&cpumask);spin_lock (&d->node_affinity_lock);for_each_vcpu ( d, v )
xen/common/domctl.c +14 -13
@@ -37,9 +37,9 @@ int cpumask_to_xenctl_cpumap(uint8_t bytemap[(NR_CPUS +7 ) /8 ]; guest_bytes = (xenctl_cpumap->nr_cpus +7 ) /8 ; - copy_bytes = min_t(unsigned int, guest_bytes, sizeof(bytemap)); + copy_bytes = min_t(unsigned int, guest_bytes, (nr_cpu_ids + 7) / 8); -bitmap_long_to_byte (bytemap,cpus_addr (*cpumask),NR_CPUS ); +bitmap_long_to_byte (bytemap,cpumask_bits (cpumask), nr_cpu_ids);if ( copy_bytes !=0 )if (copy_to_guest (xenctl_cpumap->bitmap, bytemap, copy_bytes) )
@@ -59,7 +59,7 @@ int xenctl_cpumap_to_cpumask(uint8_t bytemap[(NR_CPUS +7 ) /8 ]; guest_bytes = (xenctl_cpumap->nr_cpus +7 ) /8 ; - copy_bytes = min_t(unsigned int, guest_bytes, sizeof(bytemap)); + copy_bytes = min_t(unsigned int, guest_bytes, (nr_cpu_ids + 7) / 8);memset (bytemap,0 ,sizeof (bytemap));
@@ -71,7 +71,7 @@ int xenctl_cpumap_to_cpumask( bytemap[guest_bytes-1 ] &= ~(0xff << (xenctl_cpumap->nr_cpus &7 )); } -bitmap_byte_to_long (cpus_addr (*cpumask), bytemap,NR_CPUS ); +bitmap_byte_to_long (cpumask_bits (cpumask), bytemap, nr_cpu_ids);return 0 ; }
@@ -154,7 +154,7 @@ static unsigned int default_vcpu0_locaticpumask_t cpu_exclude_map;/* Do an initial CPU placement. Pick the least-populated CPU. */ - nr_cpus =last_cpu (cpu_online_map) +1 ; + nr_cpus =cpumask_last (&cpu_online_map) +1 ; cnt = xzalloc_array(unsigned int, nr_cpus);if ( cnt ) {
@@ -171,18 +171,19 @@ static unsigned int default_vcpu0_locati* If we're on a HT system, we only auto-allocate to a non-primary HT. We * favour high numbered CPUs in the event of a tie. */ - cpu =first_cpu (per_cpu (cpu_sibling_map,0 )); -if (cpus_weight (per_cpu (cpu_sibling_map,0 )) >1 ) - cpu =next_cpu (cpu,per_cpu (cpu_sibling_map,0 )); - cpu_exclude_map =per_cpu (cpu_sibling_map,0 ); +cpumask_copy (&cpu_exclude_map, &per_cpu (cpu_sibling_map,0 )); + cpu =cpumask_first (&cpu_exclude_map); +if (cpumask_weight (&cpu_exclude_map) >1 ) + cpu =cpumask_next (cpu, &cpu_exclude_map);for_each_cpu_mask (i, *online) { -if (cpu_isset (i, cpu_exclude_map) ) +if (cpumask_test_cpu (i, &cpu_exclude_map) )continue ; -if ( (i ==first_cpu (per_cpu (cpu_sibling_map, i))) && - (cpus_weight (per_cpu (cpu_sibling_map, i)) >1 ) ) +if ( (i ==cpumask_first (&per_cpu (cpu_sibling_map, i))) && + (cpumask_weight (&per_cpu (cpu_sibling_map, i)) >1 ) )continue ; -cpus_or (cpu_exclude_map, cpu_exclude_map,per_cpu (cpu_sibling_map, i)); +cpumask_or (&cpu_exclude_map, &cpu_exclude_map, + &per_cpu (cpu_sibling_map, i));if ( !cnt || cnt[i] <= cnt[cpu] ) cpu = i; }
xen/common/keyhandler.c +1 -1
@@ -316,7 +316,7 @@ static struct keyhandler dump_domains_ke .desc = "dump domain (and guest debug) info" }; -static cpumask_t read_clocks_cpumask =CPU_MASK_NONE ; +static cpumask_t read_clocks_cpumask; static DEFINE_PER_CPU(s_time_t, read_clocks_time); static DEFINE_PER_CPU(u64, read_cycles_time);
xen/common/page_alloc.c +7 -5
@@ -304,7 +304,7 @@ static struct page_info *alloc_heap_pageunsigned int first_node, i, j, zone =0 , nodemask_retry =0 ;unsigned int node = (uint8_t )((memflags >> _MEMF_node) -1 );unsigned long request =1UL << order; -cpumask_t extra_cpus_mask, mask; +cpumask_t mask;struct page_info *pg;nodemask_t nodemask = (d !=NULL ) ? d->node_affinity : node_online_map;
@@ -418,7 +418,7 @@ static struct page_info *alloc_heap_pageif ( d !=NULL ) d->last_alloc_node = node; -cpus_clear (mask); +cpumask_clear (&mask);for ( i =0 ; i < (1 << order); i++ ) {
@@ -429,9 +429,11 @@ static struct page_info *alloc_heap_pageif ( pg[i].u.free.need_tlbflush ) {/* Add in extra CPUs that need flushing because of this page. */ -cpus_andnot (extra_cpus_mask, cpu_online_map, mask); +static cpumask_t extra_cpus_mask; + +cpumask_andnot (&extra_cpus_mask, &cpu_online_map, &mask);tlbflush_filter (extra_cpus_mask, pg[i].tlbflush_timestamp); -cpus_or (mask, mask, extra_cpus_mask); +cpumask_or (&mask, &mask, &extra_cpus_mask); }/* Initialise fields which have other uses for free pages. */
@@ -441,7 +443,7 @@ static struct page_info *alloc_heap_pagespin_unlock (&heap_lock); -if (unlikely (!cpus_empty (mask)) ) +if (unlikely (!cpumask_empty (&mask)) ) {perfc_incr (need_flush_tlb_flush);flush_tlb_mask (&mask);
xen/common/rcupdate.c +0 -1
@@ -59,7 +59,6 @@ static struct rcu_ctrlblk { .cur = -300, .completed = -300, .lock = SPIN_LOCK_UNLOCKED, - .cpumask = CPU_MASK_NONE, };/*
xen/common/sched_credit.c +36 -36
173 lines not on this page · raw message
xen/common/sched_credit2.c +6 -6
@@ -507,19 +507,19 @@ runq_tickle(const struct scheduler *ops, }/* Get a mask of idle, but not tickled */ -cpus_andnot (mask, rqd->idle, rqd->tickled); +cpumask_andnot (&mask, &rqd->idle, &rqd->tickled);/* If it's not empty, choose one */ -if ( !cpus_empty (mask) ) +if ( !cpumask_empty (&mask) ) { - ipid=first_cpu (mask); + ipid =cpumask_first (&mask); goto tickle; }/* Otherwise, look for the non-idle cpu with the lowest credit, * skipping cpus which have been tickled but not scheduled yet */ -cpus_andnot (mask, rqd->active, rqd->idle); -cpus_andnot (mask, mask, rqd->tickled); +cpumask_andnot (&mask, &rqd->active, &rqd->idle); +cpumask_andnot (&mask, &mask, &rqd->tickled);for_each_cpu_mask (i, mask) {
@@ -573,7 +573,7 @@ tickle:sizeof (d), (unsigned char *)&d); } -cpu_set (ipid, rqd->tickled); +cpumask_set_cpu (ipid, &rqd->tickled);cpu_raise_softirq (ipid,SCHEDULE_SOFTIRQ ); no_tickle:
xen/common/schedule.c +2 -2
@@ -595,8 +595,8 @@ int vcpu_set_affinity(struct vcpu *v, coif ( v->domain->is_pinned )return -EINVAL ; online =VCPU2ONLINE (v); -cpus_and (online_affinity, *affinity, *online); -if (cpus_empty (online_affinity) ) +cpumask_and (&online_affinity, affinity, online); +if (cpumask_empty (&online_affinity) )return -EINVAL ;vcpu_schedule_lock_irq (v);
xen/common/softirq.c +3 -2
@@ -71,11 +71,12 @@ void open_softirq(int nr, softirq_handlevoid cpumask_raise_softirq (const cpumask_t *mask,unsigned int nr) {int cpu; -cpumask_t send_mask =CPU_MASK_NONE ; +cpumask_t send_mask; +cpumask_clear (&send_mask);for_each_cpu_mask (cpu, *mask)if ( !test_and_set_bit (nr, &softirq_pending (cpu)) ) -cpu_set (cpu, send_mask); +cpumask_set_cpu (cpu, &send_mask);smp_send_event_check_mask (&send_mask); }
xen/common/trace.c +2 -1
@@ -70,7 +70,7 @@ static DEFINE_PER_CPU(unsigned long, losint tb_init_done__read_mostly ;/* which CPUs tracing is enabled on */ -static cpumask_t tb_cpu_mask =CPU_MASK_ALL ; +static cpumask_t tb_cpu_mask;/* which tracing events are enabled */ static u32 tb_event_mask =TRC_ALL ;
@@ -338,6 +338,7 @@ int trace_will_trace_event(u32 event)*/ void __init init_trace_bufs (void ) { +cpumask_setall (&tb_cpu_mask);register_cpu_notifier (&cpu_nfb);if ( opt_tbuf_size )
xen/include/xen/cpumask.h +45 -74
193 lines not on this page · raw message
eliminate cpumask accessors referencing NR_CPUS
... in favor of using the new, nr_cpumask_bits-based ones.
Signed-off-by Jan Beulich <[email protected]>
xen/arch/ia64/linux-xen/acpi.c +4 -4
@@ -957,14 +957,14 @@ int acpi_map_lsapic(acpi_handle handle, buffer.length =ACPI_ALLOCATE_BUFFER ; buffer.pointer =NULL ; -cpus_complement (tmp_map, cpu_present_map); - cpu =first_cpu (tmp_map); -if (cpu >=NR_CPUS ) +cpumask_complement (&tmp_map, &cpu_present_map); + cpu =cpumask_first (&tmp_map); +if (cpu >= nr_cpu_ids)return -EINVAL ;acpi_map_cpu2node (handle, cpu, physid); -cpu_set (cpu, cpu_present_map); +cpumask_set_cpu (cpu, &cpu_present_map); ia64_cpu_to_sapicid[cpu] = physid; *pcpu = cpu;
xen/arch/ia64/linux-xen/numa.c +2 -2
@@ -51,7 +51,7 @@ void __init build_cpu_to_node_map(void)int cpu, i, node;for (node=0 ; node <MAX_NUMNODES ; node++) -cpus_clear (node_to_cpu_mask[node]); +cpumask_clear (&node_to_cpu_mask[node]);for (cpu =0 ; cpu <NR_CPUS ; ++cpu) { node =-1 ;
@@ -62,6 +62,6 @@ void __init build_cpu_to_node_map(void) } cpu_to_node_map[cpu] = (node >=0 ) ? node :0 ;if (node >=0 ) -cpu_set (cpu, node_to_cpu_mask[node]); +cpumask_set_cpu (cpu, &node_to_cpu_mask[node]); } }
xen/arch/ia64/linux-xen/smpboot.c +15 -15
@@ -594,15 +594,15 @@ smp_build_cpu_map (void) } ia64_cpu_to_sapicid[0 ] = boot_cpu_id; -cpus_clear (cpu_present_map); -cpu_set (0 , cpu_present_map); -cpu_set (0 , cpu_possible_map); +cpumask_clear (&cpu_present_map); +cpumask_set_cpu (0 , &cpu_present_map); +cpumask_set_cpu (0 , &cpu_possible_map);for (cpu =1 , i =0 ; i < smp_boot_data.cpu_count; i++) { sapicid = smp_boot_data.cpu_phys_id[i];if (sapicid == boot_cpu_id)continue ; -cpu_set (cpu, cpu_present_map); -cpu_set (cpu, cpu_possible_map); +cpumask_set_cpu (cpu, &cpu_present_map); +cpumask_set_cpu (cpu, &cpu_possible_map); ia64_cpu_to_sapicid[cpu] = sapicid; cpu++; }
@@ -640,12 +640,12 @@ smp_prepare_cpus (unsigned int max_cpus)*/ if (!max_cpus) {printk (KERN_INFO "SMP mode deactivated.\n" ); -cpus_clear (cpu_online_map); -cpus_clear (cpu_present_map); -cpus_clear (cpu_possible_map); -cpu_set (0 , cpu_online_map); -cpu_set (0 , cpu_present_map); -cpu_set (0 , cpu_possible_map); +cpumask_clear (&cpu_online_map); +cpumask_clear (&cpu_present_map); +cpumask_clear (&cpu_possible_map); +cpumask_set_cpu (0 , &cpu_online_map); +cpumask_set_cpu (0 , &cpu_present_map); +cpumask_set_cpu (0 , &cpu_possible_map);return ; } }
@@ -688,12 +688,12 @@ clear_cpu_sibling_map(int cpu)int i;for_each_cpu_mask (i,per_cpu (cpu_sibling_map, cpu)) -cpu_clear (cpu,per_cpu (cpu_sibling_map, i)); +cpumask_clear_cpu (cpu, &per_cpu (cpu_sibling_map, i));for_each_cpu_mask (i,per_cpu (cpu_core_map, cpu)) -cpu_clear (cpu,per_cpu (cpu_core_map, i)); +cpumask_clear_cpu (cpu, &per_cpu (cpu_core_map, i)); -cpus_clear (per_cpu (cpu_sibling_map, cpu)); -cpus_clear (per_cpu (cpu_core_map, cpu)); +cpumask_clear (&per_cpu (cpu_sibling_map, cpu)); +cpumask_clear (&per_cpu (cpu_core_map, cpu)); } static void
xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c +1 -1
@@ -206,7 +206,7 @@ sn2_global_tlb_purge(unsigned long startstatic DEFINE_SPINLOCK (sn2_ptcg_lock2);nodes_clear (nodes_flushed); -cpus_clear (selected_cpus); +cpumask_clear (&selected_cpus);spin_lock (&sn2_ptcg_lock2);node_set (cpu_to_node (smp_processor_id ()), nodes_flushed);
xen/arch/ia64/xen/fw_emul.c +4 -4
@@ -866,10 +866,10 @@ xen_pal_emulator(unsigned long index, u6 "status %lx", status);if (in1 ==PAL_CACHE_TYPE_COHERENT ) { -cpus_setall (current->arch.cache_coherent_map); -cpu_clear (processor, current->arch.cache_coherent_map); -cpus_setall (cpu_cache_coherent_map); -cpu_clear (processor, cpu_cache_coherent_map); +cpumask_complement (¤t->arch.cache_coherent_map, +cpumask_of (processor)); +cpumask_complement (&cpu_cache_coherent_map, +cpumask_of (processor)); }break ;case PAL_PERF_MON_INFO :
xen/arch/ia64/xen/tlb_track.c +1 -1
@@ -374,7 +374,7 @@ tlb_track_insert_or_dirty(struct tlb_tra entry->pte_val = old_pte; entry->vaddr = vaddr; entry->rid = rid; -cpus_clear (entry->pcpu_dirty_mask); +cpumask_clear (&entry->pcpu_dirty_mask);vcpus_clear (entry->vcpu_dirty_mask);list_add (&entry->list, head);
xen/arch/ia64/xen/xensetup.c +1 -1
@@ -592,7 +592,7 @@ skip_move:smp_prepare_cpus (max_cpus);/* We aren't hotplug-capable yet. */ -cpus_or (cpu_present_map, cpu_present_map, cpu_possible_map); +cpumask_or (&cpu_present_map, &cpu_present_map, &cpu_possible_map);/* Enable IRQ to receive IPI (needed for ITC sync). */ local_irq_enable ();
xen/arch/x86/acpi/cpu_idle.c +2 -2
@@ -233,13 +233,13 @@ void cpuidle_wakeup_mwait(cpumask_t *mascpumask_t target;unsigned int cpu; -cpus_and (target, *mask, cpuidle_mwait_flags); +cpumask_and (&target, mask, &cpuidle_mwait_flags);/* CPU is MWAITing on the cpuidle_mwait_wakeup flag. */ for_each_cpu_mask (cpu, target)mwait_wakeup (cpu) =0 ; -cpus_andnot (*mask, *mask, target); +cpumask_andnot (mask, mask, &target); }static void mwait_idle_with_hints (unsigned long eax,unsigned long ecx)
xen/arch/x86/acpi/cpufreq/cpufreq.c +1 -1
@@ -446,7 +446,7 @@ static int acpi_cpufreq_target(struct cpif (unlikely (result))return -ENODEV ; -cpus_and (online_policy_cpus, cpu_online_map, policy->cpus); +cpumask_and (&online_policy_cpus, &cpu_online_map, &policy->cpus); next_perf_state = data->freq_table[next_state].index;if (perf->state == next_perf_state) {
xen/arch/x86/cpu/mcheck/mce.c +6 -7
@@ -1537,20 +1537,19 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) ureturn x86_mcerr ("do_mca #MC" , -ENODEV );if ( op->u.mc_inject_v2.flags &XEN_MC_INJECT_CPU_BROADCAST ) -cpus_copy (cpumap, cpu_online_map); +cpumask_copy (&cpumap, &cpu_online_map);else {int gcw; -cpus_clear (cpumap);xenctl_cpumap_to_cpumask (&cpumap, &op->u.mc_inject_v2.cpumap); - gcw =cpus_weight (cpumap); -cpus_and (cpumap, cpu_online_map, cpumap); + gcw =cpumask_weight (&cpumap); +cpumask_and (&cpumap, &cpu_online_map, &cpumap); -if (cpus_empty (cpumap) ) +if (cpumask_empty (&cpumap) )return x86_mcerr ("No online CPU passed\n" , -EINVAL ); -else if ( gcw !=cpus_weight (cpumap) ) +else if ( gcw !=cpumask_weight (&cpumap) )dprintk (XENLOG_INFO ,"Not all required CPUs are online\n" ); }
@@ -1559,7 +1558,7 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u {case XEN_MC_INJECT_TYPE_MCE :if ( mce_broadcast && - !cpus_equal (cpumap, cpu_online_map) ) + !cpumask_equal (&cpumap, &cpu_online_map) )printk ("Not trigger MCE on all CPUs, may HANG!\n" );on_selected_cpus (&cpumap, x86_mc_mceinject,NULL ,1 );break ;
xen/arch/x86/hpet.c +3 -3
@@ -178,7 +178,7 @@ again:spin_unlock_irq (&ch->lock); next_event =STIME_MAX ; - mask = (cpumask_t )CPU_MASK_NONE ; +cpumask_clear (&mask); now =NOW ();/* find all expired events */
@@ -189,11 +189,11 @@ again:rmb (); deadline =per_cpu (timer_deadline, cpu);rmb (); -if ( !cpu_isset (cpu, ch->cpumask) ) +if ( !cpumask_test_cpu (cpu, &ch->cpumask) )continue ;if ( deadline <= now ) -cpu_set (cpu, mask); +cpumask_set_cpu (cpu, &mask);else if ( deadline < next_event ) next_event = deadline; }
xen/arch/x86/hvm/nestedhvm.c +1 -1
@@ -116,7 +116,7 @@ nestedhvm_vmcx_flushtlb(struct p2m_domai {on_selected_cpus (&p2m->p2m_dirty_cpumask, nestedhvm_flushtlb_ipi, p2m->domain,1 ); -cpus_clear (p2m->p2m_dirty_cpumask); +cpumask_clear (&p2m->p2m_dirty_cpumask); } bool_t
xen/arch/x86/io_apic.c +2 -1
@@ -1850,7 +1850,7 @@ static void __init check_timer(void)int apic1, pin1, apic2, pin2;int vector, ret;unsigned long flags; -cpumask_t mask_all =CPU_MASK_ALL ; +cpumask_t mask_all;local_irq_save (flags);
@@ -1861,6 +1861,7 @@ static void __init check_timer(void) vector =FIRST_HIPRIORITY_VECTOR ;clear_irq_vector (0 ); +cpumask_setall (&mask_all);if ((ret =bind_irq_vector (0 , vector, &mask_all)))printk (KERN_ERR "..IRQ0 is not set correctly with ioapic!!!, err:%d\n" , ret);
xen/arch/x86/irq.c +28 -29
186 lines not on this page · raw message
xen/arch/x86/mm.c +10 -7
@@ -1339,8 +1339,10 @@ static void pae_flush_pgd(if (unlikely (shadow_mode_enabled (d)) ) { -cpumask_t m =CPU_MASK_NONE ; +cpumask_t m; +/* Re-shadow this l3 table on any vcpus that are using it */ +cpumask_clear (&m); for_each_vcpu ( d, v )if (pagetable_get_pfn (v->arch.guest_table) == mfn ) {
@@ -2887,7 +2889,7 @@ static inline int vcpumask_to_pcpumask(struct vcpu *v;bool_t is_native = !is_pv_32on64_domain (d); -cpus_clear (*pmask); +cpumask_clear (pmask);for ( vmask =0 , offs =0 ; ; ++offs) { vcpu_bias = offs * (is_native ?BITS_PER_LONG :32 );
@@ -2899,7 +2901,7 @@ static inline int vcpumask_to_pcpumask( copy_from_guest_offset((unsigned int *)&vmask, bmap, offs, 1)) ) { -cpus_clear (*pmask); +cpumask_clear (pmask);return -EFAULT ; }
@@ -3194,12 +3196,13 @@ int do_mmuext_op(else if (likely (cache_flush_permitted (d)) ) {unsigned int cpu; -cpumask_t mask =CPU_MASK_NONE ; +cpumask_t mask; +cpumask_clear (&mask);for_each_online_cpu (cpu) -if ( !cpus_intersects (mask, -per_cpu (cpu_sibling_map, cpu)) ) -cpu_set (cpu, mask); +if ( !cpumask_intersects (&mask, + &per_cpu (cpu_sibling_map, cpu)) ) +cpumask_set_cpu (cpu, &mask);flush_mask (&mask,FLUSH_CACHE ); }else
xen/arch/x86/mm/p2m.c +1 -1
@@ -81,7 +81,7 @@ static void p2m_initialise(struct domain p2m->default_access = p2m_access_rwx; p2m->cr3 =CR3_EADDR ; -cpus_clear (p2m->p2m_dirty_cpumask); +cpumask_clear (&p2m->p2m_dirty_cpumask);if (hap_enabled (d) && (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL ) )ept_p2m_init (p2m);
xen/arch/x86/mm/shadow/common.c +1 -1
@@ -3459,7 +3459,7 @@ static void sh_unshadow_for_p2m_change(sp2m_type_t p2mt =p2m_flags_to_type (l1e_get_flags (*p));if (p2m_is_valid (p2mt) &&mfn_valid (omfn) ) { -cpus_clear (flushmask); +cpumask_clear (&flushmask);/* If we're replacing a superpage with a normal L1 page, map it */ if ( (l1e_get_flags(new) & _PAGE_PRESENT)
xen/arch/x86/smp.c +3 -3
@@ -240,12 +240,12 @@ void flush_area_mask(const cpumask_t *maif ( !cpus_subset (*mask, *cpumask_of (smp_processor_id ())) ) {spin_lock (&flush_lock); -cpus_and (flush_cpumask, *mask, cpu_online_map); -cpu_clear (smp_processor_id (), flush_cpumask); +cpumask_and (&flush_cpumask, mask, &cpu_online_map); +cpumask_clear_cpu (smp_processor_id (), &flush_cpumask); flush_va = va; flush_flags = flags;send_IPI_mask (&flush_cpumask,INVALIDATE_TLB_VECTOR ); -while ( !cpus_empty (flush_cpumask) ) +while ( !cpumask_empty (&flush_cpumask) )cpu_relax ();spin_unlock (&flush_lock); }
xen/arch/x86/smpboot.c +8 -7
@@ -533,8 +533,9 @@ int alloc_cpu_id(void) {cpumask_t tmp_map;int cpu; -cpus_complement (tmp_map, cpu_present_map); - cpu =first_cpu (tmp_map); + +cpumask_complement (&tmp_map, &cpu_present_map); + cpu =cpumask_first (&tmp_map);return (cpu < nr_cpu_ids) ? cpu : -ENODEV ; }
@@ -818,18 +819,18 @@ remove_siblinginfo(int cpu) {cpu_clear (cpu,per_cpu (cpu_core_map, sibling));/* Last thread sibling in this cpu core going down. */ -if (cpus_weight (per_cpu (cpu_sibling_map, cpu)) ==1 ) +if (cpumask_weight (&per_cpu (cpu_sibling_map, cpu)) ==1 ) c[sibling].booted_cores--; }for_each_cpu_mask (sibling,per_cpu (cpu_sibling_map, cpu)) -cpu_clear (cpu,per_cpu (cpu_sibling_map, sibling)); -cpus_clear (per_cpu (cpu_sibling_map, cpu)); -cpus_clear (per_cpu (cpu_core_map, cpu)); +cpumask_clear_cpu (cpu, &per_cpu (cpu_sibling_map, sibling)); +cpumask_clear (&per_cpu (cpu_sibling_map, cpu)); +cpumask_clear (&per_cpu (cpu_core_map, cpu)); c[cpu].phys_proc_id =BAD_APICID ; c[cpu].cpu_core_id =BAD_APICID ; c[cpu].compute_unit_id =BAD_APICID ; -cpu_clear (cpu, cpu_sibling_setup_map); +cpumask_clear_cpu (cpu, &cpu_sibling_setup_map); }void __cpu_disable (void )
xen/arch/x86/time.c +5 -5
@@ -185,15 +185,15 @@ static void smp_send_timer_broadcast_ipiint cpu =smp_processor_id ();cpumask_t mask; -cpus_and (mask, cpu_online_map, pit_broadcast_mask); +cpumask_and (&mask, &cpu_online_map, &pit_broadcast_mask); -if (cpu_isset (cpu, mask) ) +if (cpumask_test_cpu (cpu, &mask) ) { -cpu_clear (cpu, mask); +cpumask_clear_cpu (cpu, &mask);raise_softirq (TIMER_SOFTIRQ ); } -if ( !cpus_empty (mask) ) +if ( !cpumask_empty (&mask) ) {cpumask_raise_softirq (&mask,TIMER_SOFTIRQ ); }
@@ -1226,7 +1226,7 @@ void check_tsc_warp(unsigned long tsc_kh }static unsigned long tsc_max_warp, tsc_check_count; -static cpumask_t tsc_check_cpumask =CPU_MASK_NONE ; +static cpumask_t tsc_check_cpumask;static void tsc_check_slave (void *unused) {
xen/common/cpu.c +3 -3
@@ -176,7 +176,7 @@ int disable_nonboot_cpus(void)BUG_ON (smp_processor_id () !=0 ); -cpus_clear (frozen_cpus); +cpumask_clear (&frozen_cpus);printk ("Disabling non-boot CPUs ...\n" );
@@ -192,7 +192,7 @@ int disable_nonboot_cpus(void)break ; } -cpu_set (cpu, frozen_cpus); +cpumask_set_cpu (cpu, &frozen_cpus); }BUG_ON (!error && (num_online_cpus () !=1 ));
@@ -214,5 +214,5 @@ void enable_nonboot_cpus(void) } } -cpus_clear (frozen_cpus); +cpumask_clear (&frozen_cpus); }
xen/common/cpupool.c +1 -1
@@ -29,7 +29,7 @@ static struct cpupool *cpupool_list;static int cpupool_moving_cpu =-1 ;static struct cpupool *cpupool_cpu_moving =NULL ; -static cpumask_t cpupool_locked_cpus =CPU_MASK_NONE ; +static cpumask_t cpupool_locked_cpus;static DEFINE_SPINLOCK (cpupool_lock);
xen/common/domain.c +2 -1
@@ -359,11 +359,12 @@ struct domain *domain_create(void domain_update_node_affinity (struct domain *d) { -cpumask_t cpumask =CPU_MASK_NONE ; +cpumask_t cpumask;nodemask_t nodemask =NODE_MASK_NONE ;struct vcpu *v;unsigned int node; +cpumask_clear (&cpumask);spin_lock (&d->node_affinity_lock);for_each_vcpu ( d, v )
xen/common/domctl.c +14 -13
@@ -37,9 +37,9 @@ int cpumask_to_xenctl_cpumap(uint8_t bytemap[(NR_CPUS +7 ) /8 ]; guest_bytes = (xenctl_cpumap->nr_cpus +7 ) /8 ; - copy_bytes = min_t(unsigned int, guest_bytes, sizeof(bytemap)); + copy_bytes = min_t(unsigned int, guest_bytes, (nr_cpu_ids + 7) / 8); -bitmap_long_to_byte (bytemap,cpus_addr (*cpumask),NR_CPUS ); +bitmap_long_to_byte (bytemap,cpumask_bits (cpumask), nr_cpu_ids);if ( copy_bytes !=0 )if (copy_to_guest (xenctl_cpumap->bitmap, bytemap, copy_bytes) )
@@ -59,7 +59,7 @@ int xenctl_cpumap_to_cpumask(uint8_t bytemap[(NR_CPUS +7 ) /8 ]; guest_bytes = (xenctl_cpumap->nr_cpus +7 ) /8 ; - copy_bytes = min_t(unsigned int, guest_bytes, sizeof(bytemap)); + copy_bytes = min_t(unsigned int, guest_bytes, (nr_cpu_ids + 7) / 8);memset (bytemap,0 ,sizeof (bytemap));
@@ -71,7 +71,7 @@ int xenctl_cpumap_to_cpumask( bytemap[guest_bytes-1 ] &= ~(0xff << (xenctl_cpumap->nr_cpus &7 )); } -bitmap_byte_to_long (cpus_addr (*cpumask), bytemap,NR_CPUS ); +bitmap_byte_to_long (cpumask_bits (cpumask), bytemap, nr_cpu_ids);return 0 ; }
@@ -154,7 +154,7 @@ static unsigned int default_vcpu0_locaticpumask_t cpu_exclude_map;/* Do an initial CPU placement. Pick the least-populated CPU. */ - nr_cpus =last_cpu (cpu_online_map) +1 ; + nr_cpus =cpumask_last (&cpu_online_map) +1 ; cnt = xzalloc_array(unsigned int, nr_cpus);if ( cnt ) {
@@ -171,18 +171,19 @@ static unsigned int default_vcpu0_locati* If we're on a HT system, we only auto-allocate to a non-primary HT. We * favour high numbered CPUs in the event of a tie. */ - cpu =first_cpu (per_cpu (cpu_sibling_map,0 )); -if (cpus_weight (per_cpu (cpu_sibling_map,0 )) >1 ) - cpu =next_cpu (cpu,per_cpu (cpu_sibling_map,0 )); - cpu_exclude_map =per_cpu (cpu_sibling_map,0 ); +cpumask_copy (&cpu_exclude_map, &per_cpu (cpu_sibling_map,0 )); + cpu =cpumask_first (&cpu_exclude_map); +if (cpumask_weight (&cpu_exclude_map) >1 ) + cpu =cpumask_next (cpu, &cpu_exclude_map);for_each_cpu_mask (i, *online) { -if (cpu_isset (i, cpu_exclude_map) ) +if (cpumask_test_cpu (i, &cpu_exclude_map) )continue ; -if ( (i ==first_cpu (per_cpu (cpu_sibling_map, i))) && - (cpus_weight (per_cpu (cpu_sibling_map, i)) >1 ) ) +if ( (i ==cpumask_first (&per_cpu (cpu_sibling_map, i))) && + (cpumask_weight (&per_cpu (cpu_sibling_map, i)) >1 ) )continue ; -cpus_or (cpu_exclude_map, cpu_exclude_map,per_cpu (cpu_sibling_map, i)); +cpumask_or (&cpu_exclude_map, &cpu_exclude_map, + &per_cpu (cpu_sibling_map, i));if ( !cnt || cnt[i] <= cnt[cpu] ) cpu = i; }
xen/common/keyhandler.c +1 -1
@@ -316,7 +316,7 @@ static struct keyhandler dump_domains_ke .desc = "dump domain (and guest debug) info" }; -static cpumask_t read_clocks_cpumask =CPU_MASK_NONE ; +static cpumask_t read_clocks_cpumask; static DEFINE_PER_CPU(s_time_t, read_clocks_time); static DEFINE_PER_CPU(u64, read_cycles_time);
xen/common/page_alloc.c +7 -5
@@ -304,7 +304,7 @@ static struct page_info *alloc_heap_pageunsigned int first_node, i, j, zone =0 , nodemask_retry =0 ;unsigned int node = (uint8_t )((memflags >> _MEMF_node) -1 );unsigned long request =1UL << order; -cpumask_t extra_cpus_mask, mask; +cpumask_t mask;struct page_info *pg;nodemask_t nodemask = (d !=NULL ) ? d->node_affinity : node_online_map;
@@ -418,7 +418,7 @@ static struct page_info *alloc_heap_pageif ( d !=NULL ) d->last_alloc_node = node; -cpus_clear (mask); +cpumask_clear (&mask);for ( i =0 ; i < (1 << order); i++ ) {
@@ -429,9 +429,11 @@ static struct page_info *alloc_heap_pageif ( pg[i].u.free.need_tlbflush ) {/* Add in extra CPUs that need flushing because of this page. */ -cpus_andnot (extra_cpus_mask, cpu_online_map, mask); +static cpumask_t extra_cpus_mask; + +cpumask_andnot (&extra_cpus_mask, &cpu_online_map, &mask);tlbflush_filter (extra_cpus_mask, pg[i].tlbflush_timestamp); -cpus_or (mask, mask, extra_cpus_mask); +cpumask_or (&mask, &mask, &extra_cpus_mask); }/* Initialise fields which have other uses for free pages. */
@@ -441,7 +443,7 @@ static struct page_info *alloc_heap_pagespin_unlock (&heap_lock); -if (unlikely (!cpus_empty (mask)) ) +if (unlikely (!cpumask_empty (&mask)) ) {perfc_incr (need_flush_tlb_flush);flush_tlb_mask (&mask);
xen/common/rcupdate.c +0 -1
@@ -59,7 +59,6 @@ static struct rcu_ctrlblk { .cur = -300, .completed = -300, .lock = SPIN_LOCK_UNLOCKED, - .cpumask = CPU_MASK_NONE, };/*
xen/common/sched_credit.c +36 -36
173 lines not on this page · raw message
xen/common/sched_credit2.c +6 -6
@@ -507,19 +507,19 @@ runq_tickle(const struct scheduler *ops, }/* Get a mask of idle, but not tickled */ -cpus_andnot (mask, rqd->idle, rqd->tickled); +cpumask_andnot (&mask, &rqd->idle, &rqd->tickled);/* If it's not empty, choose one */ -if ( !cpus_empty (mask) ) +if ( !cpumask_empty (&mask) ) { - ipid=first_cpu (mask); + ipid =cpumask_first (&mask); goto tickle; }/* Otherwise, look for the non-idle cpu with the lowest credit, * skipping cpus which have been tickled but not scheduled yet */ -cpus_andnot (mask, rqd->active, rqd->idle); -cpus_andnot (mask, mask, rqd->tickled); +cpumask_andnot (&mask, &rqd->active, &rqd->idle); +cpumask_andnot (&mask, &mask, &rqd->tickled);for_each_cpu_mask (i, mask) {
@@ -573,7 +573,7 @@ tickle:sizeof (d), (unsigned char *)&d); } -cpu_set (ipid, rqd->tickled); +cpumask_set_cpu (ipid, &rqd->tickled);cpu_raise_softirq (ipid,SCHEDULE_SOFTIRQ ); no_tickle:
xen/common/schedule.c +2 -2
@@ -595,8 +595,8 @@ int vcpu_set_affinity(struct vcpu *v, coif ( v->domain->is_pinned )return -EINVAL ; online =VCPU2ONLINE (v); -cpus_and (online_affinity, *affinity, *online); -if (cpus_empty (online_affinity) ) +cpumask_and (&online_affinity, affinity, online); +if (cpumask_empty (&online_affinity) )return -EINVAL ;vcpu_schedule_lock_irq (v);
xen/common/softirq.c +3 -2
@@ -71,11 +71,12 @@ void open_softirq(int nr, softirq_handlevoid cpumask_raise_softirq (const cpumask_t *mask,unsigned int nr) {int cpu; -cpumask_t send_mask =CPU_MASK_NONE ; +cpumask_t send_mask; +cpumask_clear (&send_mask);for_each_cpu_mask (cpu, *mask)if ( !test_and_set_bit (nr, &softirq_pending (cpu)) ) -cpu_set (cpu, send_mask); +cpumask_set_cpu (cpu, &send_mask);smp_send_event_check_mask (&send_mask); }
xen/common/trace.c +2 -1
@@ -70,7 +70,7 @@ static DEFINE_PER_CPU(unsigned long, losint tb_init_done__read_mostly ;/* which CPUs tracing is enabled on */ -static cpumask_t tb_cpu_mask =CPU_MASK_ALL ; +static cpumask_t tb_cpu_mask;/* which tracing events are enabled */ static u32 tb_event_mask =TRC_ALL ;
@@ -338,6 +338,7 @@ int trace_will_trace_event(u32 event)*/ void __init init_trace_bufs (void ) { +cpumask_setall (&tb_cpu_mask);register_cpu_notifier (&cpu_nfb);if ( opt_tbuf_size )
xen/include/xen/cpumask.h +45 -74
193 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel