[PATCH 1/2] KVM VMX: Add all-context INVVPID type support

2010-06-06 Thread Gui Jianfeng
Add all-context INVVPID type support. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/vmx.c | 23 +-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86

[PATCH 2/2] KVM VMX: rename vpid_sync_vcpu_all() to vpid_sync_vcpu_single()

2010-06-06 Thread Gui Jianfeng
The name pid_sync_vcpu_all isn't appropriate since it just affect a single vpid, so rename it to vpid_sync_vcpu_single(). Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/vmx.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b

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

2010-06-03 Thread Gui Jianfeng
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 |8 +++- 2 files changed, 9 insertions(+), 1

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

2010-06-03 Thread Gui Jianfeng
Sheng Yang wrote: 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

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

2010-06-03 Thread Gui Jianfeng
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 | 14 +- 2 files changed, 15 insertions

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

2010-06-03 Thread Gui Jianfeng
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 |8 +++- 2 files changed, 9 insertions(+), 1

[PATCH] kvm mmu: Don't calculate quadrant if tdp_enabled.

2010-05-31 Thread Gui Jianfeng
There's no need to calculate quadrant if tdp is enabled. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/mmu.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 0bb9f17..431863b 100644 --- a/arch/x86

[PATCH] kvm mmu: optimizations when tdp is in use

2010-05-27 Thread Gui Jianfeng
In case of using tdp, checking write protected page isn't needed and quadrant also no need to be calculated. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/mmu.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86

[PATCH] kvm mmu: don't check PT_WRITABLE_MASK directly

2010-05-27 Thread Gui Jianfeng
Since we have is_writable_pte(), make use of it. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/mmu.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index ce4bbd3..441a5d8 100644 --- a/arch/x86/kvm

Re: [PATCH] kvm mmu: optimizations when tdp is in use

2010-05-27 Thread Gui Jianfeng
Marcelo Tosatti wrote: On Thu, May 27, 2010 at 04:06:34PM +0800, Gui Jianfeng wrote: In case of using tdp, checking write protected page isn't needed and quadrant also no need to be calculated. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/mmu.c |7 +-- 1

[PATCH] KVM: update mmu documetation for role.nxe.

2010-05-11 Thread Gui Jianfeng
There's no member cr4_nxe in struct kvm_mmu_page_role, it names nxe now. Update mmu document. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- Documentation/kvm/mmu.txt |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Documentation/kvm/mmu.txt b/Documentation

Re: [PATCH] KVM: make kvm_mmu_zap_page() return the number of pages it actually freed.

2010-05-06 Thread Gui Jianfeng
Avi Kivity wrote: On 05/05/2010 04:03 AM, Gui Jianfeng wrote: Currently, kvm_mmu_zap_page() returning the number of freed children sp. This might confuse the caller, because caller don't know the actual freed number. Let's make kvm_mmu_zap_page() return the number of pages it actually freed

Re: [PATCH 1/3 v2] KVM MMU: make kvm_mmu_zap_page() return the number of zapped sp in total.

2010-05-04 Thread Gui Jianfeng
Marcelo Tosatti wrote: On Mon, May 03, 2010 at 09:38:54PM +0800, Gui Jianfeng wrote: Hi Marcelo Actually, it doesn't only affect kvm_mmu_change_mmu_pages() but also affects kvm_mmu_remove_some_alloc_mmu_pages() which is called by mmu shrink routine. This will induce upper layer get

[PATCH] KVM: make kvm_mmu_zap_page() return the number of pages it actually freed.

2010-05-04 Thread Gui Jianfeng
Currently, kvm_mmu_zap_page() returning the number of freed children sp. This might confuse the caller, because caller don't know the actual freed number. Let's make kvm_mmu_zap_page() return the number of pages it actually freed. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch

[PATCH] KVM: mark page dirty when page is actually modified.

2010-05-04 Thread Gui Jianfeng
Sometime cmpxchg_gpte doesn't modify gpte, in such case, don't mark page table page as dirty. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/paging_tmpl.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86

[PATCH] KVM: Fix debug output error

2010-05-04 Thread Gui Jianfeng
Fix a debug output error in walk_addr Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/paging_tmpl.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 89d66ca..d2c5164 100644 --- a/arch

Re: [PATCH 1/3 v2] KVM MMU: make kvm_mmu_zap_page() return the number of zapped sp in total.

2010-05-03 Thread Gui Jianfeng
Marcelo Tosatti wrote: On Fri, Apr 23, 2010 at 01:58:22PM +0800, Gui Jianfeng wrote: Currently, in kvm_mmu_change_mmu_pages(kvm, page), used_pages-- is performed after calling kvm_mmu_zap_page() in spite of that whether page is actually reclaimed. Because root sp won't be reclaimed

[PATCH] KVM: Fix mmu shrinker error

2010-04-26 Thread Gui Jianfeng
kvm_mmu_remove_one_alloc_mmu_page() assumes kvm_mmu_zap_page() only reclaims only one sp, but that's not the case. This will cause mmu shrinker returns a wrong number. This patch fix the counting error. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/mmu.c | 10

Re: [PATCH 3/3] KVM MMU: Take sp level into account when calculating quadran

2010-04-23 Thread Gui Jianfeng
Gui Jianfeng wrote: Take sp level into account when calculating quadrant, because only when level == PT_PAGE_TABLE_LEVEL, quadrant is needed. Please ignore this patch, Sorry for the noise. Gui Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/mmu.c |3 ++- 1

[PATCH 2/3] KVM MMU: fix sp-unsync type error in trace event definition.

2010-04-22 Thread Gui Jianfeng
sp-unsync is bool now, so update trace event declaration. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/mmutrace.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/mmutrace.h b/arch/x86/kvm/mmutrace.h index 3851f1f..9966e80 100644

[PATCH 3/3] KVM MMU: Take sp level into account when calculating quadran

2010-04-22 Thread Gui Jianfeng
Take sp level into account when calculating quadrant, because only when level == PT_PAGE_TABLE_LEVEL, quadrant is needed. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/mmu.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/mmu.c b

Re: [PATCH 1/3] KVM MMU: make kvm_mmu_zap_page() return the number of zapped sp in total.

2010-04-22 Thread Gui Jianfeng
Xiao Guangrong wrote: Gui Jianfeng wrote: Currently, in kvm_mmu_change_mmu_pages(kvm, page), used_pages-- is performed after calling kvm_mmu_zap_page() in spite of that whether page is actually reclaimed. Because root sp won't be reclaimed by kvm_mmu_zap_page(). So making

[PATCH 1/3 v2] KVM MMU: make kvm_mmu_zap_page() return the number of zapped sp in total.

2010-04-22 Thread Gui Jianfeng
more sense. A new flag is put into kvm_mmu_zap_page() to indicate whether the top page is reclaimed. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/mmu.c | 53 +++ 1 files changed, 36 insertions(+), 17 deletions(-) diff

[PATCH 1/4] KVM: Move first pte address calculation out of loop to save some cycles

2010-04-16 Thread Gui Jianfeng
Move first pte address calculation out of loop to save some cycles Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/paging_tmpl.h |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index

[PATCH 2/4] KVM: Make use of is_large_pte() instead

2010-04-16 Thread Gui Jianfeng
Make use of is_large_pte() instead of checking PT_PAGE_SIZE_MASK bit directly. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/paging_tmpl.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm

[PATCH 3/4] KVM: Remove unused varialbe in rmap_next()

2010-04-16 Thread Gui Jianfeng
Remove unused varialbe in rmap_next() Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/mmu.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index b44380b..dec8a6d 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch

[PATCH 4/4] KVM: Get rid of dead function

2010-04-16 Thread Gui Jianfeng
Nobody use gva_to_page() anymore, get rid of it. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/mmu.c | 14 -- include/linux/kvm_host.h |1 - 2 files changed, 0 insertions(+), 15 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c

virsh dump blocking problem

2010-04-05 Thread Gui Jianfeng
Hi all, I'm not sure whether it's appropriate to post the problem here. I played with virsh under Fedora 12, and started a KVM fedora12 guest by virsh start command. The fedora12 guest is successfully started. Than I run the following command to dump the guest core: #virsh dump 1 mycoredump

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

2010-03-25 Thread Gui Jianfeng
Avi Kivity wrote: On 03/22/2010 11:13 AM, Sheng Yang wrote: diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 06108f3..f971b9b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1804,9 +1804,15 @@ static u64 construct_eptp(unsigned long root_hpa) { u64 eptp; -

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

2010-03-22 Thread Gui Jianfeng
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 | 12 +--- 2 files changed, 11 insertions(+), 3

[PATCH] KVM: cleanup: change to use bool return values

2010-03-15 Thread Gui Jianfeng
Make use of bool as return valuses. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/vmx.c | 72 ++-- 1 files changed, 36 insertions(+), 36 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 06108f3

[PATCH] KVM: Cleanup: change to use bool return values

2010-03-15 Thread Gui Jianfeng
Make use of bool as return values, and remove some useless bool value converting. Thanks Avi to point this out. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/vmx.c | 54 ++-- 1 files changed, 27 insertions(+), 27

[PATCH] KVM: Remove redundant check in vm_need_virtualize_apic_accesses()

2010-01-28 Thread Gui Jianfeng
flexpriority_enabled implies cpu_has_vmx_virtualize_apic_accesses() returning true, so we don't need this check here. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/vmx.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx.c b