From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Bastian Blank <waldi@debian.org>
Cc: xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] xen/xenbus-backend: Only register device if communication ring is local
Date: Mon, 12 Dec 2011 10:42:27 -0500 [thread overview]
Message-ID: <20111212154227.GB21558@phenom.dumpdata.com> (raw)
In-Reply-To: <1323541791-18006-7-git-send-email-waldi@debian.org>
On Sat, Dec 10, 2011 at 07:29:51PM +0100, Bastian Blank wrote:
> Signed-off-by: Bastian Blank <waldi@debian.org>
> ---
> drivers/xen/xenbus/Makefile | 2 +-
> drivers/xen/xenbus/xenbus_dev_backend.c | 13 ++-----------
> drivers/xen/xenbus/xenbus_dev_backend.h | 2 ++
> drivers/xen/xenbus/xenbus_probe.c | 18 ++++++++++++++++++
> 4 files changed, 23 insertions(+), 12 deletions(-)
> create mode 100644 drivers/xen/xenbus/xenbus_dev_backend.h
>
> diff --git a/drivers/xen/xenbus/Makefile b/drivers/xen/xenbus/Makefile
> index 31e2e90..d751f45 100644
> --- a/drivers/xen/xenbus/Makefile
> +++ b/drivers/xen/xenbus/Makefile
> @@ -7,8 +7,8 @@ xenbus-objs += xenbus_comms.o
> xenbus-objs += xenbus_xs.o
> xenbus-objs += xenbus_probe.o
>
> +xenbus-be-objs-$(CONFIG_XEN_BACKEND) += xenbus_dev_backend.o
> xenbus-be-objs-$(CONFIG_XEN_BACKEND) += xenbus_probe_backend.o
> xenbus-objs += $(xenbus-be-objs-y)
>
> -obj-$(CONFIG_XEN_BACKEND) += xenbus_dev_backend.o
> obj-$(CONFIG_XEN_XENBUS_FRONTEND) += xenbus_probe_frontend.o
> diff --git a/drivers/xen/xenbus/xenbus_dev_backend.c b/drivers/xen/xenbus/xenbus_dev_backend.c
> index a2092bd..fb87f1b 100644
> --- a/drivers/xen/xenbus/xenbus_dev_backend.c
> +++ b/drivers/xen/xenbus/xenbus_dev_backend.c
> @@ -3,7 +3,6 @@
> #include <linux/mm.h>
> #include <linux/fs.h>
> #include <linux/miscdevice.h>
> -#include <linux/module.h>
> #include <linux/capability.h>
>
> #include <xen/page.h>
> @@ -11,8 +10,6 @@
>
> #include "xenbus_comms.h"
>
> -MODULE_LICENSE("GPL");
> -
> static int xenbus_backend_open(struct inode *inode, struct file *filp)
> {
> if (!capable(CAP_SYS_ADMIN))
> @@ -67,23 +64,17 @@ static struct miscdevice xenbus_backend_dev = {
> .fops = &xenbus_backend_fops,
> };
>
> -static int __init xenbus_backend_init(void)
> +int __init xenbus_backend_init(void)
> {
> int err;
>
> - if (!xen_initial_domain())
> - return -ENODEV;
> -
> err = misc_register(&xenbus_backend_dev);
> if (err)
> printk(KERN_ERR "Could not register xenbus backend device\n");
> return err;
> }
>
> -static void __exit xenbus_backend_exit(void)
> +void __exit xenbus_backend_exit(void)
> {
> misc_deregister(&xenbus_backend_dev);
> }
> -
> -module_init(xenbus_backend_init);
> -module_exit(xenbus_backend_exit);
Why are we removing the module functionality?
Can't this [the purpose of this patch] be done while still maintaining the module functionality?
> diff --git a/drivers/xen/xenbus/xenbus_dev_backend.h b/drivers/xen/xenbus/xenbus_dev_backend.h
> new file mode 100644
> index 0000000..d986853
> --- /dev/null
> +++ b/drivers/xen/xenbus/xenbus_dev_backend.h
> @@ -0,0 +1,2 @@
> +int xenbus_backend_init(void);
> +void xenbus_backend_exit(void);
> diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
> index 1b178c6..4eff095 100644
> --- a/drivers/xen/xenbus/xenbus_probe.c
> +++ b/drivers/xen/xenbus/xenbus_probe.c
> @@ -60,6 +60,7 @@
> #include <xen/hvm.h>
>
> #include "xenbus_comms.h"
> +#include "xenbus_dev_backend.h"
> #include "xenbus_probe.h"
>
>
> @@ -641,6 +642,10 @@ EXPORT_SYMBOL_GPL(xenbus_dev_cancel);
> /* A flag to determine if xenstored is 'ready' (i.e. has started) */
> int xenstored_ready;
>
> +/* A flag to determine if xenstored is 'local' */
> +#ifdef CONFIG_XEN_BACKEND
> +static int xenstored_local;
bool?
> +#endif
>
> int register_xenstore_notifier(struct notifier_block *nb)
> {
> @@ -675,6 +680,14 @@ static int __init xenbus_probe_initcall(void)
> if (!xen_domain())
> return -ENODEV;
>
> +#ifdef CONFIG_XEN_BACKEND
> + if (xenstored_local) {
> + int ret = xenbus_backend_init();
> + if (ret)
> + return ret;
> + }
> +#endif
> +
> if (xen_initial_domain() || xen_hvm_domain())
> return 0;
>
> @@ -747,9 +760,14 @@ static int __init xenbus_init(void)
> if (xen_store_evtchn)
> xenstored_ready = 1;
> else {
> +#ifdef CONFIG_XEN_BACKEND
> + xenstored_local = 1;
> err = xenstored_local_init();
> if (err)
> goto out_error;
> +#else
> + BUG();
No way. A WARN, sure - but BUG() is way too intense for this.
> +#endif
> }
> xen_store_interface = mfn_to_virt(xen_store_mfn);
> }
> --
> 1.7.7.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2011-12-12 15:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-10 18:29 [PATCH 0/6] V3, Move stuff out of xenfs Bastian Blank
2011-12-10 18:29 ` [PATCH 1/6] xen: Add privcmd device driver Bastian Blank
2011-12-14 18:54 ` Konrad Rzeszutek Wilk
2011-12-10 18:29 ` [PATCH 2/6] xen: Add xenbus " Bastian Blank
2011-12-10 18:29 ` [PATCH 3/6] xen: Add xenbus_backend device Bastian Blank
2011-12-10 18:29 ` [PATCH 4/6] xen/privcmd: Remove unused support for arch specific privcmp mmap Bastian Blank
2011-12-10 18:29 ` [PATCH 5/6] xen/xenbus-frontend: Make error message more clear Bastian Blank
2011-12-12 9:25 ` [Xen-devel] " Ian Campbell
2011-12-10 18:29 ` [PATCH 6/6] xen/xenbus-backend: Only register device if communication ring is local Bastian Blank
2011-12-12 9:30 ` [Xen-devel] " Ian Campbell
2011-12-12 15:42 ` Konrad Rzeszutek Wilk [this message]
2011-12-12 18:28 ` Bastian Blank
2011-12-14 19:22 ` Konrad Rzeszutek Wilk
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=20111212154227.GB21558@phenom.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=waldi@debian.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).