Re: [PATCH] KMV: VMX: consult IA32_VMX_EPT_VPID_CAP to determine EPT paging-structure memory type

2010-03-22 Thread Sheng Yang
On Monday 22 March 2010 17:06:42 Gui Jianfeng wrote: According to SDM, we need to configure EPT paging-structure memory type by consulting IA32_VMX_EPT_VPID_CAP. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/include/asm/vmx.h |2 ++ arch/x86/kvm/vmx.c |

Re: Completing big real mode emulation

2010-03-24 Thread Sheng Yang
On Saturday 20 March 2010 23:00:49 Alexander Graf wrote: Am 20.03.2010 um 15:02 schrieb Mohammed Gamal m.gamal...@gmail.com: On Sat, Mar 20, 2010 at 3:18 PM, Avi Kivity a...@redhat.com wrote: On 03/20/2010 10:55 AM, Alexander Graf wrote: I'd say that a GSoC project would rather focus on

Re: MSI-X not enabled for ixgbe device-passthrough

2010-03-24 Thread Sheng Yang
On Wednesday 24 March 2010 23:54:15 Hannes Reinecke wrote: Hi all, I'm trying to setup a system with device-passthrough for an ixgbe NIC. The device itself seems to work, but it isn't using MSI-X. So some more advanced features like DCB offloading etc won't work. How about lspci result in

Re: [PATCH V3] perf kvm: Enhance perf to collect KVM guest os statistics from host side

2010-04-14 Thread Sheng Yang
On Wednesday 14 April 2010 17:20:15 Avi Kivity wrote: On 04/14/2030 12:05 PM, Zhang, Yanmin wrote: Here is the new patch of V3 against tip/master of April 13th if anyone wants to try it. Thanks for persisting despite the flames. Can you please separate arch/x86/kvm part of the patch?

Re: [PATCH V3] perf kvm: Enhance perf to collect KVM guest os statistics from host side

2010-04-14 Thread Sheng Yang
On Wednesday 14 April 2010 17:57:50 Avi Kivity wrote: On 04/14/2010 12:43 PM, Sheng Yang wrote: On Wednesday 14 April 2010 17:20:15 Avi Kivity wrote: On 04/14/2030 12:05 PM, Zhang, Yanmin wrote: Here is the new patch of V3 against tip/master of April 13th if anyone wants to try

Re: [PATCH V3] perf kvm: Enhance perf to collect KVM guest os statistics from host side

2010-04-14 Thread Sheng Yang
On Wednesday 14 April 2010 18:33:37 Avi Kivity wrote: On 04/14/2010 01:27 PM, Sheng Yang wrote: Yes, interesting to see what the latency is. If it's reasonably short (and I expect it will be so), we can do the busy wait solution. If we have an NMI counter somewhere, we can simply wait

Re: [PATCH V3] perf kvm: Enhance perf to collect KVM guest os statistics from host side

2010-04-15 Thread Sheng Yang
On Thursday 15 April 2010 18:44:15 Avi Kivity wrote: On 04/15/2010 01:40 PM, Joerg Roedel wrote: That means an NMI that happens outside guest code (for example, in the mmu, or during the exit itself) would be counted as if in guest code. Hmm, true. The same is true for an NMI that happens

Re: [PATCH V3] perf kvm: Enhance perf to collect KVM guest os statistics from host side

2010-04-19 Thread Sheng Yang
On Monday 19 April 2010 16:25:17 Avi Kivity wrote: On 04/17/2010 09:12 PM, Avi Kivity wrote: I think you were right the first time around. Re-reading again (esp. the part about treatment of indirect NMI vmexits), I think this was wrong, and that the code is correct. I am now thoroughly

[PATCH 2/4] KVM: Clean up duplicate assignment

2010-05-10 Thread Sheng Yang
mmu.free() already set root_hpa to INVALID_PAGE, no need to do it again in the destory_kvm_mmu(). kvm_x86_ops-set_cr4() and set_efer() already assign cr4/efer to vcpu-arch.cr4/efer, no need to do it again later. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/mmu.c |5

[PATCH 4/4] VMX: x86: Only reset MMU when necessary

2010-05-10 Thread Sheng Yang
Only modifying some bits of CR0/CR4 needs paging mode switch. Add update_rsvd_bits_mask() to address EFER.NX bit updating for reserved bits. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/kvm_host.h |1 + arch/x86/kvm/mmu.c | 17

[PATCH 3/4] KVM: x86: Remove kvm_mmu_reset_context() in kvm_set_efer()

2010-05-10 Thread Sheng Yang
Modify EFER won't result in mode switch directly. After EFER.LME set, the following set CR0.PG would result in mode switch to IA32e. And the later action already covered by kvm_set_cr0(). Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/x86.c |1 - 1 files changed, 0

[PATCH 1/4] KVM: x86: Check LMA bit before set_efer

2010-05-10 Thread Sheng Yang
kvm_x86_ops-set_efer() would execute vcpu-arch.efer = efer, so the checking of LMA bit didn't work. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/x86.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index

[PATCH 4/4] VMX: x86: Only reset MMU when necessary

2010-05-11 Thread Sheng Yang
Only modifying some bits of CR0/CR4 needs paging mode switch. Add update_rsvd_bits_mask() to address EFER.NX bit updating for reserved bits. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/kvm_host.h |1 + arch/x86/kvm/mmu.c | 17

[PATCH 1/4] KVM: x86: Check LMA bit before set_efer

2010-05-12 Thread Sheng Yang
kvm_x86_ops-set_efer() would execute vcpu-arch.efer = efer, so the checking of LMA bit didn't work. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/x86.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index

[PATCH 4/4] VMX: x86: Only reset MMU when necessary

2010-05-12 Thread Sheng Yang
Only modifying some bits of CR0/CR4 needs paging mode switch. Add update_rsvd_bits_mask() to address EFER.NX bit updating for reserved bits. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/kvm_host.h |1 + arch/x86/kvm/mmu.c | 17

[PATCH 3/4] KVM: x86: Remove kvm_mmu_reset_context() in kvm_set_efer()

2010-05-12 Thread Sheng Yang
Modify EFER won't result in mode switch directly. After EFER.LME set, the following set CR0.PG would result in mode switch to IA32e. And the later action already covered by kvm_set_cr0(). Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/x86.c |1 - 1 files changed, 0

[PATCH 2/4] KVM: Clean up duplicate assignment

2010-05-12 Thread Sheng Yang
mmu.free() already set root_hpa to INVALID_PAGE, no need to do it again in the destory_kvm_mmu(). kvm_x86_ops-set_cr4() and set_efer() already assign cr4/efer to vcpu-arch.cr4/efer, no need to do it again later. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/mmu.c |5

Re: [PATCH 4/4] VMX: x86: Only reset MMU when necessary

2010-05-12 Thread Sheng Yang
On Wednesday 12 May 2010 14:59:14 Avi Kivity wrote: On 05/12/2010 09:33 AM, Sheng Yang wrote: Only modifying some bits of CR0/CR4 needs paging mode switch. Add update_rsvd_bits_mask() to address EFER.NX bit updating for reserved bits. @@ -2335,6 +2335,19 @@ static void

[PATCH][v2 0/3] Some MMU related fix/clean up

2010-05-12 Thread Sheng Yang
Sheng Yang (3): KVM: x86: Check LMA bit before set_efer KVM: Clean up duplicate assignment VMX: x86: Only reset MMU when necessary arch/x86/kvm/mmu.c |5 ++--- arch/x86/kvm/x86.c | 22 -- 2 files changed, 18 insertions(+), 9 deletions(-) -- To unsubscribe from

[PATCH][v2 1/3] KVM: x86: Check LMA bit before set_efer

2010-05-12 Thread Sheng Yang
kvm_x86_ops-set_efer() would execute vcpu-arch.efer = efer, so the checking of LMA bit didn't work. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/x86.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index

[PATCH][v2 2/3] KVM: Clean up duplicate assignment

2010-05-12 Thread Sheng Yang
mmu.free() already set root_hpa to INVALID_PAGE, no need to do it again in the destory_kvm_mmu(). kvm_x86_ops-set_cr4() and set_efer() already assign cr4/efer to vcpu-arch.cr4/efer, no need to do it again later. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/mmu.c |5

[PATCH][v2 3/3] VMX: x86: Only reset MMU when necessary

2010-05-12 Thread Sheng Yang
Only modifying some bits of CR0/CR4 needs paging mode switch. Modify EFER.NXE bit would result in reserved bit updates. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/x86.c | 16 ++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm

[PATCH 2/3] x86: Export FPU API for KVM use

2010-05-13 Thread Sheng Yang
Also add some more constants. Signed-off-by: Sheng Yang sh...@linux.intel.com --- Do we need to rename task_xstate_cachep? It's not only for task struct now. arch/x86/include/asm/i387.h |2 ++ arch/x86/include/asm/xsave.h |3 +++ arch/x86/kernel/i387.c |3 ++- arch/x86

[PATCH 1/3] x86: Split fpu_save_init() to fpu_save() and fpu_clear()

2010-05-13 Thread Sheng Yang
fpu_save() would be used later by KVM. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/i387.h | 71 ++- 1 files changed, 43 insertions(+), 28 deletions(-) diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h

[PATCH 0/3] Convert KVM to use FPU API

2010-05-13 Thread Sheng Yang
This patchset based on Avi's FPU API patchset. Sheng Yang (3): x86: Split fpu_save_init() to fpu_save() and fpu_clear() x86: Export FPU API for KVM use KVM: x86: Use FPU API arch/x86/include/asm/i387.h | 73 --- arch/x86/include/asm/kvm_host.h

[PATCH 3/3] KVM: x86: Use FPU API

2010-05-13 Thread Sheng Yang
Convert KVM to use generic FPU API. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/kvm_host.h | 18 +- arch/x86/kvm/x86.c | 73 --- 2 files changed, 23 insertions(+), 68 deletions(-) diff --git a/arch/x86

[PATCH 3/3] KVM: x86: Use FPU API

2010-05-17 Thread Sheng Yang
Convert KVM to use generic FPU API. Signed-off-by: Sheng Yang sh...@linux.intel.com --- Like this? (Drop patch 1) arch/x86/include/asm/kvm_host.h | 18 +- arch/x86/kvm/x86.c | 70 ++- 2 files changed, 19 insertions(+), 69 deletions

Re: [PATCH 3/3] KVM: x86: Use FPU API

2010-05-17 Thread Sheng Yang
On Monday 17 May 2010 16:18:22 Avi Kivity wrote: On 05/17/2010 11:09 AM, Sheng Yang wrote: Convert KVM to use generic FPU API. Signed-off-by: Sheng Yangsh...@linux.intel.com --- Like this? (Drop patch 1) Will be more readable with a patch that converts host_fx_image to unlazy_fpu

[PATCH][v2 0/3] Convert KVM to use FPU API

2010-05-17 Thread Sheng Yang
Change from v1: Use unlazy_fpu() to handle host FPU, avoiding save/restore of host FPU states. Sheng Yang (3): x86: Export FPU API for KVM use KVM: x86: Use unlazy_fpu() for host FPU KVM: x86: Use FPU API arch/x86/include/asm/i387.h |2 + arch/x86/include/asm/kvm_host.h | 18

[PATCH][v2 3/3] KVM: x86: Use FPU API

2010-05-17 Thread Sheng Yang
Convert KVM to use generic FPU API. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/kvm_host.h | 17 + arch/x86/kvm/x86.c | 52 --- 2 files changed, 17 insertions(+), 52 deletions(-) diff --git a/arch/x86

[PATCH][v2 2/3] KVM: x86: Use unlazy_fpu() for host FPU

2010-05-17 Thread Sheng Yang
We can avoid unnecessary fpu load when userspace process didn't use FPU frequently. Derived from Avi's idea. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/kvm_host.h |1 - arch/x86/kvm/x86.c | 18 ++ 2 files changed, 2 insertions

Re: [PATCH][v2 1/3] x86: Export FPU API for KVM use

2010-05-17 Thread Sheng Yang
On Monday 17 May 2010 17:19:02 Avi Kivity wrote: On 05/17/2010 12:08 PM, Sheng Yang wrote: Also add some constants. +++ b/arch/x86/kernel/process.c @@ -28,6 +28,7 @@ unsigned long idle_nomwait; EXPORT_SYMBOL(idle_nomwait); struct kmem_cache *task_xstate_cachep

[PATCH][v2 1/3] x86: Export FPU API for KVM use

2010-05-17 Thread Sheng Yang
Also add some constants. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/i387.h |2 ++ arch/x86/include/asm/xsave.h |3 +++ arch/x86/kernel/i387.c |3 ++- arch/x86/kernel/process.c|1 + 4 files changed, 8 insertions(+), 1 deletions(-) diff

[PATCH] qemu-kvm: Enable xsave related CPUID

2010-05-19 Thread Sheng Yang
Signed-off-by: Sheng Yang sh...@linux.intel.com --- target-i386/cpuid.c | 32 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index eebf038..21e94f3 100644 --- a/target-i386/cpuid.c +++ b/target-i386

[PATCH v2] KVM: VMX: Enable XSAVE/XRSTORE for guest

2010-05-19 Thread Sheng Yang
@intel.com Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/kvm_host.h |1 + arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/vmx.c | 28 + arch/x86/kvm/x86.c | 85 +++--- 4 files changed, 108

[PATCH][v3] KVM: VMX: Enable XSAVE/XRSTORE for guest

2010-05-20 Thread Sheng Yang
. Signed-off-by: Dexuan Cui dexuan@intel.com Signed-off-by: Sheng Yang sh...@linux.intel.com --- Avi, could you help to review this kernel patch first? Testcase and LM are in progress now. arch/x86/include/asm/kvm_host.h |1 + arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/vmx.c

Re: [PATCH][v3] KVM: VMX: Enable XSAVE/XRSTORE for guest

2010-05-21 Thread Sheng Yang
On Thursday 20 May 2010 17:46:40 Avi Kivity wrote: On 05/20/2010 12:16 PM, Sheng Yang wrote: From: Dexuan Cuidexuan@intel.com Enable XSAVE/XRSTORE for guest. Change from V2: Addressed comments from Avi. Change from V1: 1. Use FPU API. 2. Fix CPUID issue. 3. Save

[PATCH v4] KVM: VMX: Enable XSAVE/XRSTORE for guest

2010-05-24 Thread Sheng Yang
API. 2. Fix CPUID issue. 3. Save/restore all possible guest xstate fields when switching. Because we don't know which fields guest has already touched. Signed-off-by: Dexuan Cui dexuan@intel.com Signed-off-by: Sheng Yang sh...@linux.intel.com --- I am still not clear about why we need to reload

Re: [PATCH v4] KVM: VMX: Enable XSAVE/XRSTORE for guest

2010-05-25 Thread Sheng Yang
On Monday 24 May 2010 21:36:12 Avi Kivity wrote: On 05/24/2010 01:03 PM, Sheng Yang wrote: From: Dexuan Cuidexuan@intel.com Enable XSAVE/XRSTORE for guest. Change from V3: 1. Enforced the assumption that host OS would use all available xstate bits. 2. Various fixes, addressed

[PATCH v5] KVM: VMX: Enable XSAVE/XRSTORE for guest

2010-05-26 Thread Sheng Yang
Signed-off-by: Sheng Yang sh...@linux.intel.com --- I've done a prototype of LM support, would send out tomorrow. But the test case in QEmu side seems got something wrong. I always got an segfault at: qemu-kvm/hw/fw_cfg.c:223 223 s-entries[arch][key].data = data; Haven't looked into it yet

[PATCH v6] KVM: x86: Enable XSAVE/XRSTOR for guest

2010-05-27 Thread Sheng Yang
Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/kvm_host.h |2 + arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/kvm_cache_regs.h |6 ++ arch/x86/kvm/vmx.c | 16 + arch/x86/kvm/x86.c | 120

[PATCH] KVM: x86: XSAVE/XRSTOR live migration support

2010-05-27 Thread Sheng Yang
This patch enable save/restore of xsave state. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/kvm.h | 29 arch/x86/kvm/x86.c | 79 include/linux/kvm.h|6 +++ 3 files changed, 114

[PATCH] qemu: Enable XSAVE related CPUID

2010-05-27 Thread Sheng Yang
We can support it in KVM now. The initial values are the minimal requirement of XSAVE capable processor. Signed-off-by: Sheng Yang sh...@linux.intel.com --- target-i386/cpuid.c | 32 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/target-i386

[PATCH] qemu: kvm: Enable XSAVE live migration support

2010-05-27 Thread Sheng Yang
Signed-off-by: Sheng Yang sh...@linux.intel.com --- qemu-kvm-x86.c| 77 + qemu-kvm.c| 12 +++ qemu-kvm.h| 14 + target-i386/cpu.h |5 +++ target-i386/machine.c | 20 + 5 files

Re: [PATCH v6] KVM: x86: Enable XSAVE/XRSTOR for guest

2010-05-27 Thread Sheng Yang
On Thursday 27 May 2010 17:52:36 Avi Kivity wrote: On 05/27/2010 12:47 PM, Sheng Yang wrote: From: Dexuan Cuidexuan@intel.com This patch enable guest to use XSAVE/XRSTOR instructions. We assume that host_xcr0 would use all possible bits that OS supported. And we loaded xcr0

Re: [PATCH] KVM: x86: XSAVE/XRSTOR live migration support

2010-05-27 Thread Sheng Yang
On Thursday 27 May 2010 18:02:31 Avi Kivity wrote: On 05/27/2010 12:48 PM, Sheng Yang wrote: This patch enable save/restore of xsave state. Signed-off-by: Sheng Yangsh...@linux.intel.com --- arch/x86/include/asm/kvm.h | 29 arch/x86/kvm/x86.c | 79

Re: [PATCH] qemu: Enable XSAVE related CPUID

2010-05-27 Thread Sheng Yang
On Thursday 27 May 2010 20:56:17 Avi Kivity wrote: On 05/27/2010 12:50 PM, Sheng Yang wrote: We can support it in KVM now. The initial values are the minimal requirement of XSAVE capable processor. Signed-off-by: Sheng Yangsh...@linux.intel.com --- target-i386/cpuid.c | 32

[PATCH] test: Add XSAVE unit test

2010-05-31 Thread Sheng Yang
Only test legal action so far, we can extend it later. Signed-off-by: Sheng Yang sh...@linux.intel.com --- kvm/test/config-x86-common.mak |5 +- kvm/test/x86/xsave.c | 173 2 files changed, 177 insertions(+), 1 deletions(-) create mode

Re: [PATCH] KVM: x86: XSAVE/XRSTOR live migration support

2010-05-31 Thread Sheng Yang
On Thursday 27 May 2010 18:02:31 Avi Kivity wrote: On 05/27/2010 12:48 PM, Sheng Yang wrote: This patch enable save/restore of xsave state. Signed-off-by: Sheng Yangsh...@linux.intel.com --- arch/x86/include/asm/kvm.h | 29 arch/x86/kvm/x86.c | 79

[PATCH v7] KVM: VMX: Enable XSAVE/XRSTOR for guest

2010-05-31 Thread Sheng Yang
Signed-off-by: Sheng Yang sh...@linux.intel.com --- Change from v6: Make kvm_set_xcr() generically. arch/x86/include/asm/kvm_host.h |2 + arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/kvm_cache_regs.h |6 ++ arch/x86/kvm/vmx.c | 13 arch/x86/kvm/x86.c

[PATCH 1/2] qemu: kvm: Extend kvm_arch_get_supported_cpuid() to support index

2010-05-31 Thread Sheng Yang
Would use it later for XSAVE related CPUID. Signed-off-by: Sheng Yang sh...@linux.intel.com --- kvm.h |2 +- qemu-kvm-x86.c|8 target-i386/kvm.c | 19 +++ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/kvm.h b/kvm.h index

[PATCH 2/2] qemu: Enable XSAVE related CPUID

2010-05-31 Thread Sheng Yang
We can support it in KVM now. The 0xd leaf is queried from KVM. Signed-off-by: Sheng Yang sh...@linux.intel.com --- target-i386/cpuid.c | 21 + 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index eebf038..ec47950

Re: [PATCH] test: Add XSAVE unit test

2010-06-01 Thread Sheng Yang
On Tuesday 01 June 2010 16:51:05 Avi Kivity wrote: On 05/31/2010 02:17 PM, Sheng Yang wrote: Only test legal action so far, we can extend it later. The legal actions are tested by guests, so it's more important for unit tests to check illegal (and potentially subversive) actions. Yes

[PATCH] KVM: VMX: Enforce EPT pagetable level checking

2010-06-02 Thread Sheng Yang
We only support 4 levels EPT pagetable now. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/vmx.c |8 +++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 99ae513..d400fbb 100644 --- a/arch/x86/kvm/vmx.c +++ b

Re: [PATCH] KVM VMX: Make sure single type invvpid is supported before issuing this instruction

2010-06-03 Thread Sheng Yang
On Thursday 03 June 2010 16:44:34 Gui Jianfeng wrote: According to SDM, we need check whether single-context INVVPID type is supported before issuing invvpid instruction. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/include/asm/vmx.h |2 ++ arch/x86/kvm/vmx.c

Re: [PATCH v2] KVM VMX: Make sure single type invvpid is supported before issuing invvpid instruction

2010-06-03 Thread Sheng Yang
On Thursday 03 June 2010 17:45:22 Gui Jianfeng wrote: According to SDM, we need check whether single-context INVVPID type is supported before issuing invvpid instruction. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/include/asm/vmx.h |2 ++ arch/x86/kvm/vmx.c

Re: [PATCH v3] KVM VMX: Make sure single type invvpid is supported before issuing invvpid instruction

2010-06-03 Thread Sheng Yang
On Friday 04 June 2010 08:51:39 Gui Jianfeng wrote: According to SDM, we need check whether single-context INVVPID type is supported before issuing invvpid instruction. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com Reviewed-by: Sheng Yang sh...@linux.intel.com -- regards Yang

Re: KVM: VMX: remove GUEST_CR3 write from vmx_vcpu_run

2009-10-22 Thread Sheng Yang
On Tuesday 20 October 2009 20:37:20 Marcelo Tosatti wrote: GUEST_CR3 is updated via kvm_set_cr3 whenever CR3 value changes. The description is not that accuracy... If CR3 value change in guest when EPT enabled, no VM Exit would happen, then no kvm_set_cr3... -- regards Yang, Sheng

[PATCH 1/1] Fix unable to detect libpci

2009-11-12 Thread Sheng Yang
commit 75fe7882 Test for libpci, not only for header compile a libpci test file. But the pciutils with defined PCI_COMPRESSED_IDS also need zlib when compile, otherwise the compile would fail, and detection fail then CC: Juan Quintela quint...@redhat.com Signed-off-by: Sheng Yang sh

[PATCH 1/1] Fix null DESTDIR in depmod execution

2009-11-12 Thread Sheng Yang
commit 52ea5897fa9fdadf0cc1a5242a23ce3dab599769 Use DESTDIR consitently on installation add -b ${DESTDIR} to depmod. But the DESTDIR is default NULL, then depmod would report error. Set DESTDIR=/ as default Signed-off-by: Sheng Yang sh...@linux.intel.com --- Makefile |2 +- 1 files changed

[PATCH] qemu-kvm: Fix INTx assigned device can't work bug

2009-11-24 Thread Sheng Yang
don't use INTx these days...) CC: Gerd Hoffmann kra...@redhat.com Signed-off-by: Sheng Yang sh...@linux.intel.com --- hw/device-assignment.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index 516cf14..64f3dc2 100644 --- a/hw

[PATCH] qemu-kvm: Fix assigned device config space

2009-11-26 Thread Sheng Yang
The new pci_dev-dev.config is a uint_8 pointer, but get_real_device() still using sizeof(pci_dev-dev.config) to fill the configuration space, which lost most of information. Spot the issue when INTx cannot work again after previous fix... Signed-off-by: Sheng Yang sh...@linux.intel.com --- hw

[PATCH] KVM: VMX: Disable unrestricted guest when EPT disabled

2009-11-27 Thread Sheng Yang
Otherwise would cause VMEntry failure when using ept=0 on unrestricted guest supported processors. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/vmx.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index

[PATCH] KVM: Fix possible circular locking in kvm_vm_ioctl_assign_device()

2009-12-07 Thread Sheng Yang
One possible order is: KVM_CREATE_IRQCHIP ioctl(took kvm-lock) - kvm_iobus_register_dev() - down_write(kvm-slots_lock). The other one is in kvm_vm_ioctl_assign_device(), which take kvm-slots_lock first, then kvm-lock. Observe it due to kernel locking debug warnings. Signed-off-by: Sheng Yang

Re: [PATCH 2/4] KVM: Add accessor for reading cr4 (or some bits of cr4)

2009-12-07 Thread Sheng Yang
On Monday 07 December 2009 18:47:10 Avi Kivity wrote: Some bits of cr4 can be owned by the guest on vmx, so when we read them, we copy them to the vcpu structure. In preparation for making the set of guest-owned bits dynamic, use helpers to access these bits so we don't need to know where the

Re: [PATCH 2/4] KVM: Add accessor for reading cr4 (or some bits of cr4)

2009-12-08 Thread Sheng Yang
On Tue, Dec 08, 2009 at 11:36:59AM +0200, Avi Kivity wrote: On 12/08/2009 09:57 AM, Sheng Yang wrote: vcpu-arch.cr0 = cr0; - vmx_set_cr4(vcpu, vcpu-arch.cr4); + vmx_set_cr4(vcpu, kvm_read_cr4(vcpu)); } Another place accessed cr4 directly, in ept_update_paging_mode_cr4

[PATCH] KVM: VMX: Add instruction rdtscp support for guest

2009-12-09 Thread Sheng Yang
Before enabling, execution of rdtscp in guest would result in #UD. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/vmx.c |3 ++- 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86

Re: [PATCH] KVM: VMX: Add instruction rdtscp support for guest

2009-12-09 Thread Sheng Yang
On Wednesday 09 December 2009 17:54:46 Avi Kivity wrote: On 12/09/2009 11:11 AM, Sheng Yang wrote: Before enabling, execution of rdtscp in guest would result in #UD. Signed-off-by: Sheng Yangsh...@linux.intel.com --- arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/vmx.c

Re: [PATCH 1/2] KVM: Discard shadow_mt_mask

2009-12-11 Thread Sheng Yang
On Mon, Apr 27, 2009 at 05:47:44PM +0800, Sheng Yang wrote: mt_mask is out of date, now it have only been used as a flag to indicate if TDP enabled. Get rid of it and use tdp_enabled instead. I realized this one break NPT on my way home... Would update the patches soon. -- regards Yang

Re: [PATCH] KVM: Fix possible circular locking in kvm_vm_ioctl_assign_device()

2009-12-13 Thread Sheng Yang
On Monday 07 December 2009 16:58:04 Sheng Yang wrote: One possible order is: KVM_CREATE_IRQCHIP ioctl(took kvm-lock) - kvm_iobus_register_dev() - down_write(kvm-slots_lock). The other one is in kvm_vm_ioctl_assign_device(), which take kvm-slots_lock first, then kvm-lock. Observe

[PATCH] KVM: VMX: Trap and invalid MWAIT/MONITOR instruction

2009-12-14 Thread Sheng Yang
We don't support these instructions, but guest can execute them even if the feature('monitor') haven't been exposed in CPUID. So we would trap and inject a #UD if guest try this way. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/vmx.c

[PATCH] KVM: VMX: Trap and invalid MWAIT/MONITOR instruction

2009-12-14 Thread Sheng Yang
We don't support these instructions, but guest can execute them even if the feature('monitor') haven't been exposed in CPUID. So we would trap and inject a #UD if guest try this way. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/vmx.c

[PATCH 0/4] Add support for RDTSCP in VMX

2009-12-15 Thread Sheng Yang
After discussion with Avi, we decided to take this chance to extend the shared MSR framework, discard the limitation of All CPU should have same value for the MSRs. But the limitation of The MSRs' value shouldn't be modified after they were read still apply. I have tested this patchset using

[PATCH 1/4] KVM: VMX: Remove redundant variable

2009-12-15 Thread Sheng Yang
It's no longer necessary. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/vmx.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9a0a2cf..5c464ed 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c

[PATCH 3/4] x86: Add IA32_TSC_AUX MSR

2009-12-15 Thread Sheng Yang
Also replaced the hardcode value in write_tsc() and write_tscp_aux(). CC: Ingo Molnar mi...@elte.hu Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/msr-index.h |1 + arch/x86/include/asm/msr.h |4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff

[PATCH 2/4] KVM: Extended shared_msr_global to per CPU

2009-12-15 Thread Sheng Yang
the shared_msr_global still have one assumption: it can only deal with the MSRs that won't change in host after KVM module loaded. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/x86.c | 64 ++-- 1 files changed, 42 insertions(+), 22

[PATCH 4/4] KVM: VMX: Add instruction rdtscp support for guest

2009-12-15 Thread Sheng Yang
Before enabling, execution of rdtscp in guest would result in #UD. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/kvm_host.h |1 + arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/svm.c |6 ++ arch/x86/kvm/vmx.c | 31

[PATCH 2/4] KVM: Extended shared_msr_global to per CPU

2009-12-17 Thread Sheng Yang
the shared_msr_global still have one assumption: it can only deal with the MSRs that won't change in host after KVM module loaded. Signed-off-by: Sheng Yang sh...@linux.intel.com --- How about this? Move the all initialization to hardware_enable(). And only initialized once for each cpu. arch/x86/kvm

[PATCH 4/4] KVM: VMX: Add instruction rdtscp support for guest

2009-12-17 Thread Sheng Yang
Before enabling, execution of rdtscp in guest would result in #UD. Signed-off-by: Sheng Yang sh...@linux.intel.com --- Reflect guest CPUID on vmcs fields as well, but it involved some more code which would only executed once... Do we need a callback there for post-cpuid setting? arch/x86

Re: [PATCH 4/4] KVM: VMX: Add instruction rdtscp support for guest

2009-12-17 Thread Sheng Yang
On Thursday 17 December 2009 18:39:22 Avi Kivity wrote: On 12/17/2009 11:33 AM, Sheng Yang wrote: Before enabling, execution of rdtscp in guest would result in #UD. Signed-off-by: Sheng Yangsh...@linux.intel.com --- Reflect guest CPUID on vmcs fields as well, but it involved some more

Re: [PATCH 2/4] KVM: Extended shared_msr_global to per CPU

2009-12-17 Thread Sheng Yang
On Thursday 17 December 2009 18:32:08 Avi Kivity wrote: On 12/17/2009 11:32 AM, Sheng Yang wrote: shared_msr_global saved host value of relevant MSRs, but it have an assumption that all MSRs it tracked shared the value across the different CPUs. It's not true with some MSRs, e.g

[PATCH 0/6 v2] Add support for RDTSCP in VMX

2009-12-18 Thread Sheng Yang
-- regards Yang, Sheng arch/x86/include/asm/kvm_host.h |2 + arch/x86/include/asm/msr-index.h |1 + arch/x86/include/asm/msr.h |4 +- arch/x86/include/asm/vmx.h |1 + arch/x86/kernel/vsyscall_64.c|3 +- arch/x86/kvm/svm.c | 13 +++

[PATCH 1/6] KVM: VMX: Remove redundant variable

2009-12-18 Thread Sheng Yang
It's no longer necessary. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/vmx.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9a0a2cf..5c464ed 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c

[PATCH 2/6] x86: Add IA32_TSC_AUX MSR

2009-12-18 Thread Sheng Yang
Also replaced the hardcode value in write_tsc() and write_tscp_aux(). Signed-off-by: Sheng Yang sh...@linux.intel.com --- (Already applied by Ingo) arch/x86/include/asm/msr-index.h |1 + arch/x86/include/asm/msr.h |4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff

[PATCH 3/6] KVM: Extended shared_msr_global to per CPU

2009-12-18 Thread Sheng Yang
the shared_msr_global still have one assumption: it can only deal with the MSRs that won't change in host after KVM module loaded. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/kvm/x86.c | 55 +++ 1 files changed, 33 insertions(+), 22

[PATCH 4/6] x86: Raise vsyscall priority on hotplug notifier chain

2009-12-18 Thread Sheng Yang
KVM need vsyscall_init() to initialize MSR_TSC_AUX before it read the value. Per Avi's suggestion, this patch raised vsyscall priority on hotplug notifier chain, to 30. CC: Ingo Molnar mi...@elte.hu CC: linux-ker...@vger.kernel.org Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86

[PATCH 5/6] KVM: Add cpuid_update() callback to kvm_x86_ops

2009-12-18 Thread Sheng Yang
Sometime, we need to adjust some state in order to reflect guest CPUID setting, e.g. if we don't expose rdtscp to guest, we won't want to enable it on hardware. cpuid_update() is introduced for this purpose. Also export kvm_find_cpuid_entry() for later use. Signed-off-by: Sheng Yang sh

[PATCH 6/6] KVM: VMX: Add instruction rdtscp support for guest

2009-12-18 Thread Sheng Yang
Before enabling, execution of rdtscp in guest would result in #UD. Signed-off-by: Sheng Yang sh...@linux.intel.com --- arch/x86/include/asm/kvm_host.h |1 + arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/svm.c |7 arch/x86/kvm/vmx.c | 60

Re: [PATCH qemu-kvm] device assignment: default requires IOMMU

2009-12-23 Thread Sheng Yang
On Thursday 24 December 2009 14:51:23 Simon Horman wrote: On Thu, Dec 24, 2009 at 01:45:34AM +0100, Alexander Graf wrote: Am 23.12.2009 um 23:40 schrieb Chris Wright chr...@sous-sol.org: [ resend, fixing email header, sorry for duplicate ] The default mode for device assignment is to

Re: [patch 00/11] convert slotslock to SRCU v2

2009-12-24 Thread Sheng Yang
On Thursday 24 December 2009 22:56:38 Gleb Natapov wrote: On Thu, Dec 24, 2009 at 10:30:24AM +0200, Avi Kivity wrote: On 12/23/2009 06:35 PM, Marcelo Tosatti wrote: Addressing comments. Looks good. Looks good to me too. One small comment on the naming: kvm-memslots-memslots[i]

Re: [patch 0/3] fix PIT injection

2008-07-30 Thread Sheng Yang
(Sorry, forgot to switch to plain text in Gmail, rejected by vger.kernel.org...) On Wed, Jul 30, 2008 at 10:15 PM, Marcelo Tosatti [EMAIL PROTECTED] wrote: Hi Dor, On Wed, Jul 30, 2008 at 12:50:06AM +0300, Dor Laor wrote: Marcelo Tosatti wrote: The in-kernel PIT emulation can either inject

[PATCH] KVM: VMX: Add MTRR support for EPT

2008-09-08 Thread Sheng Yang
Signed-off-by: Sheng Yang [EMAIL PROTECTED] --- arch/x86/kvm/mmu.c | 115 +++- arch/x86/kvm/svm.c |6 ++ arch/x86/kvm/vmx.c | 24 - arch/x86/kvm/x86.c |2 +- include/asm-x86/kvm_host.h |3 +- 5 files

[PATCH] KVM: VMX: Allocate MSR Bitmap for each vcpu

2008-09-08 Thread Sheng Yang
Separate msr_bitmap for each vcpu, prepared for guest PAT support. Signed-off-by: Sheng Yang [EMAIL PROTECTED] --- arch/x86/kvm/vmx.c | 53 +-- 1 files changed, 30 insertions(+), 23 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm

[PATCH 0/4] Memory type support for EPT

2008-09-08 Thread Sheng Yang
Hi, Avi This patchset add memory type support for EPT, including MTRR and PAT. The patch restruct the MTRR structure to make it easy to use, also take host kernel MTRR as a reference. The function guest_mtrr_type_lookup() is copied from host kernel rather than reuse, for I think it may be much

[PATCH 2/3] KVM: VMX: Rename IA32_FEATURE_CONTROL bits

2008-09-11 Thread Sheng Yang
Signed-off-by: Sheng Yang [EMAIL PROTECTED] --- arch/x86/kvm/vmx.c | 18 +- arch/x86/kvm/vmx.h |4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 81c121c..7b41241 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch

[PATCH 3/3] x86: Move FEATURE_CONTROL bits to msr-index.h

2008-09-11 Thread Sheng Yang
For MSR_IA32_FEATURE_CONTROL is already there. Signed-off-by: Sheng Yang [EMAIL PROTECTED] --- arch/x86/kvm/vmx.h |3 --- include/asm-x86/msr-index.h |3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx.h b/arch/x86/kvm/vmx.h index cef2dd8

[PATCH 1/3] x86: Move VMX MSRs to msr-index.h

2008-09-11 Thread Sheng Yang
They are hardware specific MSRs, and we would use them in virtualization feature detection later. Signed-off-by: Sheng Yang [EMAIL PROTECTED] --- arch/x86/kvm/vmx.h | 15 --- include/asm-x86/msr-index.h | 16 2 files changed, 16 insertions(+), 15

[PATCH 1/4] Separate update irq to a single function

2008-09-25 Thread Sheng Yang
Signed-off-by: Sheng Yang [EMAIL PROTECTED] --- arch/x86/kvm/x86.c | 78 1 files changed, 42 insertions(+), 36 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index b9d15f7..43fb049 100644 --- a/arch/x86/kvm/x86.c +++ b

[PATCH 0/4] Enable MSI support for KVM VT-d

2008-09-25 Thread Sheng Yang
Hi, Avi This patchset enable MSI support for KVM VT-d. And here are only kernel space ones. The third patch would go to also goto x86 upstream. The userspace code would looks like this: assigned_irq_data.guest_msi_addr = *(uint32_t *)(d-msi_cap + 4); assigned_irq_data.guest_msi_data =

[PATCH 2/4] KVM: x86: Replace irq_requested with guest_intr_type

2008-09-25 Thread Sheng Yang
Signed-off-by: Sheng Yang [EMAIL PROTECTED] --- arch/x86/kvm/x86.c |8 include/linux/kvm_host.h |3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 43fb049..4836323 100644 --- a/arch/x86/kvm/x86.c +++ b/arch

  1   2   3   4   5   6   7   8   9   10   >