From patchwork Thu Jun 9 14:03:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 865532 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p59E43JQ014417 for ; Thu, 9 Jun 2011 14:04:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758016Ab1FIOD5 (ORCPT ); Thu, 9 Jun 2011 10:03:57 -0400 Received: from mail-px0-f179.google.com ([209.85.212.179]:59077 "EHLO mail-px0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757965Ab1FIOD4 (ORCPT ); Thu, 9 Jun 2011 10:03:56 -0400 Received: by pxi2 with SMTP id 2so1064709pxi.10 for ; Thu, 09 Jun 2011 07:03:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:in-reply-to :references:x-mailer:mime-version:content-type :content-transfer-encoding; bh=stYFsQF2wcVvbMlNTxqywMy7eXJPSFSd7BoSa0CwwGw=; b=F7FpWuyvWornRa+K85bYp4N47m/9j+yWgGQ8+eQxCzrDuRRzNBwPlm+fhFUDFM0tXa BGL/gRiJkxxqzIMfayVSzyDLMcnH/oLyDcSIkoRrZjj2w+l9Kakir0T/GhMBF6d+Gxfm YGqEDQ5CgcXa/1xH9y0T2sp/tnekunxUl/HRA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=W2F0hM1+Xo86Rb6CGkrVFnIBc4LMkuc49fUyracRugPrE3flzjk6urUWmR0q9KuVOu 1r9XCunnKtPHRZdq28MRlIdb9/0aPVyIDF0aL3b6A24+WzphohLyKZmRQsxqZIOsyYp9 DYGQasAhBHFJ1AcEFnGyr5158WRrCLJsYvFoY= Received: by 10.142.208.6 with SMTP id f6mr115439wfg.299.1307628236335; Thu, 09 Jun 2011 07:03:56 -0700 (PDT) Received: from amd (x096101.dynamic.ppp.asahi-net.or.jp [122.249.96.101]) by mx.google.com with ESMTPS id w16sm1750941wfd.11.2011.06.09.07.03.53 (version=SSLv3 cipher=OTHER); Thu, 09 Jun 2011 07:03:55 -0700 (PDT) Date: Thu, 9 Jun 2011 23:03:52 +0900 From: Takuya Yoshikawa To: avi@redhat.com, mtosatti@redhat.com Cc: kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp, mingo@elte.hu Subject: [PATCH 3/4] KVM: MMU: Update walker->pt/pte_access directly Message-Id: <20110609230352.4cc6fcea.takuya.yoshikawa@gmail.com> In-Reply-To: <20110609225949.91cce4a0.takuya.yoshikawa@gmail.com> References: <20110609225949.91cce4a0.takuya.yoshikawa@gmail.com> X-Mailer: Sylpheed 3.1.0 (GTK+ 2.24.4; x86_64-pc-linux-gnu) Mime-Version: 1.0 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.6 (demeter1.kernel.org [140.211.167.41]); Thu, 09 Jun 2011 14:04:03 +0000 (UTC) From: Takuya Yoshikawa This will help us split out the big body of the walk loop later. The only functional change is when we return from walk_addr_generic() with with an error. The original code did not change these but the new one may change. But this should be safe unless callers use these on that case. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/paging_tmpl.h | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 3270789..711336b 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -122,7 +122,6 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, { pt_element_t pte; pt_element_t __user *ptep_user; - unsigned pt_access, uninitialized_var(pte_access); bool eperm; const int write_fault = access & PFERR_WRITE_MASK; const int user_fault = access & PFERR_USER_MASK; @@ -150,7 +149,7 @@ walk: ASSERT((!is_long_mode(vcpu) && is_pae(vcpu)) || (mmu->get_cr3(vcpu) & CR3_NONPAE_RESERVED_BITS) == 0); - pt_access = ACC_ALL; + walker->pt_access = ACC_ALL; for (;;) { gfn_t real_gfn; @@ -224,7 +223,8 @@ walk: pte |= PT_ACCESSED_MASK; } - pte_access = pt_access & FNAME(gpte_access)(vcpu, pte); + walker->pte_access = walker->pt_access & + FNAME(gpte_access)(vcpu, pte); walker->ptes[walker->level - 1] = pte; @@ -260,7 +260,7 @@ walk: break; } - pt_access = pte_access; + walker->pt_access = walker->pte_access; --walker->level; } @@ -286,10 +286,8 @@ walk: walker->ptes[walker->level - 1] = pte; } - walker->pt_access = pt_access; - walker->pte_access = pte_access; pgprintk("%s: pte %llx pte_access %x pt_access %x\n", - __func__, (u64)pte, pte_access, pt_access); + __func__, (u64)pte, walker->pte_access, walker->pt_access); return 1; error: