From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Wei Liu <wl@xen.org>
Cc: Wei Liu <liuwe@microsoft.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Paul Durrant <pdurrant@amazon.com>,
Michael Kelley <mikelley@microsoft.com>,
Jan Beulich <jbeulich@suse.com>,
Xen Development List <xen-devel@lists.xenproject.org>
Subject: Re: [Xen-devel] [PATCH v4 3/3] x86/hyperv: L0 assisted TLB flush
Date: Wed, 19 Feb 2020 18:52:08 +0100 [thread overview]
Message-ID: <20200219175208.GH4679@Air-de-Roger> (raw)
In-Reply-To: <20200219114411.26922-4-liuwe@microsoft.com>
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@microsoft.com>
LGTM:
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
> +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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2020-02-19 17:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-19 11:44 [Xen-devel] [PATCH v4 0/3] Xen on Hyper-V: Implement L0 assisted TLB flush Wei Liu
2020-02-19 11:44 ` [Xen-devel] [PATCH v4 1/3] x86/hypervisor: pass flags to hypervisor_flush_tlb Wei Liu
2020-03-09 16:38 ` Jan Beulich
2020-03-09 17:25 ` Wei Liu
2020-03-10 9:58 ` Jan Beulich
2020-03-10 13:39 ` Wei Liu
2020-02-19 11:44 ` [Xen-devel] [PATCH v4 2/3] x86/hyperv: skeleton for L0 assisted TLB flush Wei Liu
2020-02-19 11:44 ` [Xen-devel] [PATCH v4 3/3] x86/hyperv: " Wei Liu
2020-02-19 17:52 ` Roger Pau Monné [this message]
2020-02-20 10:53 ` Durrant, Paul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200219175208.GH4679@Air-de-Roger \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=liuwe@microsoft.com \
--cc=mikelley@microsoft.com \
--cc=pdurrant@amazon.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.