[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 6 Jun 2018 05:36:29 +0000
From: Tianyu Lan <Tianyu.Lan@...rosoft.com>
To: "Michael Kelley (EOSG)" <Michael.H.Kelley@...rosoft.com>,
Tianyu Lan <Tianyu.Lan@...rosoft.com>
CC: KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"hpa@...or.com" <hpa@...or.com>, "x86@...nel.org" <x86@...nel.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"rkrcmar@...hat.com" <rkrcmar@...hat.com>,
"devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"vkuznets@...hat.com" <vkuznets@...hat.com>
Subject: Re: [RFC Patch 1/3] X86/Hyper-V: Add flush
HvFlushGuestPhysicalAddressSpace hypercall support
Hi Michael:
Thanks for your review.
On 6/6/2018 12:59 AM, Michael Kelley (EOSG) wrote:
>> -----Original Message-----
>> From: linux-kernel-owner@...r.kernel.org <linux-kernel-owner@...r.kernel.org> On Behalf
>> Of Tianyu Lan
>> Sent: Monday, June 4, 2018 2:08 AM
>> Cc: Tianyu Lan <Tianyu.Lan@...rosoft.com>; KY Srinivasan <kys@...rosoft.com>; Haiyang
>> Zhang <haiyangz@...rosoft.com>; Stephen Hemminger <sthemmin@...rosoft.com>;
>> tglx@...utronix.de; mingo@...hat.com; hpa@...or.com; x86@...nel.org;
>> pbonzini@...hat.com; rkrcmar@...hat.com; devel@...uxdriverproject.org; linux-
>> kernel@...r.kernel.org; kvm@...r.kernel.org; vkuznets@...hat.com
>> Subject: [RFC Patch 1/3] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall
>> support
>>
>> Hyper-V provides a pv hypercall HvFlushGuestPhysicalAddressSpace to flush
>> nested VM address space mapping in l1 hypervisor and it's to reduce overhead
>> of flushing ept tlb among vcpus. This patch is to implement it.
>>
>> Signed-off-by: Lan Tianyu <Tianyu.Lan@...rosoft.com>
>> ---
>> diff --git a/arch/x86/hyperv/nested.c b/arch/x86/hyperv/nested.c
>> new file mode 100644
>> index 000000000000..17f7c288eccc
>> --- /dev/null
>> +++ b/arch/x86/hyperv/nested.c
>> +#include <linux/types.h>
>> +#include <asm/hyperv-tlfs.h>
>> +#include <asm/mshyperv.h>
>> +#include <asm/tlbflush.h>
>> +
>> +int hyperv_flush_guest_mapping(u64 as)
>> +{
>> + struct hv_guest_mapping_flush **flush_pcpu;
>> + struct hv_guest_mapping_flush *flush;
>> + u64 status = U64_MAX;
>
> Initializing status to U64_MAX doesn't seem necessary.
>
>> + unsigned long flags;
>> + int ret = -EFAULT;
>> +
>> + if (!hv_hypercall_pg)
>> + goto fault;
>> +
>> + local_irq_save(flags);
>> +
>> + flush_pcpu = (struct hv_guest_mapping_flush **)
>> + this_cpu_ptr(hyperv_pcpu_input_arg);
>> +
>> + flush = *flush_pcpu;
>> +
>> + if (unlikely(!flush)) {
>> + local_irq_restore(flags);
>> + goto fault;
>> + }
>> +
>> + flush->address_space = as;
>> + flush->flags = 0;
>> +
>> + status = hv_do_hypercall(HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE,
>> + flush, NULL);
>> + local_irq_restore(flags);
>> +
>> + if (!(status & HV_HYPERCALL_RESULT_MASK))
>> + ret = 0;
>> +
>> +fault:
>> + return ret;
>> +}
>> +EXPORT_SYMBOL_GPL(hyperv_flush_guest_mapping);
>> diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
>> index b8c89265baf0..53bbeb08faea 100644
>> --- a/arch/x86/include/asm/hyperv-tlfs.h
>> +++ b/arch/x86/include/asm/hyperv-tlfs.h
>> @@ -309,6 +309,7 @@ struct ms_hyperv_tsc_page {
>> #define HV_X64_MSR_REENLIGHTENMENT_CONTROL 0x40000106
>>
>> /* Nested features (CPUID 0x4000000A) EAX */
>> +#define HV_X64_NESTED_GUSET_MAPPING_FLUSH BIT(18)
>
> The #define name is misspelled. "_GUSET_" should be "_GUEST_".
> And the matching usage in patch 3/3 will need to be updated as well.
>
> Michael
>
Nice catch! Will update.
Powered by blists - more mailing lists