|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 3/3] x86/hyperv: L0 assisted TLB flush
On Wed, Feb 19, 2020 at 11:44:11AM +0000, Wei Liu wrote:
> Implement L0 assisted TLB flush for Xen on Hyper-V. It takes advantage
> of several hypercalls:
>
> * HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST
> * HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST_EX
> * HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE
> * HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX
>
> Pick the most efficient hypercalls available.
>
> Signed-off-by: Wei Liu <liuwe@xxxxxxxxxxxxx>
LGTM:
Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> +int cpumask_to_vpset(struct hv_vpset *vpset,
> + const cpumask_t *mask)
> +{
> + int nr = 1;
> + unsigned int cpu, vcpu_bank, vcpu_offset;
> + unsigned int max_banks = ms_hyperv.max_vp_index / 64;
> +
> + /* Up to 64 banks can be represented by valid_bank_mask */
> + if ( max_banks > 64 )
> + return -E2BIG;
> +
> + /* Clear all banks to avoid flushing unwanted CPUs */
> + for ( vcpu_bank = 0; vcpu_bank < max_banks; vcpu_bank++ )
> + vpset->bank_contents[vcpu_bank] = 0;
> +
> + vpset->format = HV_GENERIC_SET_SPARSE_4K;
> +
> + for_each_cpu ( cpu, mask )
> + {
> + unsigned int vcpu = hv_vp_index(cpu);
> +
> + vcpu_bank = vcpu / 64;
> + vcpu_offset = vcpu % 64;
> +
> + __set_bit(vcpu_offset, &vpset->bank_contents[vcpu_bank]);
> +
> + if ( vcpu_bank >= nr )
> + nr = vcpu_bank + 1;
> + }
> +
> + /* Some banks may be empty but that's ok */
> + vpset->valid_bank_mask = ~0ULL >> (64 - nr);
You could also use the recently introduced bitmap_set here.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |