From: Avi Kivity <avi@redhat.com>
To: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH 2/4] KVM: MMU: support unsync sp out of the protection of 'mmu_lock'
Date: Mon, 20 Sep 2010 17:19:58 +0200 [thread overview]
Message-ID: <4C977B9E.6030208@redhat.com> (raw)
In-Reply-To: <4C976D7C.7090707@cn.fujitsu.com>
On 09/20/2010 04:19 PM, Xiao Guangrong wrote:
> It allows keep unsync sp alive while it's out of the protection, later we can use
> kvm_mmu_free_page() to free it if !sp->active_count
Don't understand. Of course unsync pages exist outside mmu_lock...?
>
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index 839852d..4b7af3f 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -996,7 +996,6 @@ static void kvm_mmu_free_page(struct kvm *kvm, struct kvm_mmu_page *sp)
> {
> ASSERT(is_empty_shadow_page(sp->spt));
> hlist_del(&sp->hash_link);
> - list_del(&sp->link);
> __free_page(virt_to_page(sp->spt));
> if (!sp->role.direct)
> __free_page(virt_to_page(sp->gfns));
> @@ -1681,9 +1680,8 @@ static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp,
> kvm_mmu_unlink_parents(kvm, sp);
> if (!sp->role.invalid&& !sp->role.direct)
> unaccount_shadowed(kvm, sp->gfn);
> - if (sp->unsync)
> - kvm_unlink_unsync_page(kvm, sp);
> - if (!sp->active_count) {
> +
> + if (!sp->active_count || sp->unsync) {
> /* Count self */
> ret++;
> list_move(&sp->link, invalid_list);
How can you drop an active unsync page?
I'm missing something here.
> @@ -1692,6 +1690,8 @@ static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp,
> kvm_reload_remote_mmus(kvm);
> }
>
> + if (sp->unsync)
> + kvm_unlink_unsync_page(kvm, sp);
> sp->role.invalid = 1;
> kvm_mmu_reset_last_pte_updated(kvm);
> return ret;
> @@ -1709,8 +1709,12 @@ static void kvm_mmu_commit_zap_page(struct kvm *kvm,
>
> do {
> sp = list_first_entry(invalid_list, struct kvm_mmu_page, link);
> - WARN_ON(!sp->role.invalid || sp->active_count);
> - kvm_mmu_free_page(kvm, sp);
> + WARN_ON(!sp->role.invalid);
> + list_del(&sp->link);
> + if (sp->active_count)
> + WARN_ON(!sp->unsync);
> + else
> + kvm_mmu_free_page(kvm, sp);
> } while (!list_empty(invalid_list));
>
> }
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2010-09-20 15:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-20 14:18 [PATCH 1/4] KVM: MMU: rename 'sp->root_count' to 'sp->active_count' Xiao Guangrong
2010-09-20 14:19 ` [PATCH 2/4] KVM: MMU: support unsync sp out of the protection of 'mmu_lock' Xiao Guangrong
2010-09-20 15:19 ` Avi Kivity [this message]
2010-09-23 3:05 ` Xiao Guangrong
2010-09-26 13:02 ` Avi Kivity
2010-09-20 14:20 ` [PATCH 3/4] KVM: MMU: move reserved bits check to FNAME(update_pte) Xiao Guangrong
2010-09-20 14:21 ` [PATCH 4/4] KVM: MMU: Don't touch unsync sp in kvm_mmu_pte_write() Xiao Guangrong
2010-09-20 15:24 ` Avi Kivity
2010-09-23 2:59 ` Xiao Guangrong
2010-09-26 13:09 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C977B9E.6030208@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=xiaoguangrong@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox