xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Andrew Jones <drjones@redhat.com>
Cc: jeremy@goop.org, xen-devel@lists.xensource.com,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 4/4] xen kconfig: describe xen tmem in the config menu
Date: Mon, 23 Jan 2012 13:34:54 -0500	[thread overview]
Message-ID: <20120123183454.GA12542@phenom.dumpdata.com> (raw)
In-Reply-To: <1325842991-4404-5-git-send-email-drjones@redhat.com>

On Fri, Jan 06, 2012 at 10:43:11AM +0100, Andrew Jones wrote:
> Add a description to the config menu for xen tmem.

I am not sure what this patch gets us. If this is to minimize the
size of the module - so say it gets loaded, but tmem-enabled is 
not set nor cleancache and we just have it consuming memory - we can do it
via returning -ENODEV on the module load.

Like this (completley untested nor compiled tested):

>From 45b49b5d565c52e4396dae036ddb4f4094d914ec Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date: Mon, 23 Jan 2012 13:32:17 -0500
Subject: [PATCH] xen/tmem: Return -ENODEV if the backends are not registered.

.. otherwise the driver might still reside in the memory consuming
memory (that is the theory at least).

CC: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/xen/tmem.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index d369965..e61b5a3 100644
--- a/drivers/xen/tmem.c
+++ b/drivers/xen/tmem.c
@@ -377,8 +377,10 @@ static struct frontswap_ops tmem_frontswap_ops = {
 
 static int __init xen_tmem_init(void)
 {
+	bool loaded = false;
+
 	if (!xen_domain())
-		return 0;
+		return -ENODEV;
 #ifdef CONFIG_FRONTSWAP
 	if (tmem_enabled && use_frontswap) {
 		char *s = "";
@@ -390,6 +392,7 @@ static int __init xen_tmem_init(void)
 			s = " (WARNING: frontswap_ops overridden)";
 		printk(KERN_INFO "frontswap enabled, RAM provided by "
 				 "Xen Transcendent Memory\n");
+		loaded = true;
 	}
 #endif
 #ifdef CONFIG_CLEANCACHE
@@ -402,9 +405,10 @@ static int __init xen_tmem_init(void)
 			s = " (WARNING: cleancache_ops overridden)";
 		printk(KERN_INFO "cleancache enabled, RAM provided by "
 				 "Xen Transcendent Memory%s\n", s);
+		loaded = true;
 	}
 #endif
-	return 0;
+	return loaded ? 0 : -ENODEV;
 }
 
 module_init(xen_tmem_init)
-- 
1.7.7.5


> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  drivers/xen/Kconfig |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
> index 1d24061..7e8d728 100644
> --- a/drivers/xen/Kconfig
> +++ b/drivers/xen/Kconfig
> @@ -143,7 +143,7 @@ config SWIOTLB_XEN
>  	select SWIOTLB
>  
>  config XEN_TMEM
> -	bool
> +	bool "Xen Transcendent Memory (tmem)"
>  	default y if (CLEANCACHE || FRONTSWAP)
>  	help
>  	  Shim to interface in-kernel Transcendent Memory hooks
> -- 
> 1.7.7.5

  reply	other threads:[~2012-01-23 18:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06  9:43 [PATCH 0/4] xen kconfig tweaks Andrew Jones
2012-01-06  9:43 ` [PATCH 1/4] xen kconfig: keep XEN_XENBUS_FRONTEND builtin Andrew Jones
2012-01-06  9:43 ` [PATCH 2/4] xen kconfig: relax INPUT_XEN_KBDDEV_FRONTEND deps Andrew Jones
2012-01-06 15:46   ` [Xen-devel] " Konrad Rzeszutek Wilk
2012-01-06 15:58     ` Andrew Jones
2012-01-09  7:59       ` Dmitry Torokhov
2012-01-09 10:43         ` [Xen-devel] " Andrew Jones
2012-01-09 17:51           ` [PATCH 2/4 v2] " Andrew Jones
2012-01-11 16:11             ` [Xen-devel] " Konrad Rzeszutek Wilk
2012-01-11 16:29               ` Andrew Jones
2012-03-15 17:23                 ` Konrad Rzeszutek Wilk
2012-03-16  6:24                   ` Dmitry Torokhov
2012-03-16 14:48                     ` Konrad Rzeszutek Wilk
2012-01-23 18:35   ` [PATCH 2/4] " Konrad Rzeszutek Wilk
2012-01-06  9:43 ` [PATCH 3/4] xen kconfig: add dom0 support help text Andrew Jones
2012-01-09 18:07   ` [PATCH 3/4 v2] " Andrew Jones
2012-01-11 15:45     ` [Xen-devel] " Andrew Jones
2012-01-23 18:42   ` [PATCH 3/4] " Konrad Rzeszutek Wilk
2012-01-06  9:43 ` [PATCH 4/4] xen kconfig: describe xen tmem in the config menu Andrew Jones
2012-01-23 18:34   ` Konrad Rzeszutek Wilk [this message]
2012-01-24  8:30     ` Igor Mammedov
2012-01-24 17:38       ` [Xen-devel] " Konrad Rzeszutek Wilk
  -- strict thread matches above, loose matches on Subject: below --
2012-01-11 16:19 [Xen-devel] [PATCH] xen: remove CONFIG_XEN_DOM0 compile option Konrad Rzeszutek Wilk
2012-01-11 16:36 ` [PATCH 1/4] xen kconfig: keep XEN_XENBUS_FRONTEND builtin Andrew Jones
2012-01-11 16:36   ` [PATCH 4/4] xen kconfig: describe xen tmem in the config menu Andrew Jones
2012-01-11 17:35     ` Konrad Rzeszutek Wilk
2012-01-12 10:54       ` Andrew Jones
2012-01-06  8:57 [PATCH 0/4] xen kconfig tweaks Andrew Jones
2012-01-06  8:57 ` [PATCH 4/4] xen kconfig: describe xen tmem in the config menu Andrew Jones

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=20120123183454.GA12542@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=drjones@redhat.com \
    --cc=jeremy@goop.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xen-devel@lists.xensource.com \
    /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 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).