From patchwork Wed May 12 06:33:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 98922 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 o4C6YeNi002302 for ; Wed, 12 May 2010 06:34:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753276Ab0ELGeC (ORCPT ); Wed, 12 May 2010 02:34:02 -0400 Received: from mga11.intel.com ([192.55.52.93]:52248 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751044Ab0ELGd5 (ORCPT ); Wed, 12 May 2010 02:33:57 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 11 May 2010 23:31:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.53,212,1272870000"; d="scan'208";a="797665763" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.36.64]) by fmsmga001.fm.intel.com with ESMTP; 11 May 2010 23:33:43 -0700 Received: from yasker by syang10-desktop with local (Exim 4.71) (envelope-from ) id 1OC5VF-0005bi-8s; Wed, 12 May 2010 14:33:09 +0800 From: Sheng Yang To: Avi Kivity , Marcelo Tosatti Cc: kvm@vger.kernel.org, Sheng Yang Subject: [PATCH 2/4] KVM: Clean up duplicate assignment Date: Wed, 12 May 2010 14:33:04 +0800 Message-Id: <1273645986-21526-2-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <4BEA4B2A.9060907@redhat.com> References: <4BEA4B2A.9060907@redhat.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]); Wed, 12 May 2010 06:34:40 +0000 (UTC) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 95bee9d..5412185 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -2450,10 +2450,9 @@ static int init_kvm_mmu(struct kvm_vcpu *vcpu) static void destroy_kvm_mmu(struct kvm_vcpu *vcpu) { ASSERT(vcpu); - if (VALID_PAGE(vcpu->arch.mmu.root_hpa)) { + if (VALID_PAGE(vcpu->arch.mmu.root_hpa)) + /* mmu.free() should set root_hpa = INVALID_PAGE */ vcpu->arch.mmu.free(vcpu); - vcpu->arch.mmu.root_hpa = INVALID_PAGE; - } } int kvm_mmu_reset_context(struct kvm_vcpu *vcpu) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 2cae460..764f89b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -486,7 +486,7 @@ int __kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) return 1; kvm_x86_ops->set_cr4(vcpu, cr4); - vcpu->arch.cr4 = cr4; + kvm_mmu_reset_context(vcpu); return 0; @@ -720,8 +720,6 @@ static int set_efer(struct kvm_vcpu *vcpu, u64 efer) kvm_x86_ops->set_efer(vcpu, efer); - vcpu->arch.efer = efer; - vcpu->arch.mmu.base_role.nxe = (efer & EFER_NX) && !tdp_enabled; kvm_mmu_reset_context(vcpu);