Re: [PATCH] KVM: vmx: add mismatched size in vmcs_check32

2021-04-08 Thread Haiwei Li
On Fri, Apr 9, 2021 at 12:05 AM Sean Christopherson wrote: > > On Thu, Apr 08, 2021, lihaiwei.ker...@gmail.com wrote: > > From: Haiwei Li > > > > vmcs_check32 misses the check for 64-bit and 64-bit high. > > Can you clarify in the changelog that, while it is archit

Re: [PATCH] KVM: VMX: Check the corresponding bits according to the intel sdm

2021-03-25 Thread Haiwei Li
On Thu, Mar 25, 2021 at 11:49 PM Sean Christopherson wrote: > > On Thu, Mar 25, 2021, Haiwei Li wrote: > > On Tue, Mar 23, 2021 at 10:37 AM wrote: > > > > > > From: Haiwei Li > > > > > > According to IA-32 SDM Vol.3D "A.1 BASIC VMX INFORMATIO

Re: [PATCH] KVM: VMX: Check the corresponding bits according to the intel sdm

2021-03-25 Thread Haiwei Li
On Tue, Mar 23, 2021 at 10:37 AM wrote: > > From: Haiwei Li > > According to IA-32 SDM Vol.3D "A.1 BASIC VMX INFORMATION", two inspections > are missing. > * Bit 31 is always 0. Earlier versions of this manual specified that the > VMCS revision identifier was a 32

Re: [PATCH] KVM: clean up the unused argument

2021-03-25 Thread Haiwei Li
i.ker...@gmail.com wrote: > > From: Haiwei Li > > > > kvm_msr_ignored_check function never uses vcpu argument. Clean up the > > function and invokers. > > > > Signed-off-by: Haiwei Li > > --- > > arch/x86/kvm/x86.c | 9 - > > 1 file chan

Re: [PATCH] KVM: x86/vPMU: Forbid writing to MSR_F15H_PERF MSRs when guest doesn't have X86_FEATURE_PERFCTR_CORE

2021-03-25 Thread Haiwei Li
On Thu, Mar 25, 2021 at 4:10 PM Vitaly Kuznetsov wrote: > > Haiwei Li writes: > > > On Tue, Mar 23, 2021 at 4:48 PM Vitaly Kuznetsov > > wrote: > >> > >> MSR_F15H_PERF_CTL0-5, MSR_F15H_PERF_CTR0-5 MSRs are only available when > >> X86_FEATURE

Re: [PATCH] KVM: x86/vPMU: Forbid writing to MSR_F15H_PERF MSRs when guest doesn't have X86_FEATURE_PERFCTR_CORE

2021-03-25 Thread Haiwei Li
On Tue, Mar 23, 2021 at 4:48 PM Vitaly Kuznetsov wrote: > > MSR_F15H_PERF_CTL0-5, MSR_F15H_PERF_CTR0-5 MSRs are only available when > X86_FEATURE_PERFCTR_CORE CPUID bit was exposed to the guest. KVM, however, > allows these MSRs unconditionally because kvm_pmu_is_valid_msr() -> > amd_msr_idx_to_pm

Re: [PATCH] KVM: x86/vPMU: Forbid writing to MSR_F15H_PERF MSRs when guest doesn't have X86_FEATURE_PERFCTR_CORE

2021-03-24 Thread Haiwei Li
$ rdmsr 0xc0010200 0 $ wrmsr 0xc0010200 1 $ rdmsr 0xc0010200 1 After patch: # rdmsr 0xc0010200 0 # wrmsr 0xc0010200 1 wrmsr: CPU 0 cannot set MSR 0xc0010200 to 0x0001 # rdmsr 0xc0010200 0 So, Tested-by: Haiwei Li

Re: [PATCH] KVM: VMX: Check the corresponding bits according to the intel sdm

2021-03-22 Thread Haiwei Li
On Tue, Mar 23, 2021 at 11:16 AM Jim Mattson wrote: > > On Mon, Mar 22, 2021 at 7:37 PM wrote: > > > > From: Haiwei Li > > > > According to IA-32 SDM Vol.3D "A.1 BASIC VMX INFORMATION", two inspections > > are missing. > > * Bit 31 is always 0

Re: [PATCH] kvm: lapic: add module parameters for LAPIC_TIMER_ADVANCE_ADJUST_MAX/MIN

2021-03-12 Thread Haiwei Li
On Sat, Mar 13, 2021 at 8:58 AM Sean Christopherson wrote: > > On Wed, Mar 10, 2021, Haiwei Li wrote: > > On Wed, Mar 10, 2021 at 7:42 AM Sean Christopherson > > wrote: > > > > > > On Wed, Mar 03, 2021, Haiwei Li wrote: > > > > On 21/3/3 10:09,

Re: [PATCH] kvm: lapic: add module parameters for LAPIC_TIMER_ADVANCE_ADJUST_MAX/MIN

2021-03-10 Thread Haiwei Li
On Wed, Mar 10, 2021 at 7:42 AM Sean Christopherson wrote: > > On Wed, Mar 03, 2021, Haiwei Li wrote: > > On 21/3/3 10:09, lihaiwei.ker...@gmail.com wrote: > > > From: Haiwei Li > > > > > > In my test environment, advance_expire_delta is

Re: [PATCH] kvm: lapic: add module parameters for LAPIC_TIMER_ADVANCE_ADJUST_MAX/MIN

2021-03-03 Thread Haiwei Li
On 21/3/3 10:09, lihaiwei.ker...@gmail.com wrote: From: Haiwei Li In my test environment, advance_expire_delta is frequently greater than the fixed LAPIC_TIMER_ADVANCE_ADJUST_MAX. And this will hinder the adjustment. Supplementary details: I have tried to backport timer related features to

Re: [PATCH v2] KVM: x86: Add tracepoint for dr_write/dr_read

2020-11-05 Thread Haiwei Li
Kindly ping. :) On 20/10/9 11:21, lihaiwei.ker...@gmail.com wrote: From: Haiwei Li When vmexit occurs caused by accessing dr, there is no tracepoint to track this action. Add tracepoint for this on x86 kvm. Signed-off-by: Haiwei Li --- v1 -> v2: * Improve the changelog arch/x86/kvm/

Re: [PATCH v2] KVM: x86: Add tracepoint for dr_write/dr_read

2020-10-21 Thread Haiwei Li
Kindly ping. :) On 20/10/9 11:21, lihaiwei.ker...@gmail.com wrote: From: Haiwei Li When vmexit occurs caused by accessing dr, there is no tracepoint to track this action. Add tracepoint for this on x86 kvm. Signed-off-by: Haiwei Li --- v1 -> v2: * Improve the changelog arch/x86/kvm/

Re: [PATCH v4] KVM: Check the allocation of pv cpu mask

2020-10-19 Thread Haiwei Li
On 20/10/19 19:23, Vitaly Kuznetsov wrote: lihaiwei.ker...@gmail.com writes: From: Haiwei Li check the allocation of per-cpu __pv_cpu_mask. Init 'send_IPI_mask_allbutself' only when successful and check the allocation of __pv_cpu_mask in 'kvm_flush_tlb_others'.

Re: [PATCH] KVM: x86: Add tracepoint for dr_write/dr_read

2020-09-29 Thread Haiwei Li
On 20/9/29 17:01, Peter Zijlstra wrote: On Tue, Sep 29, 2020 at 04:55:15PM +0800, lihaiwei.ker...@gmail.com wrote: From: Haiwei Li Add tracepoint trace_kvm_dr_write/trace_kvm_dr_read for x86 kvm. This is a changelog in the: i++; /* increment i */, style. Totally inadequate. I will

Re: [PATCH] KVM: SVM: Add tracepoint for cr_interception

2020-09-22 Thread Haiwei Li
Kindly ping. :) On 20/9/4 19:25, Haiwei Li wrote: From: Haiwei Li Add trace_kvm_cr_write and trace_kvm_cr_read for svm. Signed-off-by: Haiwei Li ---  arch/x86/kvm/svm/svm.c | 2 ++  1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index

Re: [PATCH 1/2] KVM: Fix the build error

2020-09-22 Thread Haiwei Li
On 20/9/20 21:09, Paolo Bonzini wrote: On 14/09/20 11:11, lihaiwei.ker...@gmail.com wrote: From: Haiwei Li When CONFIG_SMP is not set, an build error occurs with message "error: use of undeclared identifier 'kvm_send_ipi_mask_allbutself'" Fixes: 0f990222108d ("KVM: C

Re: [PATCH] KVM: SVM: Analyze is_guest_mode() in svm_vcpu_run()

2020-09-22 Thread Haiwei Li
On Tue, Sep 22, 2020 at 10:56 PM Paolo Bonzini wrote: > > On 22/09/20 16:54, Haiwei Li wrote: > >> EXIT_FASTPATH_REENTER_GUEST handling up to vcpu_enter_guest)... > > Hi, Paolo > > > > I have sent a patch to do this, > > > > https://lore.kerne

Re: [PATCH] KVM: SVM: Analyze is_guest_mode() in svm_vcpu_run()

2020-09-22 Thread Haiwei Li
On 20/9/22 21:43, Paolo Bonzini wrote: > On 14/09/20 22:43, Krish Sadhukhan wrote: >>> >> >> Not related to your changes, but should we get rid of the variable >> 'exit_fastpath' and just do, >> >> return svm_exit_handler_fastpath(vcpu); >> >> It seems the variable isn't used anywhere else

Re: [PATCH 1/2] KVM: Fix the build error

2020-09-20 Thread Haiwei Li
On 20/9/20 21:09, Paolo Bonzini wrote: On 14/09/20 11:11, lihaiwei.ker...@gmail.com wrote: From: Haiwei Li When CONFIG_SMP is not set, an build error occurs with message "error: use of undeclared identifier 'kvm_send_ipi_mask_allbutself'" Fixes: 0f990222108d ("KVM

Re: [PATCH] Revert "KVM: Check the allocation of pv cpu mask"

2020-09-16 Thread Haiwei Li
Vitaly Kuznetsov 于2020年9月16日周三 下午7:04写道: > > Haiwei Li writes: > > > On 20/9/16 17:03, Vitaly Kuznetsov wrote: > >> The commit 0f990222108d ("KVM: Check the allocation of pv cpu mask") we > >> have in 5.9-rc5 has two issue: > >> 1) Co

Re: [PATCH] Revert "KVM: Check the allocation of pv cpu mask"

2020-09-16 Thread Haiwei Li
o fix this commit. https://lore.kernel.org/kvm/20200914091148.95654-1-lihaiwei.ker...@gmail.com/T/#m6c27184012ee5438e5d91c09b1ba1b6a3ee30ee4 What do you think? Haiwei Li

Re: [PATCH] KVM: SVM: Analyze is_guest_mode() in svm_vcpu_run()

2020-09-15 Thread Haiwei Li
On 20/9/15 04:43, Krish Sadhukhan wrote: On 9/13/20 11:55 PM, Wanpeng Li wrote: From: Wanpeng Li Analyze is_guest_mode() in svm_vcpu_run() instead of svm_exit_handlers_fastpath() in conformity with VMX version. Suggested-by: Vitaly Kuznetsov Signed-off-by: Wanpeng Li ---   arch/x86/kv

Re: [PATCH] KVM: SVM: Add tracepoint for cr_interception

2020-09-04 Thread Haiwei Li
On 20/9/4 20:01, Vitaly Kuznetsov wrote: Haiwei Li writes: From: Haiwei Li Add trace_kvm_cr_write and trace_kvm_cr_read for svm. Signed-off-by: Haiwei Li --- arch/x86/kvm/svm/svm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm

Re: [PATCH v2] KVM: Check the allocation of pv cpu mask

2020-09-04 Thread Haiwei Li
On 20/9/4 17:53, Vitaly Kuznetsov wrote: Haiwei Li writes: On 20/9/3 18:39, Vitaly Kuznetsov wrote: Haiwei Li writes: From: Haiwei Li check the allocation of per-cpu __pv_cpu_mask. Initialize ops only when successful. Signed-off-by: Haiwei Li --- arch/x86/kernel/kvm.c | 24

[PATCH] KVM: SVM: Add tracepoint for cr_interception

2020-09-04 Thread Haiwei Li
From: Haiwei Li Add trace_kvm_cr_write and trace_kvm_cr_read for svm. Signed-off-by: Haiwei Li --- arch/x86/kvm/svm/svm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 03dd7bac8034..2c6dea48ba62 100644 --- a/arch/x86/kvm/svm/svm.c

Re: [PATCH v2] KVM: Check the allocation of pv cpu mask

2020-09-03 Thread Haiwei Li
On 20/9/3 18:39, Vitaly Kuznetsov wrote: Haiwei Li writes: From: Haiwei Li check the allocation of per-cpu __pv_cpu_mask. Initialize ops only when successful. Signed-off-by: Haiwei Li --- arch/x86/kernel/kvm.c | 24 1 file changed, 20 insertions(+), 4

[PATCH v2] KVM: Check the allocation of pv cpu mask

2020-09-02 Thread Haiwei Li
From: Haiwei Li check the allocation of per-cpu __pv_cpu_mask. Initialize ops only when successful. Signed-off-by: Haiwei Li --- arch/x86/kernel/kvm.c | 24 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c

Re: [PATCH] KVM: Check the allocation of pv cpu mask

2020-09-02 Thread Haiwei Li
wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Haiwei-Li/KVM-Check-the-allocation-of-pv-cpu-mask/20200901-195412 base: https://git.

[PATCH] KVM: Check the allocation of pv cpu mask

2020-09-01 Thread Haiwei Li
From: Haiwei Li check the allocation of per-cpu __pv_cpu_mask. Initialize ops only when successful. Signed-off-by: Haiwei Li --- arch/x86/kernel/kvm.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c

[PATCH] perf/x86/svm: Convert 'perf kvm stat report' output lowercase to uppercase

2020-07-28 Thread Haiwei Li
From: Haiwei Li The reason output of 'perf kvm stat report --event=vmexit' is uppercase on VMX and lowercase on SVM. To be consistent with VMX, convert lowercase to uppercase. Signed-off-by: Haiwei Li --- arch/x86/include/uapi/asm/svm.h

[PATCH] KVM: Using macros instead of magic values

2020-07-21 Thread Haiwei Li
From: Haiwei Li Instead of using magic values, use macros. Signed-off-by: Haiwei Li --- arch/x86/kvm/lapic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 47801a4..d5fb2ea 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch

[PATCH] KVM: Fix the indentation to match coding style

2020-05-17 Thread Haiwei Li
From: Haiwei Li There is a bad indentation in next&queue branch. The patch looks like fixes nothing though it fixes the indentation. Before fixing: if (!handle_fastpath_set_x2apic_icr_irqoff(vcpu, data)) { kvm_skip_emulated_instruction(