[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] kvm: Avoid COW if KVM MMU is asynchronous

From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH] kvm: Avoid COW if KVM MMU is asynchronous
Date: Sun, 26 Apr 2009 16:08:43 +0300
User-agent: Thunderbird (X11/20090320)

Jan Kiszka wrote:
If the KVM MMU is asynchronous (kernel does not support MMU_NOTIFIER),
we have to avoid COW for the guest memory. Otherwise we risk serious
breakage when guest pages change there physical locations due to COW
after fork. Seen when forking smbd during runtime via -smb.

Signed-off-by: Jan Kiszka <address@hidden>

 exec.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/exec.c b/exec.c
index 23013fb..ce0603e 100644
--- a/exec.c
+++ b/exec.c
@@ -2477,6 +2477,20 @@ ram_addr_t qemu_ram_alloc(ram_addr_t size)
     new_block->next = ram_blocks;
     ram_blocks = new_block;
+ if (kvm_enabled() && !kvm_has_sync_mmu()) {
+        int ret = madvise(new_block->host, size, MADV_DONTFORK);
+        if (ret) {
+            perror("madvice");
+            exit(1);
+        }
+        fprintf(stderr,
+                "Need MADV_DONTFORK in absence of synchronous KVM MMU\n");
+        exit(1);
+    }

Suggest wrapping in a function and hiding it deep inside kvm-all.c.

error compiling committee.c: too many arguments to function

reply via email to

[Prev in Thread] Current Thread [Next in Thread]