All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Goldstein <cardoe@cardoe.com>
To: xen-devel@lists.xen.org
Cc: Keir Fraser <keir@xen.org>, Doug Goldstein <cardoe@cardoe.com>,
	Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig
Date: Tue, 15 Mar 2016 15:18:50 -0500	[thread overview]
Message-ID: <1458073130-5126-4-git-send-email-cardoe@cardoe.com> (raw)
In-Reply-To: <1458073130-5126-1-git-send-email-cardoe@cardoe.com>

Wrap the various tmem functions with the Kconfig generated CONFIG_TMEM
option allowing users to build Xen without tmem support.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <jbeulich@suse.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

changes from v1:
- add description provided by Konrad (thanks!)
- tweaks to Makefile suggested by Jan
- other fixes suggested by Jan
---
 xen/arch/x86/x86_64/compat/entry.S |  4 ++++
 xen/arch/x86/x86_64/entry.S        |  4 ++++
 xen/common/Kconfig                 | 10 ++++++++++
 xen/common/Makefile                |  9 ++++++---
 xen/include/xen/hypercall.h        |  4 ++++
 xen/include/xen/tmem.h             | 26 ++++++++++++++++++++++++++
 xen/include/xen/tmem_xen.h         | 11 +++++++++++
 7 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S
index 927439d..5218f8a 100644
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -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
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index dd7f114..cab9763 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -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
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 8fbc46d..39b0fa7 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -87,6 +87,16 @@ config LATE_HWDOM
 
 	  If unsure, say N.
 
+# Enables transactional memory support
+config TMEM
+	def_bool y
+	prompt "Transactional 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.
+
 # Adds support for Xenoprof
 config XENOPROF
 	def_bool y
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 82625a5..bc056de 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -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,12 @@ 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-y += tmem_xen.o
+tmem-$(CONFIG_COMPAT) += compat/tmem_xen.o
+obj-$(CONFIG_TMEM) += $(tmem-y)
 
 subdir-$(CONFIG_X86) += hvm
 
diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h
index 26cb615..0c8ae0e 100644
--- a/xen/include/xen/hypercall.h
+++ b/xen/include/xen/hypercall.h
@@ -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);
diff --git a/xen/include/xen/tmem.h b/xen/include/xen/tmem.h
index 32a542a..414a14d 100644
--- a/xen/include/xen/tmem.h
+++ b/xen/include/xen/tmem.h
@@ -11,9 +11,35 @@
 
 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__ */
diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h
index f516bbe..19ed835 100644
--- a/xen/include/xen/tmem_xen.h
+++ b/xen/include/xen/tmem_xen.h
@@ -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
-- 
2.4.10


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-03-15 20:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15 20:18 [PATCH v2 0/3] Allow tmem to be disabled via Kconfig Doug Goldstein
2016-03-15 20:18 ` [PATCH v2 1/3] tmem: add tmem_disable() function Doug Goldstein
2016-03-15 20:18 ` [PATCH v2 2/3] tmem: drop direct usage of opt_tmem Doug Goldstein
2016-03-16  8:41   ` Jan Beulich
2016-03-15 20:18 ` Doug Goldstein [this message]
2016-03-16  7:35   ` [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig Konrad Rzeszutek Wilk
2016-03-16  8:39     ` Jan Beulich
2016-03-16  8:55       ` Konrad Rzeszutek Wilk
2016-03-16  8:47   ` Jan Beulich
2016-03-16 12:54     ` Doug Goldstein
2016-03-16 13:34       ` Jan Beulich

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=1458073130-5126-4-git-send-email-cardoe@cardoe.com \
    --to=cardoe@cardoe.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.