From: Daniel De Graaf <dgdegra@tycho.nsa.gov>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 11/21] mini-os: make frontends and xenbus optional
Date: Mon, 23 Jan 2012 11:21:42 -0500 [thread overview]
Message-ID: <4F1D8916.3050409@tycho.nsa.gov> (raw)
In-Reply-To: <1327323081.24561.108.camel@zakaz.uk.xensource.com>
On 01/23/2012 07:51 AM, Ian Campbell wrote:
> On Fri, 2012-01-20 at 20:47 +0000, Daniel De Graaf wrote:
>> This adds compile-time logic to disable certain frontends in mini-os:
>> - pcifront is disabled by default, enabled for ioemu
>> - blkfront, netfront, fbfront, and kbdfront are enabled by default
>> - xenbus is required for any frontend, and is enabled by default
>>
>> If all frontends and xenbus are disabled, mini-os will run without
>> needing to communicate with xenstore, making it suitable to run the
>> xenstore daemon.
>>
>> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
>> ---
>> extras/mini-os/Makefile | 5 +++-
>> extras/mini-os/apps/common.mk | 11 +++++++++
>> extras/mini-os/apps/ioemu.mk | 1 +
>> extras/mini-os/console/xencons_ring.c | 15 ++++++++++--
>> extras/mini-os/files.mk | 12 +++++-----
>> extras/mini-os/include/lib.h | 2 +
>> extras/mini-os/kernel.c | 40 +++++++++++++++++++++++++++++++-
>> extras/mini-os/lib/sys.c | 28 +++++++++++++++++++++++
>> extras/mini-os/main.c | 6 +++-
>> 9 files changed, 106 insertions(+), 14 deletions(-)
>>
>> diff --git a/extras/mini-os/Makefile b/extras/mini-os/Makefile
>> index af7d0d4..7419211 100644
>> --- a/extras/mini-os/Makefile
>> +++ b/extras/mini-os/Makefile
>> @@ -70,7 +70,10 @@ ifeq ($(lwip),y)
>> LWC := $(shell find $(LWIPDIR)/ -type f -name '*.c')
>> LWC := $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
>> LWO := $(patsubst %.c,%.o,$(LWC))
>> -LWO += $(addprefix $(OBJ_DIR)/,lwip-arch.o lwip-net.o)
>> +LWO += $(OBJ_DIR)/lwip-arch.o
>> +ifeq ($(CONFIG_NETFRONT),y)
>> +LWO += $(OBJ_DIR)/lwip-net.o
>> +endif
>
> Without lwip-net.o is there any point in having the rest of LWO? Or does
> the linker optimise it all away anyway?
>
Some of the other parts of LWO may be useful on their own, depending on the
application run under minios. The xenstored configuration disables all of
LWO, so this doesn't matter there; the vTPM stub domains (from patches sent
by Matthew Fioravante in March 2011) do use parts of LWO without needing
netfront support, which prompted this configuration test.
> [...]
>
>> diff --git a/extras/mini-os/console/xencons_ring.c b/extras/mini-os/console/xencons_ring.c
>> index af0afed..c3eba35 100644
>> --- a/extras/mini-os/console/xencons_ring.c
>> +++ b/extras/mini-os/console/xencons_ring.c
>> @@ -189,6 +189,7 @@ struct consfront_dev *xencons_ring_init(void)
>>
>> void free_consfront(struct consfront_dev *dev)
>> {
>> +#ifdef CONFIG_XENBUS
>> char* err = NULL;
>> XenbusState state;
>>
>> @@ -217,6 +218,7 @@ void free_consfront(struct consfront_dev *dev)
>> close:
>> if (err) free(err);
>> xenbus_unwatch_path_token(XBT_NIL, path, path);
>> +#endif
>>
>> mask_evtchn(dev->evtchn);
>> unbind_evtchn(dev->evtchn);
>> @@ -231,16 +233,18 @@ close:
>>
>> struct consfront_dev *init_consfront(char *_nodename)
>> {
>> + struct consfront_dev *dev;
>> + char nodename[256];
>> + static int consfrontends = 3;
>> +#ifdef CONFIG_XENBUS
>> xenbus_transaction_t xbt;
>> char* err;
>> char* message=NULL;
>> int retry=0;
>> char* msg = NULL;
>> - char nodename[256];
>> char path[256];
>> - static int consfrontends = 3;
>> - struct consfront_dev *dev;
>> int res;
>> +#endif
>>
>> if (!_nodename)
>> snprintf(nodename, sizeof(nodename), "device/console/%d", consfrontends);
>> @@ -257,6 +261,7 @@ struct consfront_dev *init_consfront(char *_nodename)
>> dev->fd = -1;
>> #endif
>>
>> +#ifdef CONFIG_XENBUS
>> snprintf(path, sizeof(path), "%s/backend-id", nodename);
>> if ((res = xenbus_read_integer(path)) < 0)
>> return NULL;
>> @@ -351,17 +356,21 @@ done:
>> goto error;
>> }
>> }
>> +#endif
>
> Haven't you ifdef'd out everything which would have set dev->evtchn?
Hmm, I might have. Will address it in the cleanup from the second mail.
>
> I'm not sure that the CONFIG_XENBUS is worthwhile, at least at the
> moment, and it seems to add an awful lot of ifdefery.
>
> [...]
>> diff --git a/extras/mini-os/kernel.c b/extras/mini-os/kernel.c
>> index 2875bf1..9e490d5 100644
>> --- a/extras/mini-os/kernel.c
>> +++ b/extras/mini-os/kernel.c
>> [...]
>> @@ -462,11 +474,21 @@ __attribute__((weak)) int app_main(start_info_t *si)
>> printk("Dummy main: start_info=%p\n", si);
>> create_thread("xenbus_tester", xenbus_tester, si);
>> create_thread("periodic_thread", periodic_thread, si);
>> +#ifdef CONFIG_NETFRONT
>> create_thread("netfront", netfront_thread, si);
>> +#endif
>
> Better to define init_FOOfront for each of these and have it be a nop in
> the ifndef case and avoid the ifdefs in the code itself.
>
> Likewise the ifdef's in the teardown. Ideally the actual meat in the
> ifdef cases would be moved into the files you aren't compiling (e.g.
> netfront_thread goes into netfront.c) and only the stubs remain in some
> header somewhere.
>
> Ian.
>
The majority of kernel.c seems to be test code intended to be overridden
by the application; see the comment above app_main:
/* This should be overridden by the application we are linked against. */
__attribute__((weak)) int app_main(start_info_t *si)
As such, maybe all of this code should be moved out of kernel.c and into
test.c, and have a better noop app_main in kernel.c.
--
Daniel De Graaf
National Security Agency
next prev parent reply other threads:[~2012-01-23 16:21 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 20:47 [PATCH v3 00/21] Xenstore stub domain Daniel De Graaf
2012-01-20 20:47 ` [PATCH 01/21] xen: reinstate previously unused XENMEM_remove_from_physmap hypercall Daniel De Graaf
2012-01-20 20:47 ` [PATCH 02/21] xen: allow global VIRQ handlers to be delegated to other domains Daniel De Graaf
2012-01-20 20:47 ` [PATCH 03/21] xen: change virq parameters from int to uint32_t Daniel De Graaf
2012-01-20 20:47 ` [PATCH 04/21] xen: use XSM instead of IS_PRIV for getdomaininfo Daniel De Graaf
2012-01-20 20:47 ` [PATCH 05/21] xen: Preserve reserved grant entries when switching versions Daniel De Graaf
2012-01-20 20:47 ` [PATCH 06/21] tools/libxl: pull xenstore/console domids from xenstore Daniel De Graaf
2012-01-20 20:47 ` [PATCH 07/21] lib{xc, xl}: Seed grant tables with xenstore and console grants Daniel De Graaf
2012-01-23 12:26 ` Ian Campbell
2012-01-20 20:47 ` [PATCH 08/21] mini-os: avoid crash if no console is provided Daniel De Graaf
2012-01-20 20:47 ` [PATCH 09/21] mini-os: remove per-fd evtchn limit Daniel De Graaf
2012-01-20 20:47 ` [PATCH 10/21] mini-os: create app-specific configuration Daniel De Graaf
2012-01-23 12:41 ` Ian Campbell
2012-01-23 16:05 ` Daniel De Graaf
2012-01-23 16:23 ` Ian Campbell
2012-01-20 20:47 ` [PATCH 11/21] mini-os: make frontends and xenbus optional Daniel De Graaf
2012-01-23 12:51 ` Ian Campbell
2012-01-23 16:21 ` Daniel De Graaf [this message]
2012-01-23 16:24 ` Ian Campbell
2012-01-23 13:29 ` Ian Campbell
2012-01-23 16:21 ` Daniel De Graaf
2012-01-20 20:47 ` [PATCH 12/21] mini-os: fix list.h include guard name Daniel De Graaf
2012-01-20 20:47 ` [PATCH 13/21] xenstored: use grant references instead of map_foreign_range Daniel De Graaf
2012-01-23 13:06 ` Ian Campbell
2012-01-20 20:47 ` [PATCH 14/21] xenstored: add NO_SOCKETS compilation option Daniel De Graaf
2012-01-23 10:33 ` Stefano Stabellini
2012-01-23 13:12 ` Ian Campbell
2012-01-20 20:47 ` [PATCH 15/21] xenstored: support for tdb_copy with TDB_INTERNAL Daniel De Graaf
2012-01-23 13:14 ` Ian Campbell
2012-01-20 20:47 ` [PATCH 16/21] xenstored: support running in minios stubdom Daniel De Graaf
2012-01-23 10:39 ` Stefano Stabellini
2012-01-20 20:47 ` [PATCH 17/21] stubdom: enable xenstored build Daniel De Graaf
2012-01-23 13:17 ` Ian Campbell
2012-01-20 20:47 ` [PATCH 18/21] xenstored: add --event parameter for bootstrapping Daniel De Graaf
2012-01-20 20:47 ` [PATCH 19/21] xenstored: use domain_is_unprivileged instead of checking conn->id Daniel De Graaf
2012-01-20 20:47 ` [PATCH 20/21] xenstored: add --priv-domid parameter Daniel De Graaf
2012-01-20 20:47 ` [PATCH 21/21] xenstored: Add stub domain builder Daniel De Graaf
2012-01-23 13:52 ` Ian Campbell
2012-01-23 14:26 ` Stefano Stabellini
2012-01-23 14:31 ` Ian Campbell
2012-01-20 20:47 ` [PATCH] xenbus: Add support for xenbus backend in stub domain Daniel De Graaf
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=4F1D8916.3050409@tycho.nsa.gov \
--to=dgdegra@tycho.nsa.gov \
--cc=Ian.Campbell@citrix.com \
--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 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.