From patchwork Fri Jun 11 13:32:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 105580 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5BDaopd026783 for ; Fri, 11 Jun 2010 13:36:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760341Ab0FKNgH (ORCPT ); Fri, 11 Jun 2010 09:36:07 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:52545 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1760320Ab0FKNgG (ORCPT ); Fri, 11 Jun 2010 09:36:06 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id A6CEB17008D; Fri, 11 Jun 2010 21:36:04 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id o5BDXiqQ027860; Fri, 11 Jun 2010 21:33:44 +0800 Received: from [10.167.141.99] (unknown [10.167.141.99]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 3B72910C007; Fri, 11 Jun 2010 21:35:46 +0800 (CST) Message-ID: <4C123AF2.80803@cn.fujitsu.com> Date: Fri, 11 Jun 2010 21:32:34 +0800 From: Xiao Guangrong User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Avi Kivity CC: Marcelo Tosatti , LKML , KVM list Subject: [PATCH 5/7] KVM: MMU: cleanup for __mmu_unsync_walk() References: <4C1239EE.3090904@cn.fujitsu.com> <4C123ABA.3000601@cn.fujitsu.com> In-Reply-To: <4C123ABA.3000601@cn.fujitsu.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 11 Jun 2010 13:36:51 +0000 (UTC) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 18c14c5..c4b980a 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1160,9 +1160,11 @@ static int __mmu_unsync_walk(struct kvm_mmu_page *sp, return -ENOSPC; ret = __mmu_unsync_walk(child, pvec); - if (!ret) + if (!ret) { __clear_bit(i, sp->unsync_child_bitmap); - else if (ret > 0) + sp->unsync_children--; + WARN_ON((int)sp->unsync_children < 0); + } else if (ret > 0) nr_unsync_leaf += ret; else return ret; @@ -1176,8 +1178,6 @@ static int __mmu_unsync_walk(struct kvm_mmu_page *sp, } } - if (find_first_bit(sp->unsync_child_bitmap, 512) == 512) - sp->unsync_children = 0; return nr_unsync_leaf; }