]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
KVM: Take kvm instead of vcpu to mmu_notifier_retry
authorChristoffer Dall <c.dall@virtualopensystems.com>
Mon, 15 Oct 2012 03:10:18 +0000 (23:10 -0400)
committerAvi Kivity <avi@redhat.com>
Tue, 23 Oct 2012 11:35:43 +0000 (13:35 +0200)
The mmu_notifier_retry is not specific to any vcpu (and never will be)
so only take struct kvm as a parameter.

The motivation is the ARM mmu code that needs to call this from
somewhere where we long let go of the vcpu pointer.

Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/powerpc/kvm/book3s_64_mmu_hv.c
arch/powerpc/kvm/book3s_hv_rm_mmu.c
arch/x86/kvm/mmu.c
arch/x86/kvm/paging_tmpl.h
include/linux/kvm_host.h

index 7a4aae99ac5b11bce09aa03b8bd3d8562094e0bb..2a89a36e726344dadd5e065b12f49e234c2aa8f7 100644 (file)
@@ -710,7 +710,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
 
        /* Check if we might have been invalidated; let the guest retry if so */
        ret = RESUME_GUEST;
-       if (mmu_notifier_retry(vcpu, mmu_seq)) {
+       if (mmu_notifier_retry(vcpu->kvm, mmu_seq)) {
                unlock_rmap(rmap);
                goto out_unlock;
        }
index 9955216477a4c7934284276b499184893e959251..5e06e3153888f6c3dd2affcdd2ae0e414eea7e6e 100644 (file)
@@ -297,7 +297,7 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
                lock_rmap(rmap);
                /* Check for pending invalidations under the rmap chain lock */
                if (kvm->arch.using_mmu_notifiers &&
-                   mmu_notifier_retry(vcpu, mmu_seq)) {
+                   mmu_notifier_retry(vcpu->kvm, mmu_seq)) {
                        /* inval in progress, write a non-present HPTE */
                        pteh |= HPTE_V_ABSENT;
                        pteh &= ~HPTE_V_VALID;
index 3d5ca7939380841d8ce8465d65e7edb124ccd8eb..6f78fa3a47066e6cb110de5bcb8bf85d02157e53 100644 (file)
@@ -2886,7 +2886,7 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, u32 error_code,
                return r;
 
        spin_lock(&vcpu->kvm->mmu_lock);
-       if (mmu_notifier_retry(vcpu, mmu_seq))
+       if (mmu_notifier_retry(vcpu->kvm, mmu_seq))
                goto out_unlock;
        kvm_mmu_free_some_pages(vcpu);
        if (likely(!force_pt_level))
@@ -3355,7 +3355,7 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa, u32 error_code,
                return r;
 
        spin_lock(&vcpu->kvm->mmu_lock);
-       if (mmu_notifier_retry(vcpu, mmu_seq))
+       if (mmu_notifier_retry(vcpu->kvm, mmu_seq))
                goto out_unlock;
        kvm_mmu_free_some_pages(vcpu);
        if (likely(!force_pt_level))
index f887e4cfc1fec23bca66cc4b5daf98a44ad46e72..d17decaf1db9fafafff86079d072dcb2218c91dd 100644 (file)
@@ -565,7 +565,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code,
                return r;
 
        spin_lock(&vcpu->kvm->mmu_lock);
-       if (mmu_notifier_retry(vcpu, mmu_seq))
+       if (mmu_notifier_retry(vcpu->kvm, mmu_seq))
                goto out_unlock;
 
        kvm_mmu_audit(vcpu, AUDIT_PRE_PAGE_FAULT);
index 6afc5be2615efa5f6312ce6a9ec3d30dbdf87031..82e2c783a21e5b0cbe7bc4090e1c709f6a986c23 100644 (file)
@@ -841,9 +841,9 @@ extern struct kvm_stats_debugfs_item debugfs_entries[];
 extern struct dentry *kvm_debugfs_dir;
 
 #if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER)
-static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq)
+static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq)
 {
-       if (unlikely(vcpu->kvm->mmu_notifier_count))
+       if (unlikely(kvm->mmu_notifier_count))
                return 1;
        /*
         * Ensure the read of mmu_notifier_count happens before the read
@@ -856,7 +856,7 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se
         * can't rely on kvm->mmu_lock to keep things ordered.
         */
        smp_rmb();
-       if (vcpu->kvm->mmu_notifier_seq != mmu_seq)
+       if (kvm->mmu_notifier_seq != mmu_seq)
                return 1;
        return 0;
 }