From: Paul Mackerras <paulus@samba.org>
To: Alexander Graf <agraf@suse.de>
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org,
David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH 1/5] KVM: Provide mmu notifier retry test based on struct kvm
Date: Tue, 16 Oct 2012 14:59:33 +1100 [thread overview]
Message-ID: <20121016035933.GM1218@drongo> (raw)
In-Reply-To: <20121016035836.GL1218@drongo>
The mmu_notifier_retry() function, used to test whether any page
invalidations are in progress, currently takes a vcpu pointer, though
the code only needs the VM's struct kvm pointer. Forthcoming patches
to the powerpc Book3S HV code will need to test for retry within a VM
ioctl, where a struct kvm pointer is available but a struct vcpu
pointer isn't. Therefore this creates a variant of mmu_notifier_retry
called kvm_mmu_notifier_retry that takes a struct kvm pointer, and
implements mmu_notifier_retry in terms of it.
Signed-off-by: Paul Mackerras <paulus@samba.org>
---
include/linux/kvm_host.h | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 6afc5be..1cc1e1d 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -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 kvm_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,10 +856,15 @@ 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;
}
+
+static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq)
+{
+ return kvm_mmu_notifier_retry(vcpu->kvm, mmu_seq);
+}
#endif
#ifdef KVM_CAP_IRQ_ROUTING
--
1.7.10.4
next prev parent reply other threads:[~2012-10-16 3:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-16 3:58 [PATCH 0/5] KVM: PPC: Book3S HV: HPT read/write functions for userspace Paul Mackerras
2012-10-16 3:59 ` Paul Mackerras [this message]
2012-10-16 9:44 ` [PATCH 1/5] KVM: Provide mmu notifier retry test based on struct kvm Avi Kivity
2012-10-16 10:06 ` Alexander Graf
2012-10-16 4:00 ` [PATCH 2/5] KVM: PPC: Book3S HV: Restructure HPT entry creation code Paul Mackerras
2012-10-16 4:00 ` [PATCH 3/5] KVM: PPC: Book3S HV: Add a mechanism for recording modified HPTEs Paul Mackerras
2012-10-16 4:01 ` [PATCH 4/5] KVM: PPC: Book3S HV: Make a HPTE removal function available Paul Mackerras
2012-10-16 4:01 ` [PATCH 5/5] KVM: PPC: Book3S HV: Provide a method for userspace to read and write the HPT Paul Mackerras
2012-10-16 10:06 ` Avi Kivity
2012-10-16 11:58 ` Paul Mackerras
2012-10-16 13:06 ` Avi Kivity
2012-10-16 20:03 ` Anthony Liguori
2012-10-17 10:27 ` Avi Kivity
2012-10-16 21:52 ` Paul Mackerras
2012-10-17 10:31 ` 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=20121016035933.GM1218@drongo \
--to=paulus@samba.org \
--cc=agraf@suse.de \
--cc=david@gibson.dropbear.id.au \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).