From: kys@linuxonhyperv.com
To: x86@kernel.org, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com,
tglx@linutronix.de, hpa@zytor.com, sthemmin@microsoft.com,
Michael.H.Kelley@microsoft.com, vkuznets@redhat.com
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Subject: [PATCH 4/5] X86: Hyper-V: Consolidate code for converting cpumask to vpset
Date: Wed, 25 Apr 2018 11:12:49 -0700 [thread overview]
Message-ID: <20180425181250.8740-4-kys@linuxonhyperv.com> (raw)
In-Reply-To: <20180425181250.8740-1-kys@linuxonhyperv.com>
From: "K. Y. Srinivasan" <kys@microsoft.com>
Consolidate code for converting cpumask to vpset.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
arch/x86/hyperv/hv_apic.c | 2 +-
arch/x86/hyperv/mmu.c | 45 +++-----------------------------------
arch/x86/include/asm/hyperv-tlfs.h | 2 +-
3 files changed, 5 insertions(+), 44 deletions(-)
diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c
index fbb408b91e25..508889c8499e 100644
--- a/arch/x86/hyperv/hv_apic.c
+++ b/arch/x86/hyperv/hv_apic.c
@@ -123,7 +123,7 @@ static int __send_ipi_mask_ex(const struct cpumask *mask, int vector)
ipi_arg->vp_set.valid_bank_mask = 0;
if (!cpumask_equal(mask, cpu_present_mask)) {
- ipi_arg->vp_set.format = HV_GENERIC_SET_SPARCE_4K;
+ ipi_arg->vp_set.format = HV_GENERIC_SET_SPARSE_4K;
nr_bank = cpumask_to_vpset(&(ipi_arg->vp_set), mask);
}
if (!nr_bank)
diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c
index 56c9ebac946f..c9cd28f0bae4 100644
--- a/arch/x86/hyperv/mmu.c
+++ b/arch/x86/hyperv/mmu.c
@@ -25,11 +25,7 @@ struct hv_flush_pcpu {
struct hv_flush_pcpu_ex {
u64 address_space;
u64 flags;
- struct {
- u64 format;
- u64 valid_bank_mask;
- u64 bank_contents[];
- } hv_vp_set;
+ struct hv_vpset hv_vp_set;
u64 gva_list[];
};
@@ -70,41 +66,6 @@ static inline int fill_gva_list(u64 gva_list[], int offset,
return gva_n - offset;
}
-/* Return the number of banks in the resulting vp_set */
-static inline int cpumask_to_vp_set(struct hv_flush_pcpu_ex *flush,
- const struct cpumask *cpus)
-{
- int cpu, vcpu, vcpu_bank, vcpu_offset, nr_bank = 1;
-
- /* valid_bank_mask can represent up to 64 banks */
- if (hv_max_vp_index / 64 >= 64)
- return 0;
-
- /*
- * Clear all banks up to the maximum possible bank as hv_flush_pcpu_ex
- * structs are not cleared between calls, we risk flushing unneeded
- * vCPUs otherwise.
- */
- for (vcpu_bank = 0; vcpu_bank <= hv_max_vp_index / 64; vcpu_bank++)
- flush->hv_vp_set.bank_contents[vcpu_bank] = 0;
-
- /*
- * Some banks may end up being empty but this is acceptable.
- */
- for_each_cpu(cpu, cpus) {
- vcpu = hv_cpu_number_to_vp_number(cpu);
- vcpu_bank = vcpu / 64;
- vcpu_offset = vcpu % 64;
- __set_bit(vcpu_offset, (unsigned long *)
- &flush->hv_vp_set.bank_contents[vcpu_bank]);
- if (vcpu_bank >= nr_bank)
- nr_bank = vcpu_bank + 1;
- }
- flush->hv_vp_set.valid_bank_mask = GENMASK_ULL(nr_bank - 1, 0);
-
- return nr_bank;
-}
-
static void hyperv_flush_tlb_others(const struct cpumask *cpus,
const struct flush_tlb_info *info)
{
@@ -239,8 +200,8 @@ static void hyperv_flush_tlb_others_ex(const struct cpumask *cpus,
flush->hv_vp_set.valid_bank_mask = 0;
if (!cpumask_equal(cpus, cpu_present_mask)) {
- flush->hv_vp_set.format = HV_GENERIC_SET_SPARCE_4K;
- nr_bank = cpumask_to_vp_set(flush, cpus);
+ flush->hv_vp_set.format = HV_GENERIC_SET_SPARSE_4K;
+ nr_bank = cpumask_to_vpset(&(flush->hv_vp_set), cpus);
}
if (!nr_bank) {
diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
index 53ea30d768d9..b32b87945538 100644
--- a/arch/x86/include/asm/hyperv-tlfs.h
+++ b/arch/x86/include/asm/hyperv-tlfs.h
@@ -370,7 +370,7 @@ struct hv_tsc_emulation_status {
#define HV_FLUSH_USE_EXTENDED_RANGE_FORMAT BIT(3)
enum HV_GENERIC_SET_FORMAT {
- HV_GENERIC_SET_SPARCE_4K,
+ HV_GENERIC_SET_SPARSE_4K,
HV_GENERIC_SET_ALL,
};
--
2.15.1
next prev parent reply other threads:[~2018-04-25 18:12 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-25 18:11 [PATCH 0/5] X86: Hyper-V: APIC enlightenments kys
2018-04-25 18:12 ` [PATCH 1/5] X86: Hyper-V: Enlighten APIC access kys
2018-04-25 18:12 ` [PATCH 2/5] X86: Hyper-V: Enable IPI enlightenments kys
2018-04-26 21:31 ` Dan Carpenter
2018-04-27 6:34 ` KY Srinivasan
2018-04-26 22:08 ` Thomas Gleixner
2018-04-27 6:11 ` KY Srinivasan
2018-04-26 22:54 ` Michael Kelley (EOSG)
2018-04-27 6:31 ` KY Srinivasan
2018-04-27 6:24 ` kbuild test robot
2018-04-27 11:21 ` kbuild test robot
2018-04-27 11:55 ` kbuild test robot
2018-04-25 18:12 ` [PATCH 3/5] X86: Hyper-V: Enhanced IPI enlightenment kys
2018-04-26 22:16 ` Thomas Gleixner
2018-04-27 6:24 ` KY Srinivasan
2018-04-26 23:25 ` Michael Kelley (EOSG)
2018-04-25 18:12 ` kys [this message]
2018-04-26 22:21 ` [PATCH 4/5] X86: Hyper-V: Consolidate code for converting cpumask to vpset Thomas Gleixner
2018-04-25 18:12 ` [PATCH 5/5] X86: Hyper-V: Consolidate the allocation of the hypercall input page kys
2018-04-26 22:23 ` Thomas Gleixner
2018-04-27 6:29 ` KY Srinivasan
2018-04-27 10:58 ` Thomas Gleixner
2018-04-27 11:50 ` kbuild test robot
2018-04-26 21:49 ` [PATCH 1/5] X86: Hyper-V: Enlighten APIC access Thomas Gleixner
2018-04-27 5:52 ` KY Srinivasan
2018-04-26 22:15 ` Michael Kelley (EOSG)
2018-04-26 22:55 ` Thomas Gleixner
2018-04-27 5:44 ` kbuild test robot
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=20180425181250.8740-4-kys@linuxonhyperv.com \
--to=kys@linuxonhyperv.com \
--cc=Michael.H.Kelley@microsoft.com \
--cc=apw@canonical.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=jasowang@redhat.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=olaf@aepfle.de \
--cc=sthemmin@microsoft.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.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.