[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 4/4] x86/hyperv: L0 assisted TLB flush
On 12.02.2020 18:43, Roger Pau Monné wrote: > On Wed, Feb 12, 2020 at 04:09:18PM +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> >> --- >> xen/arch/x86/guest/hyperv/Makefile | 1 + >> xen/arch/x86/guest/hyperv/private.h | 9 ++ >> xen/arch/x86/guest/hyperv/tlb.c | 172 +++++++++++++++++++++++++++- >> xen/arch/x86/guest/hyperv/util.c | 72 ++++++++++++ >> 4 files changed, 253 insertions(+), 1 deletion(-) >> create mode 100644 xen/arch/x86/guest/hyperv/util.c >> >> diff --git a/xen/arch/x86/guest/hyperv/Makefile >> b/xen/arch/x86/guest/hyperv/Makefile >> index 18902c33e9..0e39410968 100644 >> --- a/xen/arch/x86/guest/hyperv/Makefile >> +++ b/xen/arch/x86/guest/hyperv/Makefile >> @@ -1,2 +1,3 @@ >> obj-y += hyperv.o >> obj-y += tlb.o >> +obj-y += util.o >> diff --git a/xen/arch/x86/guest/hyperv/private.h >> b/xen/arch/x86/guest/hyperv/private.h >> index 78e52f74ce..311f060495 100644 >> --- a/xen/arch/x86/guest/hyperv/private.h >> +++ b/xen/arch/x86/guest/hyperv/private.h >> @@ -24,12 +24,21 @@ >> >> #include <xen/cpumask.h> >> #include <xen/percpu.h> >> +#include <xen/types.h> >> >> DECLARE_PER_CPU(void *, hv_input_page); >> DECLARE_PER_CPU(void *, hv_vp_assist); >> DECLARE_PER_CPU(uint32_t, hv_vp_index); >> >> +static inline uint32_t hv_vp_index(int cpu) > > unsigned int for cpu. And also for the return type, as per my comment on patch 1. >> --- a/xen/arch/x86/guest/hyperv/tlb.c >> +++ b/xen/arch/x86/guest/hyperv/tlb.c >> @@ -19,15 +19,185 @@ >> * Copyright (c) 2020 Microsoft. >> */ >> >> +#include <xen/cpu.h> >> #include <xen/cpumask.h> >> #include <xen/errno.h> >> >> +#include <asm/guest/hyperv.h> >> +#include <asm/guest/hyperv-hcall.h> >> +#include <asm/guest/hyperv-tlfs.h> >> + >> #include "private.h" >> >> +/* >> + * It is possible to encode up to 4096 pages using the lower 12 bits >> + * in an element of gva_list >> + */ >> +#define HV_TLB_FLUSH_UNIT (4096 * PAGE_SIZE) >> +#define ORDER_TO_BYTES(order) ((1ul << (order)) * PAGE_SIZE) > > There are already some conversion functions in xen/mm.h > (get_order_from_{bytes/pages}), maybe you could add a > get_bytes_from_order helper there? I don't think a macro (or helper function) is worthwhile here - we don't have any in the various other places that do the same. The above should be used inline, preferably in the simpler form of PAGE_SIZE << order. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |