xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Allow tmem to be disabled via Kconfig
@ 2016-03-15 20:18 Doug Goldstein
  2016-03-15 20:18 ` [PATCH v2 1/3] tmem: add tmem_disable() function Doug Goldstein
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Doug Goldstein @ 2016-03-15 20:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Doug Goldstein

Allows expert users to disable tmem  via Kconfig. Incorporates feedback
from Jan and Konrad. Patch 2 & 3 from v1 were merged and patch 4 was
dropped.

Doug Goldstein (3):
  tmem: add tmem_disable() function
  tmem: drop direct usage of opt_tmem
  tmem: allow tmem to be disabled with Kconfig

 xen/arch/x86/setup.c               |  6 +++---
 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/common/memory.c                |  2 +-
 xen/common/page_alloc.c            |  8 ++++----
 xen/common/tmem.c                  |  3 +++
 xen/include/xen/hypercall.h        |  4 ++++
 xen/include/xen/tmem.h             | 26 ++++++++++++++++++++++++++
 xen/include/xen/tmem_xen.h         | 16 ++++++++++++++++
 11 files changed, 81 insertions(+), 11 deletions(-)

-- 
2.4.10


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/3] tmem: add tmem_disable() function
  2016-03-15 20:18 [PATCH v2 0/3] Allow tmem to be disabled via Kconfig Doug Goldstein
@ 2016-03-15 20:18 ` Doug Goldstein
  2016-03-15 20:18 ` [PATCH v2 2/3] tmem: drop direct usage of opt_tmem Doug Goldstein
  2016-03-15 20:18 ` [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig Doug Goldstein
  2 siblings, 0 replies; 11+ messages in thread
From: Doug Goldstein @ 2016-03-15 20:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser, Doug Goldstein, Jan Beulich, Andrew Cooper

Instead of manipulating the opt_tmem variable directly utilize a wrapper
function.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Jan Beulich <jbeulich@suse.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>

change since v1:
- none
---
 xen/arch/x86/setup.c       | 4 ++--
 xen/include/xen/tmem_xen.h | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index a8bf2c9..5011930 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -25,7 +25,7 @@
 #include <xen/dmi.h>
 #include <xen/pfn.h>
 #include <xen/nodemask.h>
-#include <xen/tmem_xen.h> /* for opt_tmem only */
+#include <xen/tmem_xen.h>
 #include <xen/watchdog.h>
 #include <public/version.h>
 #include <compat/platform.h>
@@ -1276,7 +1276,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         {
            printk(XENLOG_WARNING
                   "TMEM physical RAM limit exceeded, disabling TMEM\n");
-           opt_tmem = 0;
+           tmem_disable();
         }
     }
     else
diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h
index c770f3e..f516bbe 100644
--- a/xen/include/xen/tmem_xen.h
+++ b/xen/include/xen/tmem_xen.h
@@ -69,6 +69,11 @@ static inline bool_t tmem_enabled(void)
     return opt_tmem;
 }
 
+static inline void tmem_disable(void)
+{
+    opt_tmem = 0;
+}
+
 /*
  * Memory free page list management
  */
-- 
2.4.10


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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 2/3] tmem: drop direct usage of opt_tmem
  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 ` Doug Goldstein
  2016-03-16  8:41   ` Jan Beulich
  2016-03-15 20:18 ` [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig Doug Goldstein
  2 siblings, 1 reply; 11+ messages in thread
From: Doug Goldstein @ 2016-03-15 20:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser, Doug Goldstein, Jan Beulich, Andrew Cooper

Don't use the opt_tmem variable to check if tmem is enabled, instead use
the tmem_enabled() helper function everywhere.

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>

change since v1:
- merged patch 2 and 3
---
 xen/arch/x86/setup.c    | 2 +-
 xen/common/memory.c     | 2 +-
 xen/common/page_alloc.c | 8 ++++----
 xen/common/tmem.c       | 3 +++
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 5011930..c5c332d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1272,7 +1272,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
             init_domheap_pages(s, e);
         }
 
-        if ( opt_tmem )
+        if ( tmem_enabled() )
         {
            printk(XENLOG_WARNING
                   "TMEM physical RAM limit exceeded, disabling TMEM\n");
diff --git a/xen/common/memory.c b/xen/common/memory.c
index ef57219..c7fca96 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -202,7 +202,7 @@ static void populate_physmap(struct memop_args *a)
 
                 if ( unlikely(!page) )
                 {
-                    if ( !opt_tmem || a->extent_order )
+                    if ( !tmem_enabled() || a->extent_order )
                         gdprintk(XENLOG_INFO,
                                  "Could not allocate order=%u extent: id=%d memflags=%#x (%u of %u)\n",
                                  a->extent_order, d->domain_id, a->memflags,
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 22e8feb..98e30e5 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -652,7 +652,7 @@ static void __init setup_low_mem_virq(void)
 static void check_low_mem_virq(void)
 {
     unsigned long avail_pages = total_avail_pages +
-        (opt_tmem ? tmem_freeable_pages() : 0) - outstanding_claims;
+        tmem_freeable_pages() - outstanding_claims;
 
     if ( unlikely(avail_pages <= low_mem_virq_th) )
     {
@@ -738,7 +738,7 @@ static struct page_info *alloc_heap_pages(
      * Others try tmem pools then fail.  This is a workaround until all
      * post-dom0-creation-multi-page allocations can be eliminated.
      */
-    if ( opt_tmem && ((order == 0) || (order >= 9)) &&
+    if ( ((order == 0) || (order >= 9)) &&
          (total_avail_pages <= midsize_alloc_zone_pages) &&
          tmem_freeable_pages() )
         goto try_tmem;
@@ -984,7 +984,7 @@ static void free_heap_pages(
     avail[node][zone] += 1 << order;
     total_avail_pages += 1 << order;
 
-    if ( opt_tmem )
+    if ( tmem_enabled() )
         midsize_alloc_zone_pages = max(
             midsize_alloc_zone_pages, total_avail_pages / MIDSIZE_ALLOC_FRAC);
 
@@ -1755,7 +1755,7 @@ int assign_pages(
     {
         if ( unlikely((d->tot_pages + (1 << order)) > d->max_pages) )
         {
-            if ( !opt_tmem || order != 0 || d->tot_pages != d->max_pages )
+            if ( !tmem_enabled() || order != 0 || d->tot_pages != d->max_pages )
                 gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
                         "%u > %u\n", d->domain_id,
                         d->tot_pages + (1 << order), d->max_pages);
diff --git a/xen/common/tmem.c b/xen/common/tmem.c
index 0436e49..16e249a 100644
--- a/xen/common/tmem.c
+++ b/xen/common/tmem.c
@@ -2837,6 +2837,9 @@ void *tmem_relinquish_pages(unsigned int order, unsigned int memflags)
 
 unsigned long tmem_freeable_pages(void)
 {
+    if ( !tmem_enabled() )
+        return 0;
+
     return tmem_page_list_pages + _atomic_read(freeable_page_count);
 }
 
-- 
2.4.10


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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig
  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-15 20:18 ` Doug Goldstein
  2016-03-16  7:35   ` Konrad Rzeszutek Wilk
  2016-03-16  8:47   ` Jan Beulich
  2 siblings, 2 replies; 11+ messages in thread
From: Doug Goldstein @ 2016-03-15 20:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser, Doug Goldstein, Jan Beulich, Andrew Cooper

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig
  2016-03-15 20:18 ` [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig Doug Goldstein
@ 2016-03-16  7:35   ` Konrad Rzeszutek Wilk
  2016-03-16  8:39     ` Jan Beulich
  2016-03-16  8:47   ` Jan Beulich
  1 sibling, 1 reply; 11+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-03-16  7:35 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: Andrew Cooper, Keir Fraser, Jan Beulich, xen-devel

On Tue, Mar 15, 2016 at 03:18:50PM -0500, Doug Goldstein wrote:
> Wrap the various tmem functions with the Kconfig generated CONFIG_TMEM
> option allowing users to build Xen without tmem support.

I ended with this change on top of yours (which I will squash):

The 'bool "tmem" so that if I did make an change in .config
file it would still take effect even if I forgot XEN_CONFIG_EXPERT.

Otherwise it would keep on making it

CONFIG_TMEM=y
instead of the

# CONFIG_TMEM is not set.

which I wrote in the .config file.

From b9d173eb0e0e1274c784fde5580b119d6f7b4bdc Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date: Wed, 16 Mar 2016 03:28:39 -0400
Subject: [PATCH] squash!     tmem: allow tmem to be disabled with Kconfig

---
 xen/common/Kconfig | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 39b0fa7..5bd8a84 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -87,16 +87,21 @@ config LATE_HWDOM
 
 	  If unsure, say N.
 
-# Enables transactional memory support
+# Enables transcendent memory support
 config TMEM
 	def_bool y
-	prompt "Transactional Memory Support" if EXPERT = "y"
+	bool "tmem"
+	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
-- 
2.5.0

> 
> 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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig
  2016-03-16  7:35   ` Konrad Rzeszutek Wilk
@ 2016-03-16  8:39     ` Jan Beulich
  2016-03-16  8:55       ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Beulich @ 2016-03-16  8:39 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Andrew Cooper, Keir Fraser, Doug Goldstein, xen-devel

>>> On 16.03.16 at 08:35, <konrad.wilk@oracle.com> wrote:
> On Tue, Mar 15, 2016 at 03:18:50PM -0500, Doug Goldstein wrote:
>> Wrap the various tmem functions with the Kconfig generated CONFIG_TMEM
>> option allowing users to build Xen without tmem support.
> 
> I ended with this change on top of yours (which I will squash):
> 
> The 'bool "tmem" so that if I did make an change in .config
> file it would still take effect even if I forgot XEN_CONFIG_EXPERT.
> 
> Otherwise it would keep on making it
> 
> CONFIG_TMEM=y
> instead of the
> 
> # CONFIG_TMEM is not set.
> 
> which I wrote in the .config file.
> 
> From b9d173eb0e0e1274c784fde5580b119d6f7b4bdc Mon Sep 17 00:00:00 2001
> From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Date: Wed, 16 Mar 2016 03:28:39 -0400
> Subject: [PATCH] squash!     tmem: allow tmem to be disabled with Kconfig
> 
> ---
>  xen/common/Kconfig | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/common/Kconfig b/xen/common/Kconfig
> index 39b0fa7..5bd8a84 100644
> --- a/xen/common/Kconfig
> +++ b/xen/common/Kconfig
> @@ -87,16 +87,21 @@ config LATE_HWDOM
>  
>  	  If unsure, say N.
>  
> -# Enables transactional memory support
> +# Enables transcendent memory support
>  config TMEM
>  	def_bool y
> -	prompt "Transactional Memory Support" if EXPERT = "y"
> +	bool "tmem"
> +	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.

But that will, afaict, disable tmem by default. Forgetting to set
XEN_CONFIG_EXPERT is, well, a mistake that results in a config
change just like the one you've observed.

Jan


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/3] tmem: drop direct usage of opt_tmem
  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
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Beulich @ 2016-03-16  8:41 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: Andrew Cooper, Keir Fraser, xen-devel

>>> On 15.03.16 at 21:18, <cardoe@cardoe.com> wrote:
> Don't use the opt_tmem variable to check if tmem is enabled, instead use
> the tmem_enabled() helper function everywhere.
> 
> 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>
> 
> change since v1:
> - merged patch 2 and 3

Which should have resulted in some adjustment to the commit
message I would say. But anyway:
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig
  2016-03-15 20:18 ` [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig Doug Goldstein
  2016-03-16  7:35   ` Konrad Rzeszutek Wilk
@ 2016-03-16  8:47   ` Jan Beulich
  2016-03-16 12:54     ` Doug Goldstein
  1 sibling, 1 reply; 11+ messages in thread
From: Jan Beulich @ 2016-03-16  8:47 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: Andrew Cooper, Keir Fraser, xen-devel

>>> On 15.03.16 at 21:18, <cardoe@cardoe.com> wrote:
> 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

Only kind of:

> @@ -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

I had intentionally suggested

tmem-y := tmem.o tmem_xen.o

Splitting this up into two lines is a matter of taste, but not using := is
inefficient, as it requires make to possibly expand the variable many
times instead of just once.

But anyway - since functionality wise this is fine, with or without that
further adjustment
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig
  2016-03-16  8:39     ` Jan Beulich
@ 2016-03-16  8:55       ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 11+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-03-16  8:55 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andrew Cooper, Keir Fraser, Doug Goldstein, xen-devel

On Wed, Mar 16, 2016 at 02:39:02AM -0600, Jan Beulich wrote:
> >>> On 16.03.16 at 08:35, <konrad.wilk@oracle.com> wrote:
> > On Tue, Mar 15, 2016 at 03:18:50PM -0500, Doug Goldstein wrote:
> >> Wrap the various tmem functions with the Kconfig generated CONFIG_TMEM
> >> option allowing users to build Xen without tmem support.
> > 
> > I ended with this change on top of yours (which I will squash):
> > 
> > The 'bool "tmem" so that if I did make an change in .config
> > file it would still take effect even if I forgot XEN_CONFIG_EXPERT.
> > 
> > Otherwise it would keep on making it
> > 
> > CONFIG_TMEM=y
> > instead of the
> > 
> > # CONFIG_TMEM is not set.
> > 
> > which I wrote in the .config file.
> > 
> > From b9d173eb0e0e1274c784fde5580b119d6f7b4bdc Mon Sep 17 00:00:00 2001
> > From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > Date: Wed, 16 Mar 2016 03:28:39 -0400
> > Subject: [PATCH] squash!     tmem: allow tmem to be disabled with Kconfig
> > 
> > ---
> >  xen/common/Kconfig | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/xen/common/Kconfig b/xen/common/Kconfig
> > index 39b0fa7..5bd8a84 100644
> > --- a/xen/common/Kconfig
> > +++ b/xen/common/Kconfig
> > @@ -87,16 +87,21 @@ config LATE_HWDOM
> >  
> >  	  If unsure, say N.
> >  
> > -# Enables transactional memory support
> > +# Enables transcendent memory support
> >  config TMEM
> >  	def_bool y
> > -	prompt "Transactional Memory Support" if EXPERT = "y"
> > +	bool "tmem"
> > +	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.
> 
> But that will, afaict, disable tmem by default. Forgetting to set

You are correct. I didn't clear my tree to test that. Removing that
bool "tmem".

> XEN_CONFIG_EXPERT is, well, a mistake that results in a config
> change just like the one you've observed.
> 
> Jan
> 

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig
  2016-03-16  8:47   ` Jan Beulich
@ 2016-03-16 12:54     ` Doug Goldstein
  2016-03-16 13:34       ` Jan Beulich
  0 siblings, 1 reply; 11+ messages in thread
From: Doug Goldstein @ 2016-03-16 12:54 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andrew Cooper, Keir Fraser, xen-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 1587 bytes --]

On 3/16/16 3:47 AM, Jan Beulich wrote:
>>>> On 15.03.16 at 21:18, <cardoe@cardoe.com> wrote:
>> 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
> 
> Only kind of:
> 
>> @@ -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
> 
> I had intentionally suggested
> 
> tmem-y := tmem.o tmem_xen.o
> 
> Splitting this up into two lines is a matter of taste, but not using := is
> inefficient, as it requires make to possibly expand the variable many
> times instead of just once.
> 
> But anyway - since functionality wise this is fine, with or without that
> further adjustment
> Acked-by: Jan Beulich <jbeulich@suse.com>
> 
> Jan
> 

You're right. Its worth correcting. I'll post a v3. Can I retain your
Acked-by?

-- 
Doug Goldstein


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 959 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig
  2016-03-16 12:54     ` Doug Goldstein
@ 2016-03-16 13:34       ` Jan Beulich
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Beulich @ 2016-03-16 13:34 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: Andrew Cooper, Keir Fraser, xen-devel

>>> On 16.03.16 at 13:54, <cardoe@cardoe.com> wrote:
> On 3/16/16 3:47 AM, Jan Beulich wrote:
>>>>> On 15.03.16 at 21:18, <cardoe@cardoe.com> wrote:
>>> 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
>> 
>> Only kind of:
>> 
>>> @@ -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
>> 
>> I had intentionally suggested
>> 
>> tmem-y := tmem.o tmem_xen.o
>> 
>> Splitting this up into two lines is a matter of taste, but not using := is
>> inefficient, as it requires make to possibly expand the variable many
>> times instead of just once.
>> 
>> But anyway - since functionality wise this is fine, with or without that
>> further adjustment
>> Acked-by: Jan Beulich <jbeulich@suse.com>
>> 
>> Jan
>> 
> 
> You're right. Its worth correcting. I'll post a v3. Can I retain your
> Acked-by?

Sure - I had said so already (see above).

Jan


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-03-16 13:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v2 3/3] tmem: allow tmem to be disabled with Kconfig Doug Goldstein
2016-03-16  7:35   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).