[PATCH] Test case of emulating multibyte NOP

2013-06-05 Thread Arthur Chunqi Li
Add multibyte NOP test case to kvm-unit-tests. This version adds test cases into x86/realmode.c. This can test one of bugs when booting RHEL5.9 64-bit. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/realmode.c | 24 1 file changed, 24 insertions(+) diff

[PATCH] kvm-unit-tests: Add test case for accessing bpl via modr/m

2013-06-05 Thread Arthur Chunqi Li
Test access to %bpl via modr/m addressing mode. This case can test another bug in the boot of RHEL5.9 64-bit. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/emulator.c | 41 + 1 file changed, 41 insertions(+) diff --git a/x86/emulator.c b/x86

[PATCH] kvm-unit-tests: Test case of emulating multibyte NOP

2013-06-06 Thread Arthur Chunqi Li
Add multibyte (1 to 4-bytes) NOPL test case to kvm-unit-tests x86/realmode.c. This test only consist of 16-bit NOPL insn, other test cases (5 to 9-bytes NOPL) should be placed in x86/emulator.c. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/realmode.c | 14 ++ 1 file

[PATCH 1/2] kvm-unit-tests: Add a func to run instruction in emulator

2013-06-06 Thread Arthur Chunqi Li
Add a function trap_emulator to run an instruction in emulator. Set inregs first (%rax is invalid because it is used as return address), put instruction codec in alt_insn and call func with alt_insn_length. Get results in outregs. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86

[PATCH 2/2] kvm-unit-tests: Change two cases to use trap_emulator

2013-06-06 Thread Arthur Chunqi Li
Change two functions (test_mmx_movq_mf and test_movabs) using unified trap_emulator. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/emulator.c | 66 1 file changed, 14 insertions(+), 52 deletions(-) diff --git a/x86/emulator.c

[PATCH 2/2] kvm-unit-tests: Change two cases to use trap_emulator

2013-06-06 Thread Arthur Chunqi Li
Change two functions (test_mmx_movq_mf and test_movabs) using unified trap_emulator. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/emulator.c | 66 1 file changed, 14 insertions(+), 52 deletions(-) diff --git a/x86/emulator.c

[PATCH 1/2] kvm-unit-tests: Add a func to run instruction in emulator

2013-06-06 Thread Arthur Chunqi Li
Add a function trap_emulator to run an instruction in emulator. Set inregs first (%rax, %rsp, %rbp, %rflags have special usage and cannot set in inregs), put instruction codec in alt_insn and call func with alt_insn_length. Get results in outregs. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com

[PATCH 1/2] kvm-unit-tests: Add a func to run instruction in emulator

2013-06-10 Thread Arthur Chunqi Li
Add a function trap_emulator to run an instruction in emulator. Set inregs first (%rax is invalid because it is used as return address), put instruction codec in alt_insn and call func with alt_insn_length. Get results in outregs. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86

[PATCH 2/2] kvm-unit-tests: Change two cases to use trap_emulator

2013-06-10 Thread Arthur Chunqi Li
Change two functions (test_mmx_movq_mf and test_movabs) using unified trap_emulator. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/emulator.c | 63 +++- 1 file changed, 12 insertions(+), 51 deletions(-) diff --git a/x86/emulator.c

[PATCH 2/2] kvm-unit-tests: Change two cases to use trap_emulator

2013-06-10 Thread Arthur Chunqi Li
Change two functions (test_mmx_movq_mf and test_movabs) using unified trap_emulator. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/emulator.c | 65 1 file changed, 13 insertions(+), 52 deletions(-) diff --git a/x86/emulator.c

[PATCH 1/2] kvm-unit-tests: Add a func to run instruction in emulator

2013-06-13 Thread Arthur Chunqi Li
Add a function trap_emulator to run an instruction in emulator. Set inregs first (%rax is invalid because it is used as return address), put instruction codec in alt_insn and call func with alt_insn_length. Get results in outregs. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86

[PATCH 2/2] kvm-unit-tests: Change two cases to use trap_emulator

2013-06-13 Thread Arthur Chunqi Li
Change two functions (test_mmx_movq_mf and test_movabs) using unified trap_emulator. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/emulator.c | 85 +++- 1 file changed, 23 insertions(+), 62 deletions(-) diff --git a/x86/emulator.c

[PATCH 1/2] kvm-unit-tests: Add a func to run instruction in emulator

2013-06-19 Thread Arthur Chunqi Li
Add a function trap_emulator to run an instruction in emulator. Set inregs first (%rax is invalid because it is used as return address), put instruction codec in alt_insn and call func with alt_insn_length. Get results in outregs. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86

[PATCH 2/2] kvm-unit-tests: Change two cases to use trap_emulator

2013-06-19 Thread Arthur Chunqi Li
Change two functions (test_mmx_movq_mf and test_movabs) using unified trap_emulator. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/emulator.c | 62 ++-- 1 file changed, 11 insertions(+), 51 deletions(-) diff --git a/x86/emulator.c

[PATCH 2/2] kvm-unit-tests: Change two cases to use trap_emulator

2013-06-20 Thread Arthur Chunqi Li
Change two functions (test_mmx_movq_mf and test_movabs) using unified trap_emulator. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/emulator.c | 70 1 file changed, 15 insertions(+), 55 deletions(-) diff --git a/x86/emulator.c

[PATCH 1/2] kvm-unit-tests: Add a func to run instruction in emulator

2013-06-20 Thread Arthur Chunqi Li
Add a function trap_emulator to run an instruction in emulator. Set inregs first (%rax is invalid because it is used as return address), put instruction codec in alt_insn and call func with alt_insn_length. Get results in outregs. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- lib

[PATCH v4 1/3] kvm-unit-tests: Add memcpy to lib/string.c

2013-06-20 Thread Arthur Chunqi Li
Add memcpy(void *dest, const void *src, size_t n) to lib/string.c. This function acts the same as memcpy in libc. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- lib/libcflat.h |1 + lib/string.c | 12 2 files changed, 13 insertions(+) diff --git a/lib/libcflat.h b/lib

[PATCH v4 2/3] kvm-unit-tests: Add a func to run instruction in emulator

2013-06-20 Thread Arthur Chunqi Li
Add a function trap_emulator to run an instruction in emulator. Set inregs first (%rax is invalid because it is used as return address), put instruction codec in alt_insn and call func with alt_insn_length. Get results in outregs. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86

[PATCH v4 3/3] kvm-unit-tests: Change two cases to use trap_emulator

2013-06-20 Thread Arthur Chunqi Li
Change two functions (test_mmx_movq_mf and test_movabs) using unified trap_emulator. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/emulator.c | 70 1 file changed, 15 insertions(+), 55 deletions(-) diff --git a/x86/emulator.c

[PATCH 1/3] emulator: fix confused param list

2013-06-25 Thread Arthur Chunqi Li
Fix param list of test_mmx_movq_mf and test_movabs. The previous version uses insn_page and insn_ram which are not used afterwards. There are also two variants named insn_page and insn_ram, which has no relation with these two functions. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86

[PATCH 2/3] emulator: Add multibyte nopl test case

2013-06-25 Thread Arthur Chunqi Li
Test multiple byte nopl (from 1-byte nopl to 9-byte nopl) in 64-bit mode. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/emulator.c | 25 + 1 file changed, 25 insertions(+) diff --git a/x86/emulator.c b/x86/emulator.c index 6972334..bd02d5c 100755 --- a/x86

[PATCH 3/3] emulator: Add spl/bpl/sil/dil access via modrm

2013-06-25 Thread Arthur Chunqi Li
Add test case of accessing spl/bpl/sil/dil via modrm in emulator. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/emulator.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/x86/emulator.c b/x86/emulator.c index bd02d5c..bea9513 100755 --- a/x86

Re: [PATCH 1/3] emulator: fix confused param list

2013-06-25 Thread Arthur Chunqi Li
These patches are some unfinished work and bug fixes related to Paolo's exercise. I think I'd better finish these simple jobs. Arthur On Tue, Jun 25, 2013 at 4:51 PM, Arthur Chunqi Li yzt...@gmail.com wrote: Fix param list of test_mmx_movq_mf and test_movabs. The previous version uses

IA32_FEATURE_CONTROL MSR in nested virt

2013-07-03 Thread Arthur Chunqi Li
. This solution can solve most basic problems since this MSR is not commonly used. Another solution is adding a field in VCPU to handle this MSR. This is a complex but better method. I think I can complete this if needed. Thanks, Arthur -- Arthur Chunqi Li Department of Computer Science School of EECS

[PATCH] KVM : Fix read/write to IA32_FEATURE_CONTROL MSR in nested virt

2013-07-03 Thread Arthur Chunqi Li
Fix read/write to IA32_FEATURE_CONTROL MSR in nested environment. Simply return 0x5 when read and generate #GP(0) when write. Delete handling codes in vmx_set_vmx_msr() and generate #GP(0) in handle_wrmsr(). Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- arch/x86/kvm/vmx.c |5 + 1

[PATCH] KVM : Set success rflags when emulate VMXON/VMXOFF in nested virt

2013-07-03 Thread Arthur Chunqi Li
Set success rflags after emulating VMXON/VMXOFF in nested environment. Re-arrange the code sequence of 3 functions, nested_vmx_succeed()/failValid()/failInvalid(), to avoid double declaration in the same file. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- arch/x86/kvm/vmx.c | 85

Re: [PATCH] KVM : Set success rflags when emulate VMXON/VMXOFF in nested virt

2013-07-03 Thread Arthur Chunqi Li
. Arthur On Thu, Jul 4, 2013 at 12:05 AM, Arthur Chunqi Li yzt...@gmail.com wrote: Set success rflags after emulating VMXON/VMXOFF in nested environment. Re-arrange the code sequence of 3 functions, nested_vmx_succeed()/failValid()/failInvalid(), to avoid double declaration in the same file. Signed

[PATCH v2 1/2] KVM : Change location of 3 functions in vmx.c

2013-07-04 Thread Arthur Chunqi Li
Move nested_vmx_succeed/nested_vmx_failInvalid/nested_vmx_failValid ahead of handle_vmon to eliminate double declaration in the same file Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- arch/x86/kvm/vmx.c | 83 +--- 1 file changed, 40

[PATCH v2 2/2] KVM : Set success rflags when emulate VMXON/VMXOFF in nested virt

2013-07-04 Thread Arthur Chunqi Li
Set rflags after successfully emulateing VMXON/VMXOFF in VMX. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- arch/x86/kvm/vmx.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 1764b13..423bc411 100644 --- a/arch/x86/kvm/vmx.c +++ b

Re: [PATCH] KVM : Fix read/write to IA32_FEATURE_CONTROL MSR in nested virt

2013-07-04 Thread Arthur Chunqi Li
On Thu, Jul 4, 2013 at 3:10 PM, Gleb Natapov g...@redhat.com wrote: On Thu, Jul 04, 2013 at 09:00:09AM +0200, Paolo Bonzini wrote: Il 03/07/2013 15:41, Arthur Chunqi Li ha scritto: Fix read/write to IA32_FEATURE_CONTROL MSR in nested environment. Simply return 0x5 when read and generate #GP

Re: [PATCH] KVM : Fix read/write to IA32_FEATURE_CONTROL MSR in nested virt

2013-07-04 Thread Arthur Chunqi Li
On Thu, Jul 4, 2013 at 8:43 PM, Gleb Natapov g...@redhat.com wrote: On Thu, Jul 04, 2013 at 02:34:11PM +0200, Paolo Bonzini wrote: Il 04/07/2013 13:31, Gleb Natapov ha scritto: On Thu, Jul 04, 2013 at 01:21:51PM +0200, Paolo Bonzini wrote: Il 04/07/2013 13:12, Gleb Natapov ha scritto: I

[PATCH v2] KVM: nVMX: Fix read/write to MSR_IA32_FEATURE_CONTROL

2013-07-05 Thread Arthur Chunqi Li
Fix read/write to IA32_FEATURE_CONTROL MSR in nested environment. This patch simulate this MSR in nested_vmx and the default value is 0x0. BIOS should set it to 0x5 before VMXON. After setting the lock bit, write to it will cause #GP(0). Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- arch

Re: [PATCH v2] KVM: nVMX: Fix read/write to MSR_IA32_FEATURE_CONTROL

2013-07-07 Thread Arthur Chunqi Li
On Sun, Jul 7, 2013 at 2:59 PM, Gleb Natapov g...@redhat.com wrote: On Fri, Jul 05, 2013 at 11:13:17PM +0800, Arthur Chunqi Li wrote: Fix read/write to IA32_FEATURE_CONTROL MSR in nested environment. This patch simulate this MSR in nested_vmx and the default value is 0x0. BIOS should set

Re: [PATCH v2] KVM: nVMX: Fix read/write to MSR_IA32_FEATURE_CONTROL

2013-07-07 Thread Arthur Chunqi Li
On Sun, Jul 7, 2013 at 3:20 PM, Gleb Natapov g...@redhat.com wrote: On Sun, Jul 07, 2013 at 03:16:08PM +0800, Arthur Chunqi Li wrote: On Sun, Jul 7, 2013 at 2:59 PM, Gleb Natapov g...@redhat.com wrote: On Fri, Jul 05, 2013 at 11:13:17PM +0800, Arthur Chunqi Li wrote: Fix read/write

Re: [PATCH v2] KVM: nVMX: Fix read/write to MSR_IA32_FEATURE_CONTROL

2013-07-07 Thread Arthur Chunqi Li
On Sun, Jul 7, 2013 at 4:50 PM, Gleb Natapov g...@redhat.com wrote: On Sun, Jul 07, 2013 at 04:47:05PM +0800, Arthur Chunqi Li wrote: On Sun, Jul 7, 2013 at 3:20 PM, Gleb Natapov g...@redhat.com wrote: On Sun, Jul 07, 2013 at 03:16:08PM +0800, Arthur Chunqi Li wrote: On Sun, Jul 7, 2013 at 2

[PATCH v3] KVM: nVMX: Fix read/write to MSR_IA32_FEATURE_CONTROL

2013-07-07 Thread Arthur Chunqi Li
of reset and migration. Reset to vCPU should clear this MSR and migration should reserve value of it. This patch is based on Nadav's previous commit. http://permalink.gmane.org/gmane.comp.emulators.kvm.devel/88478 Signed-off-by: Nadav Har'El nyh at il.ibm.com Signed-off-by: Arthur Chunqi Li yzt

[[Qemu-devel] [PATCH]] nVMX: Initialize IA32_FEATURE_CONTROL MSR in reset and migration

2013-07-07 Thread Arthur Chunqi Li
The recent KVM patch adds IA32_FEATURE_CONTROL support. QEMU needs to clear this MSR when reset vCPU and keep the value of it when migration. This patch add this feature. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- target-i386/cpu.h |2 ++ target-i386/kvm.c |4

[PATCH v4] KVM: nVMX: Fix read/write to MSR_IA32_FEATURE_CONTROL

2013-07-08 Thread Arthur Chunqi Li
...@math.technion.ac.il Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- arch/x86/kvm/vmx.c | 35 +-- arch/x86/kvm/x86.c |3 ++- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index a7e1855..1200e4e 100644

Registers need to recover when emulating L2 vmexit

2013-07-08 Thread Arthur Chunqi Li
are not accurately correspondence, e.g. GUEST_CS/ES..._BASE/LIMIT/AR. What will these MSRs be set? Thanks, Arthur -- Arthur Chunqi Li Department of Computer Science School of EECS Peking University Beijing, China -- To unsubscribe from this list: send the line unsubscribe kvm in the body

[PATCH] KVM: nVMX: Set segment infomation of L1 when L2 exits

2013-07-11 Thread Arthur Chunqi Li
Chunqi Li yzt...@gmail.com --- arch/x86/kvm/vmx.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 1200e4e..3cf702b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -8028,6 +8028,32 @@ static void

Re: [PATCH] KVM: nVMX: Set segment infomation of L1 when L2 exits

2013-07-11 Thread Arthur Chunqi Li
On Thu, Jul 11, 2013 at 5:43 PM, Gleb Natapov g...@redhat.com wrote: On Thu, Jul 11, 2013 at 05:06:04PM +0800, Arthur Chunqi Li wrote: When L2 exits to L1, segment infomations of L1 are not set correctly. According to Intel SDM 27.5.2(Loading Host Segment and Descriptor Table Registers

[PATCH v2] KVM: nVMX: Set segment infomation of L1 when L2 exits

2013-07-11 Thread Arthur Chunqi Li
Chunqi Li yzt...@gmail.com --- arch/x86/kvm/vmx.c | 43 ++- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index a7e1855..84acb16 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -7941,6

Re: [[Qemu-devel] [PATCH]] nVMX: Initialize IA32_FEATURE_CONTROL MSR in reset and migration

2013-07-14 Thread Arthur Chunqi Li
Hi Gleb and Paolo, What is the status of this patch since the relevant patch for KVM is accepted? These two patches must cooperate to fix the bug. Arthur On Sun, Jul 7, 2013 at 11:13 PM, Arthur Chunqi Li yzt...@gmail.com wrote: The recent KVM patch adds IA32_FEATURE_CONTROL support. QEMU needs

[PATCH v3] KVM: nVMX: Set segment infomation of L1 when L2 exits

2013-07-15 Thread Arthur Chunqi Li
Chunqi Li yzt...@gmail.com --- arch/x86/kvm/vmx.c | 58 +++- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 064d0be..0ea9614 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c

[PATCH v4] KVM: nVMX: Set segment infomation of L1 when L2 exits

2013-07-15 Thread Arthur Chunqi Li
Chunqi Li yzt...@gmail.com --- arch/x86/kvm/vmx.c | 55 ++-- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 064d0be..85b302b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c

[PATCH v5] KVM: nVMX: Set segment infomation of L1 when L2 exits

2013-07-15 Thread Arthur Chunqi Li
Chunqi Li yzt...@gmail.com --- arch/x86/kvm/vmx.c | 58 +++- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 064d0be..71eb55b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c

[PATCH] kvm-unit-tests : The first version of VMX nested test case

2013-07-16 Thread Arthur Chunqi Li
World to inform its successfully run. New files added: x86/vmx.h : contains all VMX related macro declerations x86/vmx.c : main file for VMX nested test case Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86-common.mak |2 + config-x86_64.mak |1 + lib/x86/msr.h

Re: [PATCH] kvm-unit-tests : The first version of VMX nested test case

2013-07-16 Thread Arthur Chunqi Li
occasions and the hypervisor can run if we simply ignore them. After all bugs fixed, everything will be OK. Arthur On Tue, Jul 16, 2013 at 5:27 PM, Arthur Chunqi Li yzt...@gmail.com wrote: This is the first version for VMX nested environment test case. It contains the basic VMX instructions test

Re: [PATCH] kvm-unit-tests : The first version of VMX nested test case

2013-07-16 Thread Arthur Chunqi Li
On Tue, Jul 16, 2013 at 5:45 PM, Gleb Natapov g...@redhat.com wrote: On Tue, Jul 16, 2013 at 05:35:16PM +0800, Arthur Chunqi Li wrote: Hi there, This is a version calling for comments. Some minor changes should be Add RFC before PATCH for such submission please. done before final commitment

Re: [PATCH] kvm-unit-tests : The first version of VMX nested test case

2013-07-16 Thread Arthur Chunqi Li
Hi Paolo, On Tue, Jul 16, 2013 at 6:28 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 16/07/2013 11:27, Arthur Chunqi Li ha scritto: This is the first version for VMX nested environment test case. It contains the basic VMX instructions test cases, including VMXON/ VMXOFF/VMXPTRLD/VMXPTRST

Re: [[Qemu-devel] [PATCH]] nVMX: Initialize IA32_FEATURE_CONTROL MSR in reset and migration

2013-07-16 Thread Arthur Chunqi Li
On Tue, Jul 16, 2013 at 7:42 PM, Gleb Natapov g...@redhat.com wrote: On Sun, Jul 07, 2013 at 11:13:37PM +0800, Arthur Chunqi Li wrote: The recent KVM patch adds IA32_FEATURE_CONTROL support. QEMU needs to clear this MSR when reset vCPU and keep the value of it when migration. This patch add

[PATCH v2 2/2] kvm-unit-tests : The first version of VMX nested test case

2013-07-16 Thread Arthur Chunqi Li
World to inform its successfully run. New files added: x86/vmx.h : contains all VMX related macro declerations x86/vmx.c : main file for VMX nested test case Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86-common.mak |2 + config-x86_64.mak |1 + lib/x86/msr.h

[PATCH v2 0/2] Basic nested VMX test suite

2013-07-16 Thread Arthur Chunqi Li
These two patches are focued on providing a basic version of VMX nested test suite. This commit provides the architecture of nested VMX similiar to x86/svm.c. setjmp/longjmp is designed to avoid exiting VMX in call-back form. Arthur Chunqi Li (2): kvm-unit-tests : Add setjmp/longjmp

[PATCH v2 1/2] kvm-unit-tests : Add setjmp/longjmp to libcflat

2013-07-16 Thread Arthur Chunqi Li
Add setjmp and longjmp functions to libcflat. Now these two functions are only supported in X86_64 arch. New files added: lib/x86/setjmp64.S lib/x86/setjmp64.c Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86_64.mak |2 ++ lib/x86/setjmp64.S | 27

Re: [PATCH] kvm-unit-tests : The first version of VMX nested test case

2013-07-16 Thread Arthur Chunqi Li
to easy to follow. As this is just a test case, I prefer this one. Besides, this way we can start another VM following the previous one simply in main function. This is flexible if we want to test re-enter to VMX mode or so. Arthur -- Gleb. -- Arthur Chunqi Li

[PATCH v3 0/2] Basic nested VMX test suite

2013-07-16 Thread Arthur Chunqi Li
These two patches are focued on providing a basic version of VMX nested test suite. This commit provides the architecture of nested VMX similiar to x86/svm.c. setjmp/longjmp is designed to avoid exiting VMX in call-back form. Arthur Chunqi Li (2): kvm-unit-tests : Add setjmp/longjmp

[PATCH v3 1/2] kvm-unit-tests : Add setjmp/longjmp to libcflat

2013-07-16 Thread Arthur Chunqi Li
Add setjmp and longjmp functions to libcflat. Now these two functions are only supported in X86_64 arch. New files added: lib/x86/setjmp64.S lib/x86/setjmp64.c Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86_64.mak |2 ++ lib/setjmp.h | 11

[PATCH v3 2/2] kvm-unit-tests : The first version of VMX nested test case

2013-07-16 Thread Arthur Chunqi Li
World to inform its successfully run. New files added: x86/vmx.h : contains all VMX related macro declerations x86/vmx.c : main file for VMX nested test case Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86-common.mak |2 + config-x86_64.mak |1 + lib/x86/msr.h

Re: [PATCH v3 0/2] Basic nested VMX test suite

2013-07-16 Thread Arthur Chunqi Li
On this commit, I delete two TODO lines in PATCH 2/2, and it can only run with all my previous patches. Arthur On Tue, Jul 16, 2013 at 11:58 PM, Arthur Chunqi Li yzt...@gmail.com wrote: These two patches are focued on providing a basic version of VMX nested test suite. This commit provides

Re: [PATCH] kvm-unit-tests : The first version of VMX nested test case

2013-07-16 Thread Arthur Chunqi Li
On Wed, Jul 17, 2013 at 12:45 AM, Gleb Natapov g...@redhat.com wrote: On Tue, Jul 16, 2013 at 11:29:20PM +0800, Arthur Chunqi Li wrote: On Tue, Jul 16, 2013 at 11:20 PM, Gleb Natapov g...@redhat.com wrote: On Tue, Jul 16, 2013 at 12:28:05PM +0200, Paolo Bonzini wrote: +void vmx_exit(void

[PATCH v4 0/2] Basic nested VMX test suite

2013-07-17 Thread Arthur Chunqi Li
from vmx_test. guest_regs. VM exit times can be read from vmx_test.exits. setjmp/longjmp is designed to avoid exiting VMX in call-back form. Arthur Chunqi Li (2): kvm-unit-tests : Add setjmp/longjmp to libcflat kvm-unit-tests : The first version of VMX nested test case config-x86-common.mak

[PATCH v4 1/2] kvm-unit-tests : Add setjmp/longjmp to libcflat

2013-07-17 Thread Arthur Chunqi Li
Add setjmp and longjmp functions to libcflat. Now these two functions are only supported in X86_64 arch. New files added: lib/x86/setjmp64.S lib/x86/setjmp64.c Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86_64.mak |2 ++ lib/setjmp.h | 11

[PATCH v4 2/2] kvm-unit-tests : The first version of VMX nested test case

2013-07-17 Thread Arthur Chunqi Li
World to inform its successfully run. New files added: x86/vmx.h : contains all VMX related macro declerations x86/vmx.c : main file for VMX nested test case Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86-common.mak |2 + config-x86_64.mak |1 + lib/x86/msr.h

Re: [PATCH v4 0/2] Basic nested VMX test suite

2013-07-17 Thread Arthur Chunqi Li
vmx_tests. GPR in guest can be read from vmx_test. guest_regs. VM exit times can be read from vmx_test.exits. setjmp/longjmp is designed to avoid exiting VMX in call-back form. Arthur Chunqi Li (2): kvm-unit-tests : Add setjmp/longjmp to libcflat kvm-unit-tests : The first version of VMX nested

Re: [PATCH v4 2/2] kvm-unit-tests : The first version of VMX nested test case

2013-07-17 Thread Arthur Chunqi Li
On Wed, Jul 17, 2013 at 2:26 PM, Jan Kiszka jan.kis...@web.de wrote: On 2013-07-17 08:05, Arthur Chunqi Li wrote: This is the first version for VMX nested environment test case. It contains the basic VMX instructions test cases, including VMXON/ VMXOFF/VMXPTRLD/VMXPTRST/VMCLEAR/VMLAUNCH

Re: [PATCH v4 0/2] Basic nested VMX test suite

2013-07-17 Thread Arthur Chunqi Li
with. Paolo -- Arthur Chunqi Li Department of Computer Science School of EECS Peking University Beijing, China -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[RFC PATCH] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-17 Thread Arthur Chunqi Li
nested test case Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86-common.mak |2 + config-x86_64.mak |1 + lib/x86/msr.h |5 + x86/cstart64.S|4 + x86/unittests.cfg |6 + x86/vmx.c | 681

Re: [RFC PATCH] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-18 Thread Arthur Chunqi Li
On Thu, Jul 18, 2013 at 8:08 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 18/07/2013 13:06, Gleb Natapov ha scritto: On Thu, Jul 18, 2013 at 12:47:46PM +0200, Paolo Bonzini wrote: and for a testsuite I'd prefer the latter---which means I'd still favor setjmp/longjmp. Now, here is the long

Re: [RFC PATCH] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-24 Thread Arthur Chunqi Li
. ;) I've put a smile there :) I realize this argument is not completely fair, but for the sake of argument everything goes! Yes, I caught the irony. ;) Paolo -- Arthur Chunqi Li Department of Computer Science School of EECS Peking University Beijing, China -- To unsubscribe from this list: send

Re: [RFC PATCH] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-24 Thread Arthur Chunqi Li
On Wed, Jul 24, 2013 at 2:40 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 24/07/2013 08:11, Arthur Chunqi Li ha scritto: static int vmx_run() { u32 eax; bool ret; vmcs_write(HOST_RSP, get_rsp()); ret = vmlaunch(); The compiler can still change rsp between here

Re: [RFC PATCH] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-24 Thread Arthur Chunqi Li
; default: printf(%s : unhandled ret from exit_handler.\n, __func__); break; } return 1; } On Wed, Jul 24, 2013 at 2:48 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 24/07/2013 08:46, Arthur Chunqi Li ha scritto: On Wed, Jul 24, 2013 at 2:40 PM, Paolo Bonzini pbonz

Re: [RFC PATCH] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-24 Thread Arthur Chunqi Li
wrote: Il 24/07/2013 10:48, Arthur Chunqi Li ha scritto: So as what Gleb said, what about the following codes: static int vmx_run2() { u32 eax; bool ret; asm volatile( mov %%rsp, %%rsi\n\t mov %2, %%edi\n\t call vmcs_write\n\t vmlaunch\n\t

Re: [RFC PATCH] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-24 Thread Arthur Chunqi Li
On Wed, Jul 24, 2013 at 6:03 PM, Jan Kiszka jan.kis...@web.de wrote: On 2013-07-24 11:56, Arthur Chunqi Li wrote: So what about this one. I merged all the exit reason to ret and remove the flag detection after vmlaunch/vmresume (because I think this detection is useless). Currently we support

Re: [RFC PATCH] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-24 Thread Arthur Chunqi Li
, Arthur Chunqi Li wrote: On Wed, Jul 24, 2013 at 6:03 PM, Jan Kiszka jan.kis...@web.de wrote: On 2013-07-24 11:56, Arthur Chunqi Li wrote: So what about this one. I merged all the exit reason to ret and remove the flag detection after vmlaunch/vmresume (because I think this detection is useless

[PATCH] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-24 Thread Arthur Chunqi Li
nested test case Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86-common.mak |2 + config-x86_64.mak |1 + lib/x86/msr.h |5 + x86/cstart64.S|4 + x86/unittests.cfg |6 + x86/vmx.c | 712

Re: [PATCH] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-25 Thread Arthur Chunqi Li
On Thu, Jul 25, 2013 at 4:11 PM, Jan Kiszka jan.kis...@web.de wrote: On 2013-07-25 07:31, Arthur Chunqi Li wrote: This is the first version of VMX nested environment. It contains the basic VMX instructions test cases, including VMXON/VMXOFF/VMXPTRLD/ VMXPTRST/VMCLEAR/VMLAUNCH/VMRESUME/VMCALL

[PATCH v2] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-25 Thread Arthur Chunqi Li
nested test case Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86-common.mak |2 + config-x86_64.mak |1 + lib/x86/msr.h |5 + x86/cstart64.S|4 + x86/unittests.cfg |6 + x86/vmx.c | 712

Re: [PATCH v2] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-28 Thread Arthur Chunqi Li
On Sun, Jul 28, 2013 at 6:53 PM, Gleb Natapov g...@redhat.com wrote: On Fri, Jul 26, 2013 at 12:32:55AM +0800, Arthur Chunqi Li wrote: This is the first version of VMX nested environment. It contains the basic VMX instructions test cases, including VMXON/VMXOFF/VMXPTRLD/ VMXPTRST/VMCLEAR

[PATCH v3] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-28 Thread Arthur Chunqi Li
nested test case Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- ChangeLog: 1. Refine codes in function vmx_run() 2. Fix bug of setting GUEST_RFLAGS 3. Move defines of selectors to lib/x86/vm.h 4. Move CR0/4 defines to lib/x86/vm.h, so as some defines in lib/x86/vm.c 5. Move some inline

Re: [PATCH v3] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-28 Thread Arthur Chunqi Li
be set in the framework code. Then I will wait for Paolo and Gleb's furthur feedback and commit the final patch. Arthur On Sun, Jul 28, 2013 at 10:00 PM, Arthur Chunqi Li yzt...@gmail.com wrote: This is the first version of VMX nested environment. It contains the basic VMX instructions test cases

Re: [PATCH v3] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-28 Thread Arthur Chunqi Li
On Sun, Jul 28, 2013 at 10:24 PM, Arthur Chunqi Li yzt...@gmail.com wrote: Hi Gleb, It suddenly occured to me that this patch also fails to handle GUEST_RFLAGS when VMRESUME. I decide to remove rflags in struct regs since rflags can be read and set via vmcs_read/vmcs_write in test suited

Re: [PATCH v3] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-30 Thread Arthur Chunqi Li
On Tue, Jul 30, 2013 at 4:07 PM, Gleb Natapov g...@redhat.com wrote: On Tue, Jul 30, 2013 at 09:59:47AM +0200, Marius Vlad wrote: Hi Gleb, On Tue, Jul 30, 2013 at 09:42:12AM +0200, Gleb Natapov wrote: On Tue, Jul 30, 2013 at 09:31:17AM +0200, Marius Vlad wrote: Hi Arthur, I'm

Re: [PATCH v3] kvm-unit-tests : Basic architecture of VMX nested test case

2013-07-30 Thread Arthur Chunqi Li
On Tue, Jul 30, 2013 at 10:53 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 28/07/2013 16:00, Arthur Chunqi Li ha scritto: + + while (1) { + asm volatile ( + mov %%rsp, %%rsi\n\t + mov %2, %%rdi\n\t + vmwrite

[PATCH] kvm-unit-tests: VMX: Fix confused definition of rflags

2013-07-30 Thread Arthur Chunqi Li
Change rflags in struct regs to host_rflags. Remove settings to GUEST_RFLAGS since GUEST_RFLAGS can be set by vmwrite. Treat host_rflags as host rflags before and after vmenter. Besides, add checks to flags after vmenter. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- x86/vmx.c | 11

Re: [PATCH] kvm-unit-tests: VMX: Fix confused definition of rflags

2013-07-30 Thread Arthur Chunqi Li
Since Paolo's advice is a small change and this is only a test suite, so I don't split these two and commit in one patch. On Tue, Jul 30, 2013 at 11:41 PM, Arthur Chunqi Li yzt...@gmail.com wrote: Change rflags in struct regs to host_rflags. Remove settings to GUEST_RFLAGS since GUEST_RFLAGS

[RFC PATCH] kvm-unit-tests: VMX: Reconstruct VMX codes to add new test suites

2013-07-30 Thread Arthur Chunqi Li
Reconstruct VMX codes, add new test suites in a subdirectory. New test suites locates in x86/nvmx/. Add an empty test suite ctrl_fields in x86/nvmx/. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86-common.mak |7 +-- x86/nvmx/ctrl_fields.c | 10 ++ x86/nvmx

Re: [RFC PATCH] kvm-unit-tests: VMX: Reconstruct VMX codes to add new test suites

2013-07-30 Thread Arthur Chunqi Li
, 2013 at 1:12 PM, Arthur Chunqi Li yzt...@gmail.com wrote: Reconstruct VMX codes, add new test suites in a subdirectory. New test suites locates in x86/nvmx/. Add an empty test suite ctrl_fields in x86/nvmx/. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86-common.mak |7

[PATCH] kvm-unit-tests: VMX: Split VMX test suites to separate file

2013-07-31 Thread Arthur Chunqi Li
Reconstruct VMX codes and put all VMX test suites in x86/vmx_tests.c. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86-common.mak |2 +- x86/vmx.c | 71 +++-- x86/vmx.h | 43

Re: [PATCH] KVM: nVMX: correctly set tr base on nested vmexit emulation

2013-08-04 Thread Arthur Chunqi Li
Yes, I have just retraced and found the bug. This is my negligence. Reviewed-by: Arthur Chunqi Li yzt...@gmail.com On Sun, Aug 4, 2013 at 8:08 PM, Gleb Natapov g...@redhat.com wrote: After commit 21feb4eb64e21f8dc91136b91ee886b978ce6421 tr base is zeroed during vmexit. Set it to L1's

Re: [PATCH] kvm-unit-tests: VMX: Split VMX test suites to separate file

2013-08-04 Thread Arthur Chunqi Li
On Mon, Aug 5, 2013 at 12:54 AM, Jan Kiszka jan.kis...@web.de wrote: On 2013-07-31 11:22, Arthur Chunqi Li wrote: Reconstruct VMX codes and put all VMX test suites in x86/vmx_tests.c. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- config-x86-common.mak |2 +- x86/vmx.c

[PATCH v2] kvm-unit-tests: VMX: Split VMX test suites to separate file

2013-08-04 Thread Arthur Chunqi Li
Reconstruct VMX codes and put all VMX test suites in x86/vmx_tests.c. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- ChangeLog to v1: Reassign places of global variants. Move vmx_tests to vmx_tests.c. config-x86-common.mak |2 +- x86/vmx.c | 108

Re: [PATCH v2] kvm-unit-tests: VMX: Split VMX test suites to separate file

2013-08-04 Thread Arthur Chunqi Li
On Mon, Aug 5, 2013 at 2:46 AM, Jan Kiszka jan.kis...@web.de wrote: On 2013-08-04 20:25, Gmail wrote: 在 2013-8-5,2:08,Jan Kiszka jan.kis...@web.de 写道: On 2013-08-04 20:04, Arthur Chunqi Li wrote: @@ -432,6 +432,22 @@ enum Ctrl1 { #define HYPERCALL_MASK0xFFF #define HYPERCALL_VMEXIT

Re: [PATCH] nVMX: Keep arch.pat in sync on L1-L2 switches

2013-08-04 Thread Arthur Chunqi Li
On Sun, Aug 4, 2013 at 11:17 PM, Jan Kiszka jan.kis...@web.de wrote: From: Jan Kiszka jan.kis...@siemens.com When asking vmx to load the PAT MSR for us while switching from L1 to L2 or vice versa, we have to update arch.pat as well as it may later be used again to load or read out the MSR

[PATCH v3] kvm-unit-tests: VMX: Split VMX test suites to separate file

2013-08-04 Thread Arthur Chunqi Li
Reconstruct VMX codes and put all VMX test suites in x86/vmx_tests.c. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- ChangeLog to v2: Remove some unused extern definitions in vmx.h. config-x86-common.mak |2 +- x86/vmx.c | 115

Re: KVM Test report, kernel bf640876... qemu 0779caeb...

2013-08-04 Thread Arthur Chunqi Li
On Fri, Aug 2, 2013 at 7:50 PM, Gleb Natapov g...@redhat.com wrote: On Fri, Aug 02, 2013 at 07:19:28AM +, Ren, Yongjie wrote: Hi All, This is KVM upstream test result against kvm.git next branch and qemu-kvm.git uq/master branch. kvm.git next branch:

Re: [PATCH 6/7] KVM: nVMX: Implement support for EFER saving on VM-exit

2013-08-05 Thread Arthur Chunqi Li
On Mon, Aug 5, 2013 at 1:49 AM, Jan Kiszka jan.kis...@web.de wrote: From: Jan Kiszka jan.kis...@siemens.com Implement and advertise VM_EXIT_SAVE_IA32_EFER. L0 traps EFER writes unconditionally, so we always find the current L2 value in the architectural state. Signed-off-by: Jan Kiszka

Re: [PATCH] kvm-unit-tests: VMX: Fix confused definition of rflags

2013-08-05 Thread Arthur Chunqi Li
On Mon, Aug 5, 2013 at 4:29 PM, Gleb Natapov g...@redhat.com wrote: On Tue, Jul 30, 2013 at 11:41:00PM +0800, Arthur Chunqi Li wrote: Change rflags in struct regs to host_rflags. Remove settings to GUEST_RFLAGS since GUEST_RFLAGS can be set by vmwrite. Treat host_rflags as host rflags before

[PATCH] KVM: nVMX: Advertise IA32_PAT in VM exit control

2013-08-05 Thread Arthur Chunqi Li
Advertise VM_EXIT_SAVE_IA32_PAT and VM_EXIT_LOAD_IA32_PAT. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- arch/x86/kvm/vmx.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 45fd70c..240f0db 100644 --- a/arch/x86/kvm

Re: [PATCH] KVM: nVMX: Advertise IA32_PAT in VM exit control

2013-08-05 Thread Arthur Chunqi Li
On Mon, Aug 5, 2013 at 6:55 PM, Gleb Natapov g...@redhat.com wrote: On Mon, Aug 05, 2013 at 12:38:32PM +0200, Jan Kiszka wrote: On 2013-08-05 11:36, Gmail wrote: On Mon, Aug 05, 2013 at 05:10:35PM +0800, Arthur Chunqi Li wrote: Advertise VM_EXIT_SAVE_IA32_PAT and VM_EXIT_LOAD_IA32_PAT

[PATCH v2] KVM: nVMX: Advertise IA32_PAT in VM exit control

2013-08-05 Thread Arthur Chunqi Li
Advertise VM_EXIT_SAVE_IA32_PAT and VM_EXIT_LOAD_IA32_PAT. Signed-off-by: Arthur Chunqi Li yzt...@gmail.com --- ChangeLog to v1: Add host features check. Format is the same as entry controls. arch/x86/kvm/vmx.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff

  1   2   3   >