Re: [PATCH] KVM: MMU: fix the condition of syncing a new shadow page

2011-10-24 Thread Zhao Jin
2011/10/24 Xiao Guangrong :
> On 2011/10/24 15:21, Zhao Jin wrote:
>> Should be "or" since a new shadow page is synced if either it is
>> not leaf or there already exists another unsync shadow page with
>> the same gfn.
>>
>
> It is obviously wrong, we need to sync pages only if it has unsync page
> *and* the new shadow page breaks the unsync rule(only the level 1 sp can
> became unsync).
>

Please ignore this patch as I had taken an incorrect assumption.
Thanks very much for the correction.
--
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


Re: [PATCH] KVM: MMU: fix the condition of syncing a new shadow page

2011-10-24 Thread Xiao Guangrong
On 2011/10/24 15:21, Zhao Jin wrote:
> Should be "or" since a new shadow page is synced if either it is
> not leaf or there already exists another unsync shadow page with 
> the same gfn.
> 

It is obviously wrong, we need to sync pages only if it has unsync page
*and* the new shadow page breaks the unsync rule(only the level 1 sp can
became unsync).
--
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


[PATCH] KVM: MMU: fix the condition of syncing a new shadow page

2011-10-24 Thread Zhao Jin
Should be "or" since a new shadow page is synced if either it is
not leaf or there already exists another unsync shadow page with 
the same gfn.

Signed-off-by: Zhao Jin 
---
 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 d7e1694..f36de41 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1698,7 +1698,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct 
kvm_vcpu *vcpu,
if (!direct) {
if (rmap_write_protect(vcpu->kvm, gfn))
kvm_flush_remote_tlbs(vcpu->kvm);
-   if (level > PT_PAGE_TABLE_LEVEL && need_sync)
+   if (level > PT_PAGE_TABLE_LEVEL || need_sync)
kvm_sync_pages(vcpu, gfn);
 
account_shadowed(vcpu->kvm, gfn);
-- 
1.7.5.4

--
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