All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>,
	Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>,
	takuya.yoshikawa@gmail.com
Subject: [PATCH 3/4] KVM: Flush TLB in FNAME(invlpg) without holding mmu_lock
Date: Thu,  3 May 2012 14:23:01 +0300	[thread overview]
Message-ID: <1336044182-12023-4-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1336044182-12023-1-git-send-email-avi@redhat.com>

mmu_page_zap_pte() is modified to mark the TLB as dirty; but currently
only FNAME(invlpg) takes advantage of this.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 arch/x86/kvm/mmu.c         |    7 +++----
 arch/x86/kvm/paging_tmpl.h |    5 +++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 07424cf..0e7bcff 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1887,7 +1887,7 @@ static void validate_direct_spte(struct kvm_vcpu *vcpu, u64 *sptep,
 	}
 }
 
-static bool mmu_page_zap_pte(struct kvm *kvm, struct kvm_mmu_page *sp,
+static void mmu_page_zap_pte(struct kvm *kvm, struct kvm_mmu_page *sp,
 			     u64 *spte)
 {
 	u64 pte;
@@ -1903,13 +1903,12 @@ static bool mmu_page_zap_pte(struct kvm *kvm, struct kvm_mmu_page *sp,
 			child = page_header(pte & PT64_BASE_ADDR_MASK);
 			drop_parent_pte(child, spte);
 		}
-		return true;
+		kvm_mark_tlb_dirty(kvm);
+		return;
 	}
 
 	if (is_mmio_spte(pte))
 		mmu_spte_clear_no_track(spte);
-
-	return false;
 }
 
 static void kvm_mmu_page_unlink_children(struct kvm *kvm,
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 97e2a81..72c9cf4 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -697,8 +697,7 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
 			pte_gpa = FNAME(get_level1_sp_gpa)(sp);
 			pte_gpa += (sptep - sp->spt) * sizeof(pt_element_t);
 
-			if (mmu_page_zap_pte(vcpu->kvm, sp, sptep))
-				kvm_flush_remote_tlbs(vcpu->kvm);
+			mmu_page_zap_pte(vcpu->kvm, sp, sptep);
 
 			if (!rmap_can_add(vcpu))
 				break;
@@ -714,6 +713,8 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
 			break;
 	}
 	spin_unlock(&vcpu->kvm->mmu_lock);
+
+	kvm_cond_flush_remote_tlbs(vcpu->kvm);
 }
 
 static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr, u32 access,
-- 
1.7.10


  parent reply	other threads:[~2012-05-03 11:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-03 11:22 [PATCH 0/4] Unlocked TLB flush Avi Kivity
2012-05-03 11:22 ` [PATCH 1/4] KVM: Add APIs for unlocked " Avi Kivity
2012-05-03 13:23   ` Xiao Guangrong
2012-05-03 14:11     ` Avi Kivity
2012-05-07  7:06       ` Xiao Guangrong
2012-05-07  7:59         ` Avi Kivity
2012-05-08  1:55           ` Marcelo Tosatti
2012-05-08  9:09             ` Avi Kivity
2012-05-08 13:50               ` Marcelo Tosatti
2012-05-08  9:09             ` Avi Kivity
2012-05-08  2:25       ` Marcelo Tosatti
2012-05-08 12:39         ` Avi Kivity
2012-05-09 21:03           ` Marcelo Tosatti
2012-05-21 14:45             ` Avi Kivity
2012-05-03 11:23 ` [PATCH 2/4] KVM: Flush TLB in mmu notifier without holding mmu_lock Avi Kivity
2012-05-03 11:23 ` Avi Kivity [this message]
2012-05-03 11:23 ` [PATCH 4/4] KVM: Flush TLB in change_pte " Avi Kivity
2012-05-08  1:25 ` [PATCH 0/4] Unlocked TLB flush Marcelo Tosatti
2012-05-08  1:27   ` Marcelo Tosatti
2012-05-08 10:51     ` Avi Kivity

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=1336044182-12023-4-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=takuya.yoshikawa@gmail.com \
    --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.