All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: Avi Kivity <avi@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
	KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH 3/3] KVM: MMU: track the refcount when unmap the page
Date: Tue, 3 Jul 2012 17:30:53 -0300	[thread overview]
Message-ID: <20120703203053.GA13581@amt.cnet> (raw)
In-Reply-To: <4FF291EE.7060408@linux.vnet.ibm.com>

On Tue, Jul 03, 2012 at 02:32:14PM +0800, Xiao Guangrong wrote:
> It will trigger a WARN_ON if the page has been freed but it is still
> used in mmu, it can help us to detect mm bug early
> 
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
> ---
>  arch/x86/kvm/mmu.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index cac3408..af7e076 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -527,6 +527,14 @@ static int mmu_spte_clear_track_bits(u64 *sptep)
>  		return 0;
> 
>  	pfn = spte_to_pfn(old_spte);
> +
> +	/*
> +	 * KVM does not hold the refcount of the page used by
> +	 * kvm mmu, before reclaiming the page, we should
> +	 * unmap it from mmu first.
> +	 */
> +	WARN_ON(!page_count(pfn_to_page(pfn)));
> +

Except for mmio pfns.

Applied patch 1 and 2 to master, thanks.

      reply	other threads:[~2012-07-03 20:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-03  6:31 [PATCH 1/3] KVM: fix fault page leak Xiao Guangrong
2012-07-03  6:31 ` [PATCH 2/3] KVM: MMU: fix shrinking page from the empty mmu Xiao Guangrong
2012-07-03  6:32 ` [PATCH 3/3] KVM: MMU: track the refcount when unmap the page Xiao Guangrong
2012-07-03 20:30   ` Marcelo Tosatti [this message]

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=20120703203053.GA13581@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiaoguangrong@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.