]> xenbits.xensource.com Git - xen.git/commitdiff
tmem: allow tmem to be disabled with Kconfig
authorDoug Goldstein <cardoe@cardoe.com>
Wed, 16 Mar 2016 14:11:01 +0000 (09:11 -0500)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 16 Mar 2016 14:55:37 +0000 (10:55 -0400)
Wrap the various tmem functions with the Kconfig generated CONFIG_TMEM
option allowing users to build Xen without tmem support.

Note that you have to use XEN_CONFIG_EXPERT to see this option.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
xen/arch/x86/x86_64/compat/entry.S
xen/arch/x86/x86_64/entry.S
xen/common/Kconfig
xen/common/Makefile
xen/include/xen/hypercall.h
xen/include/xen/tmem.h
xen/include/xen/tmem_xen.h

index 927439ddd4c3db8eb52e248f3cc01dbcdf85fa0d..5218f8aed7206d52f3d56aa8960fd1e16b3f1b67 100644 (file)
@@ -345,6 +345,10 @@ compat_crash_page_fault:
 #define compat_kexec_op do_ni_hypercall
 #endif
 
+#ifndef CONFIG_TMEM
+#define do_tmem_op do_ni_hypercall
+#endif
+
 #ifndef CONFIG_XENOPROF
 #define compat_xenoprof_op do_ni_hypercall
 #endif
index dd7f1149d716636e9939836f03976eb20f7c56f6..cab976313e0a8af52e41461f68b90ace8e9985ce 100644 (file)
@@ -681,6 +681,10 @@ ENTRY(exception_table)
 #define do_kexec_op do_ni_hypercall
 #endif
 
+#ifndef CONFIG_TMEM
+#define do_tmem_op do_ni_hypercall
+#endif
+
 #ifndef CONFIG_XENOPROF
 #define do_xenoprof_op do_ni_hypercall
 #endif
index 8fbc46d4af1a0d01a59fb24240453c26488f7958..3522ecb8d683a1f6770201757f59e93f861463f6 100644 (file)
@@ -87,6 +87,20 @@ config LATE_HWDOM
 
          If unsure, say N.
 
+# Enables transcendent memory support
+config TMEM
+       def_bool y
+       prompt "Transcendent Memory Support" if EXPERT = "y"
+       ---help---
+         Transcendent memory allows PV-aware guests to collaborate on memory
+         usage. Guests can 'swap' their memory to the hypervisor or have an
+         collective pool of memory shared across guests. The end result is
+         less memory usage by guests allowing higher guest density.
+
+         You also have to enable it on the Xen commandline by using tmem=1
+
+         If unsure, say Y.
+
 # Adds support for Xenoprof
 config XENOPROF
        def_bool y
index 82625a5c96887ed32486339723707c3811688cdf..77de27ed17faea7cd08d6001b4b48312656e67e7 100644 (file)
@@ -49,8 +49,6 @@ obj-y += sysctl.o
 obj-y += tasklet.o
 obj-y += time.o
 obj-y += timer.o
-obj-y += tmem.o
-obj-y += tmem_xen.o
 obj-y += trace.o
 obj-y += version.o
 obj-y += vm_event.o
@@ -65,7 +63,11 @@ obj-bin-$(CONFIG_X86) += $(foreach n,decompress bunzip2 unxz unlzma unlzo unlz4
 obj-$(perfc)       += perfc.o
 obj-$(crash_debug) += gdbstub.o
 
-obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o kernel.o memory.o multicall.o tmem_xen.o xlat.o)
+obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o kernel.o memory.o multicall.o xlat.o)
+
+tmem-y := tmem.o tmem_xen.o
+tmem-$(CONFIG_COMPAT) += compat/tmem_xen.o
+obj-$(CONFIG_TMEM) += $(tmem-y)
 
 subdir-$(CONFIG_X86) += hvm
 
index 26cb615d55b3c3708ba64a5899a1882a4b7ad706..0c8ae0e5df6c094bf94659ed36008169e1c6abe7 100644 (file)
@@ -133,9 +133,13 @@ extern long
 do_xsm_op(
     XEN_GUEST_HANDLE_PARAM(xsm_op_t) u_xsm_op);
 
+#ifdef CONFIG_TMEM
 extern long
 do_tmem_op(
     XEN_GUEST_HANDLE_PARAM(tmem_op_t) uops);
+#else
+#define do_tmem_op do_ni_hypercall
+#endif
 
 extern long
 do_xenoprof_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg);
index 32a542a5dda3bc5e3d43300f85334439811584bd..414a14d808666eadea946ad8383f7100835bca42 100644 (file)
 
 struct xen_sysctl_tmem_op;
 
+#ifdef CONFIG_TMEM
 extern int tmem_control(struct xen_sysctl_tmem_op *op);
 extern void tmem_destroy(void *);
 extern void *tmem_relinquish_pages(unsigned int, unsigned int);
 extern unsigned long tmem_freeable_pages(void);
+#else
+static inline int
+tmem_control(struct xen_sysctl_tmem_op *op)
+{
+    return -ENOSYS;
+}
+
+static inline void
+tmem_destroy(void *p)
+{
+    return;
+}
+
+static inline void *
+tmem_relinquish_pages(unsigned int x, unsigned int y)
+{
+    return NULL;
+}
+
+static inline unsigned long
+tmem_freeable_pages(void)
+{
+    return 0;
+}
+#endif /* CONFIG_TMEM */
 
 #endif /* __XEN_TMEM_H__ */
index f516bbefc81d18a3595f6d146e4240139e70a427..19ed83508a32e2249b603a76c5620285cb9e59fa 100644 (file)
@@ -63,6 +63,7 @@ static inline bool_t tmem_shared_auth(void)
     return opt_tmem_shared_auth;
 }
 
+#ifdef CONFIG_TMEM
 extern bool_t opt_tmem;
 static inline bool_t tmem_enabled(void)
 {
@@ -73,6 +74,16 @@ static inline void tmem_disable(void)
 {
     opt_tmem = 0;
 }
+#else
+static inline bool_t tmem_enabled(void)
+{
+    return 0;
+}
+
+static inline void tmem_disable(void)
+{
+}
+#endif /* CONFIG_TMEM */
 
 /*
  * Memory free page list management