[PATCH 4/6] kvm-userland.git mmu notifier compat

Andrea Arcangeli
2008-07-25T14:38:36Z

This patch to kvm-userland.git allows to build the tree on older
kernels without mmu notifiers.

Unfortunately emulating mmu notifiers with kprobes was feasible only
for do_wp_page because it has a special property where calling the
spte invalidate before the pte invalidate is ok thanks to the
guarantee of that pte being wprotect, not to tell about the start/end
functions. So old kernels without mmu notifiers will have to keep the
page pinned I'm afraid. So to remove the page pin in future patches in
a backwards compatible way, we'll have to go with #ifdef MMU_NOTIFIER
in kvm.git code I'm afraid and this should be all that's needed on the
kvm-userland side. Adding all page pinning needed by old kernels
through hack-module.awk sounds a bit extreme to me, even if it would
result in cleaner kvm.git code... anyway I think the below patch will
be still needed to build regardless how we decide to handle the future
changes.

Signed-off-by: Andrea Arcangeli <andrea@qumranet.com>

diff --git a/kernel/include-compat/linux/mmu_notifier.h b/kernel/include-compat/linux/mmu_notifier.h
new file mode 100644
index 0000000..a6db4ba
--- /dev/null
+++ b/kernel/include-compat/linux/mmu_notifier.h
@@ -0,0 +1,6 @@
+#ifndef _LINUX_MMU_NOTIFIER_H
+#define _LINUX_MMU_NOTIFIER_H
+
+struct mmu_notifier {};
+
+#endif