public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Xiaotian Feng <xtfeng@gmail.com>
Cc: Avi Kivity <avi@redhat.com>,
	Tim Pepper <lnxninja@linux.vnet.ibm.com>,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	kvm@vger.kernel.org
Subject: Re: [PATCH 0/4 v2] kvm: rework KVM mmu_shrink() code
Date: Mon, 23 Aug 2010 23:07:21 -0300	[thread overview]
Message-ID: <20100824020721.GA14726@amt.cnet> (raw)
In-Reply-To: <AANLkTi=7HdLqm-g1F+ezhDN4n+vPo2jAo2cgn-M6_wMJ@mail.gmail.com>

On Mon, Aug 23, 2010 at 07:11:11PM +0800, Xiaotian Feng wrote:
> On Mon, Aug 23, 2010 at 6:27 PM, Avi Kivity <avi@redhat.com> wrote:
> >  On 08/23/2010 01:22 PM, Avi Kivity wrote:
> >>
> >>
> >> I see a lot of soft lockups with this patchset:
> >
> > This is running the emulator.flat test case, with shadow paging.  This test
> > triggers a lot (millions) of mmu mode switches.
> >
> 
> Does following patch fix your issue?
> 
> Latest kvm mmu_shrink code rework makes kernel changes
> kvm->arch.n_used_mmu_pages/
> kvm->arch.n_max_mmu_pages at kvm_mmu_free_page/kvm_mmu_alloc_page,
> which is called
> by kvm_mmu_commit_zap_page. So the kvm->arch.n_used_mmu_pages or
> kvm_mmu_available_pages(vcpu->kvm) is unchanged after kvm_mmu_commit_zap_page(),
> This caused kvm_mmu_change_mmu_pages/__kvm_mmu_free_some_pages looping forever.
> Moving kvm_mmu_commit_zap_page would make the while loop performs as normal.
> 
> ---
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index f52a965..7e09a21 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -1726,8 +1726,8 @@ void kvm_mmu_change_mmu_pages(struct kvm *kvm,
> unsigned int goal_nr_mmu_pages)
>                                             struct kvm_mmu_page, link);
>                         kvm_mmu_prepare_zap_page(kvm, page,
>                                                                &invalid_list);
> +                       kvm_mmu_commit_zap_page(kvm, &invalid_list);
>                 }
> -               kvm_mmu_commit_zap_page(kvm, &invalid_list);
>                 goal_nr_mmu_pages = kvm->arch.n_used_mmu_pages;
>         }
> 
> @@ -2976,9 +2976,9 @@ void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu)
>                 sp = container_of(vcpu->kvm->arch.active_mmu_pages.prev,
>                                   struct kvm_mmu_page, link);
>                 kvm_mmu_prepare_zap_page(vcpu->kvm, sp, &invalid_list);
> +               kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
>                 ++vcpu->kvm->stat.mmu_recycled;
>         }
> -       kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
>  }
> 
>  int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u32 error_code)

Please resend with a signed-off-by, and proper subject for the patch.

Thanks

  parent reply	other threads:[~2010-08-24  2:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20  1:10 [PATCH 0/4 v2] kvm: rework KVM mmu_shrink() code Tim Pepper
2010-08-22 15:29 ` Avi Kivity
2010-08-23 10:22 ` Avi Kivity
2010-08-23 10:27   ` Avi Kivity
2010-08-23 11:11     ` Xiaotian Feng
2010-08-23 11:28       ` Avi Kivity
2010-08-23 19:53         ` Tim Pepper
2010-08-24  2:07       ` Marcelo Tosatti [this message]
2010-08-24  2:31         ` [PATCH -kvm] kvm: fix regression from " Xiaotian Feng
2010-08-24 13:12           ` Marcelo Tosatti
2010-08-24  9:50         ` [PATCH 0/4 v2] kvm: " Xiaotian Feng

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=20100824020721.GA14726@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=dave@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lnxninja@linux.vnet.ibm.com \
    --cc=xtfeng@gmail.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