public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: kvm@vger.kernel.org
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 1/2] libkvm: add kvm_has_sync_mmu
Date: Fri, 22 Aug 2008 20:03:34 -0300	[thread overview]
Message-ID: <20080822230510.119883556@localhost.localdomain> (raw)
In-Reply-To: 20080822230333.323535558@localhost.localdomain

[-- Attachment #1: sync-mmu --]
[-- Type: text/plain, Size: 1327 bytes --]

From: Anthony Liguori <aliguori@us.ibm.com>

This patch adds a kvm_has_sync_mmu routine to libkvm.  This allows
userspace to query the existence of mmu notifiers which is important for
ballooning since madvise() is not safe from userspace without it.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: kvm-userspace.tip/libkvm/libkvm.c
===================================================================
--- kvm-userspace.tip.orig/libkvm/libkvm.c
+++ kvm-userspace.tip/libkvm/libkvm.c
@@ -1053,6 +1053,15 @@ int kvm_pit_in_kernel(kvm_context_t kvm)
 	return kvm->pit_in_kernel;
 }
 
+int kvm_has_sync_mmu(kvm_context_t kvm)
+{
+        int r = 0;
+#ifdef KVM_CAP_SYNC_MMU
+        r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_SYNC_MMU);
+#endif
+        return r;
+}
+
 int kvm_init_coalesced_mmio(kvm_context_t kvm)
 {
 	int r = 0;
Index: kvm-userspace.tip/libkvm/libkvm.h
===================================================================
--- kvm-userspace.tip.orig/libkvm/libkvm.h
+++ kvm-userspace.tip/libkvm/libkvm.h
@@ -528,6 +528,8 @@ int kvm_dirty_pages_log_reset(kvm_contex
  */
 int kvm_irqchip_in_kernel(kvm_context_t kvm);
 
+int kvm_has_sync_mmu(kvm_context_t kvm);
+
 #ifdef KVM_CAP_IRQCHIP
 /*!
  * \brief Dump in kernel IRQCHIP contents

-- 


  reply	other threads:[~2008-08-22 23:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-22 23:03 [patch 0/2] madvise(MADV_DONTFORK) guest mem if !mmu_notifiers Marcelo Tosatti
2008-08-22 23:03 ` Marcelo Tosatti [this message]
2008-08-22 23:03 ` [patch 2/2] qemu: kvm: mark guest mapping as MADV_DONTFORK Marcelo Tosatti
2008-08-25 10:20 ` [patch 0/2] madvise(MADV_DONTFORK) guest mem if !mmu_notifiers 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=20080822230510.119883556@localhost.localdomain \
    --to=mtosatti@redhat.com \
    --cc=aliguori@us.ibm.com \
    --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