lkml.org 
[lkml]   [2012]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 10/16] KVM: MMU: fask check whether page is writable
On Fri, 13 Apr 2012 18:14:26 +0800
Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> wrote:

> Using bit 1 (PTE_LIST_WP_BIT) in rmap store the write-protect status
> to avoid unnecessary shadow page walking
>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
> ---
> arch/x86/kvm/mmu.c | 40 ++++++++++++++++++++++++++++++++++------
> 1 files changed, 34 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index 0c6e92d..8b71908 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -796,7 +796,9 @@ static int mapping_level(struct kvm_vcpu *vcpu, gfn_t large_gfn)
> return level - 1;
> }
>
> -#define PTE_LIST_DESC (0x1ull)
> +#define PTE_LIST_DESC_BIT 0
> +#define PTE_LIST_WP_BIT 1

_BIT ?

> +#define PTE_LIST_DESC (1 << PTE_LIST_DESC_BIT)
> #define PTE_LIST_FLAG_MASK (0x3ull)
>

Well, I think that rmap is losing its original meaning:
Before, it held just the information needed to link spteps.

Now it has more roles, and getting kind of descriptor?

...

> @@ -2291,9 +2310,15 @@ static int mmu_need_write_protect(struct kvm_vcpu *vcpu, gfn_t gfn,
> {
> struct kvm_mmu_page *s;
> struct hlist_node *node;
> + unsigned long *rmap;
> bool need_unsync = false;
>
> + rmap = gfn_to_rmap(vcpu->kvm, gfn, PT_PAGE_TABLE_LEVEL);

Please use consistent variable names.

In other parts of this patch, you are using rmapp for this.

Takuya


\
 
 \ /
  Last update: 2012-04-14 05:05    [W:0.175 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site