All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/18] Xenstore stub domain
@ 2012-01-11 17:21 Daniel De Graaf
  2012-01-11 17:21 ` [PATCH 01/18] xen: reinstate previously unused XENMEM_remove_from_physmap hypercall Daniel De Graaf
                   ` (22 more replies)
  0 siblings, 23 replies; 129+ messages in thread
From: Daniel De Graaf @ 2012-01-11 17:21 UTC (permalink / raw)
  To: xen-devel

This patch series allows xenstored to run in a stub domian started by
dom0. It is based on a patch series posted by Alex Zeffertt in 2009 -
http://old-list-archives.xen.org/archives/html/xen-devel/2009-03/msg01488.html


A domain configuration for starting xenstored looks like:

kernel='/home/daniel/xen/stubdom/mini-os-x86_64-xenstore/mini-os'
extra=''
memory=50
name='xenstore'

Once xenstore is started, "xenstore_dom=1" needs to be added to other
domain's configurations in order to set up the xenstore connection to
domain 1.

The following program handles post-creation parts of xenstored. To use
it, run "xl create -p xenstore" and then "init-xenstore $domid". The
running xenstored must be stopped to prevent xl using the UNIX sockets,
and xenconsoled needs to be restarted after switching xenstores.

/* init-xenstore.c: link with -lxenctrl */

#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/mman.h>

#define __XEN_TOOLS__
#include <xen/domctl.h>
#include "xenctrl.h"

#define IOCTL_XENBUS_BACKEND_SETUP _IOC(_IOC_NONE, 'B', 1, 0)
#define IOCTL_XENBUS_BACKEND_COMMIT _IOC(_IOC_NONE, 'B', 2, 0)

static void set_virq(int domid, int virq)
{
	struct xen_domctl command;
	xc_interface *xch;

	xch = xc_interface_open(NULL, NULL, 0);

	memset(&command, 0, sizeof(command)); 
	command.cmd               = XEN_DOMCTL_set_virq_handler;
	command.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
	command.domain            = domid;
	command.u.set_virq_handler.virq = virq;
	xc_domctl(xch, &command);
	xc_interface_close(xch);
}

int main(int argc, char** argv)
{
	char buf[512];
	int domid = atoi(argv[1]);

	set_virq(domid, VIRQ_DOM_EXC);

	int fd = open("/dev/xen/xenbus_backend", O_RDWR);
	void *map = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
	int rv = ioctl(fd, IOCTL_XENBUS_BACKEND_SETUP, domid);
	*(uint16_t*)(map + 0x810) = rv;
	snprintf(buf, 512, "xl unpause %d", domid);
	system(buf);
	ioctl(fd, IOCTL_XENBUS_BACKEND_COMMIT, 0);
	return 0;
}

-------------------------------------------------

Dom0 kernel changes:
    [PATCH] xenbus: Add support for xenbus backend in stub domain

This is based on the new /dev/xen devices introduced in Linux 3.3.

Hypervisor changes:
    [PATCH 01/18] xen: reinstate previously unused
    [PATCH 02/18] xen: allow global VIRQ handlers to be delegated to
    [PATCH 03/18] xsm: allow use of XEN_DOMCTL_getdomaininfo by
    [PATCH 04/18] xen: Preserve reserved grant entries when switching

Patch 1 & 4 are required for setting up grant entries in new domains.
Patch 2 & 3 allow xenstored to run in an unprivileged domain. This
currently requires XSM to be enabled to avoid allowing all domUs access
to XEN_DOMCTL_getdomaininfo, so the patch only allows this hypercall if
XSM is being compiled in.

Toolstack changes:
    [PATCH 05/18] tools/libxl: Add xenstore and console backend domain
    [PATCH 06/18] lib{xc,xl}: Seed grant tables with xenstore and

These patches populate two of the eight reserved grant entries in new
domains with the xenstore and console shared pages, which is required
if xenstored is not run in a privileged domain.

Minios and xenstored:
    [PATCH 07/18] mini-os: avoid crash if no console is provided
    [PATCH 08/18] mini-os: avoid crash if no xenstore is provided
    [PATCH 09/18] mini-os: remove per-fd evtchn limit
    [PATCH 10/18] xenstored: use grant references instead of
    [PATCH 11/18] xenstored: add NO_SOCKETS compilation option
    [PATCH 12/18] xenstored support for in-memory rather than FS based
    [PATCH 13/18] xenstored: support running in minios stubdom
    [PATCH 14/18] xenstored: always use xc_gnttab_munmap in stubdom
    [PATCH 15/18] xenstored: add --event parameter for bootstrapping
    [PATCH 16/18] xenstored: pull dom0 event port from shared page
    [PATCH 17/18] xenstored: use domain_is_unprivileged instead of
    [PATCH 18/18] xenstored: add --priv-domid parameter

Support for running in a stub domain

^ permalink raw reply	[flat|nested] 129+ messages in thread
* [PATCH v3 00/21] Xenstore stub domain
@ 2012-01-20 20:47 Daniel De Graaf
  2012-01-20 20:47 ` [PATCH] xenbus: Add support for xenbus backend in " Daniel De Graaf
  0 siblings, 1 reply; 129+ messages in thread
From: Daniel De Graaf @ 2012-01-20 20:47 UTC (permalink / raw)
  To: xen-devel

Changes from v2:
 - configuration support added to mini-os build system
 - add mini-os support for conditionally compiling frontends, xenbus
 - XENMEM_remove_from_physmap moved out of arch-specific code
 - use uint32_t for virqs
 - warn when dropping grant v2-only flags when switching versions
 - IOCTL_XENBUS_BACKEND_SETUP name changed so userspace can implement compat
 - ioctl now returns -EEXIST if xenstored has already been connected
 - various cosmetic cleanups, shuffling

Changes from v1:
 - set_virq_handler implemented in libxc
 - added custom domain builder for xenstored
 - xenstore/console domain IDs now pulled from xenstore
 - migration support when using split xenstored (untested, should work)
 - slightly less intrusive NO_SOCKETS xenstored patch
   (still has many ifdefs to avoid pulling in socket headers or symbols)
 - virq handlers removed from dying domain when clearing event channels
 - dummy XSM module restricts getdomaininfo similar to no-XSM case
 - formatting/type fixups
 - partial ioctl compatibility with legacy IOCTL_XENBUS_ALLOC

To start xenstored, run:

tools/xenstore/init-xenstore-domain stubdom/mini-os-x86_64-xenstore/mini-os 20 system_u:system_r:domU_t

This will populate the xenstore domid key /tool/xenstore/domid

Other notes:

The console for xenstored is not set up by init-xenstore-domain. If the
hypervisor is compiled with VERBOSE or debug=y, it will be visible on
the hypervisor serial console (or ring buffer if enabled with
console_to_ring). The xenstore stub domain itself supports console
output, and init-xenstore-domain could be extended to daemonize and
spool this output to a log file. The normal xenconsole daemon cannot be
used here due to the possibility of a deadlock.

----

[PATCH 01/21] xen: reinstate previously unused
[PATCH 02/21] xen: allow global VIRQ handlers to be delegated to
[PATCH 03/21] xen: change virq parameters from int to uint32_t
 - new in v3: cleanup as suggested by Jan Beulich
[PATCH 04/21] xen: use XSM instead of IS_PRIV for getdomaininfo
[PATCH 05/21] xen: Preserve reserved grant entries when switching

[PATCH 06/21] tools/libxl: pull xenstore/console domids from
[PATCH 07/21] lib{xc,xl}: Seed grant tables with xenstore and

[PATCH 08/21] mini-os: avoid crash if no console is provided
[PATCH 09/21] mini-os: remove per-fd evtchn limit
[PATCH 10/21] mini-os: create app-specific configuration
[PATCH 11/21] mini-os: make frontends and xenbus optional
[PATCH 12/21] mini-os: fix list.h include guard name
 - #10-12 are new in v3, replace v2's #8 and part of #13

[PATCH 13/21] xenstored: use grant references instead of
[PATCH 14/21] xenstored: add NO_SOCKETS compilation option
[PATCH 15/21] xenstored support for in-memory rather than FS based
[PATCH 16/21] xenstored: support running in minios stubdom
[PATCH 17/21] stubdom: enable xenstored build
[PATCH 18/21] xenstored: add --event parameter for bootstrapping
[PATCH 19/21] xenstored: use domain_is_unprivileged instead of
[PATCH 20/21] xenstored: add --priv-domid parameter
[PATCH 21/21] xenstored: Add stub domain builder

[PATCH] xenbus: Add support for xenbus backend in stub domain

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

end of thread, other threads:[~2012-01-24 16:24 UTC | newest]

Thread overview: 129+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-11 17:21 [RFC PATCH 0/18] Xenstore stub domain Daniel De Graaf
2012-01-11 17:21 ` [PATCH 01/18] xen: reinstate previously unused XENMEM_remove_from_physmap hypercall Daniel De Graaf
2012-01-12  8:22   ` Jan Beulich
2012-01-11 17:21 ` [PATCH 02/18] xen: allow global VIRQ handlers to be delegated to other domains Daniel De Graaf
2012-01-12  8:43   ` Jan Beulich
2012-01-11 17:21 ` [PATCH 03/18] xsm: allow use of XEN_DOMCTL_getdomaininfo by non-IS_PRIV domains Daniel De Graaf
2012-01-11 17:27   ` Keir Fraser
2012-01-11 17:36     ` Daniel De Graaf
2012-01-11 17:49     ` Keir Fraser
2012-01-11 17:21 ` [PATCH 04/18] xen: Preserve reserved grant entries when switching versions Daniel De Graaf
2012-01-12  8:53   ` Jan Beulich
2012-01-12  9:49     ` Ian Campbell
2012-01-12  9:56       ` Ian Campbell
2012-01-11 17:21 ` [PATCH 05/18] tools/libxl: Add xenstore and console backend domain IDs to config Daniel De Graaf
2012-01-11 17:21 ` [PATCH 06/18] lib{xc, xl}: Seed grant tables with xenstore and console grants Daniel De Graaf
2012-01-12  9:59   ` Ian Campbell
2012-01-12 15:11     ` Daniel De Graaf
2012-01-12 16:12       ` Ian Campbell
2012-01-12 17:21       ` Ian Jackson
2012-01-12 17:32         ` Daniel De Graaf
2012-01-12 17:35           ` Ian Jackson
2012-01-12 17:38             ` Ian Campbell
2012-01-12 17:47             ` Daniel De Graaf
2012-01-11 17:21 ` [PATCH 07/18] mini-os: avoid crash if no console is provided Daniel De Graaf
2012-01-12 10:03   ` Ian Campbell
2012-01-12 17:56     ` Daniel De Graaf
2012-01-18 10:21       ` Ian Campbell
2012-01-11 17:21 ` [PATCH 08/18] mini-os: avoid crash if no xenstore " Daniel De Graaf
2012-01-11 17:21 ` [PATCH 09/18] mini-os: remove per-fd evtchn limit Daniel De Graaf
2012-01-11 17:21 ` [PATCH 10/18] xenstored: use grant references instead of map_foreign_range Daniel De Graaf
2012-01-11 17:21 ` [PATCH 11/18] xenstored: add NO_SOCKETS compilation option Daniel De Graaf
2012-01-12 10:05   ` Ian Campbell
2012-01-11 17:21 ` [PATCH 12/18] xenstored support for in-memory rather than FS based trivial DB (needed to run on mini-OS) Daniel De Graaf
2012-01-11 17:21 ` [PATCH 13/18] xenstored: support running in minios stubdom Daniel De Graaf
2012-01-11 17:21 ` [PATCH 14/18] xenstored: always use xc_gnttab_munmap in stubdom Daniel De Graaf
2012-01-11 17:21 ` [PATCH 15/18] xenstored: add --event parameter for bootstrapping Daniel De Graaf
2012-01-11 17:21 ` [PATCH 16/18] xenstored: pull dom0 event port from shared page Daniel De Graaf
2012-01-11 17:21 ` [PATCH 17/18] xenstored: use domain_is_unprivileged instead of checking conn->id Daniel De Graaf
2012-01-11 17:21 ` [PATCH 18/18] xenstored: add --priv-domid parameter Daniel De Graaf
2012-01-12 10:20   ` Ian Campbell
2012-01-12 15:37     ` Daniel De Graaf
2012-01-11 17:22 ` [PATCH] xenbus: Add support for xenbus backend in stub domain Daniel De Graaf
2012-01-12  8:59   ` Jan Beulich
2012-01-12 15:28     ` Daniel De Graaf
2012-01-12 15:40       ` Jan Beulich
2012-01-12 15:58         ` Daniel De Graaf
2012-01-12  9:51 ` [RFC PATCH 0/18] Xenstore " Ian Campbell
2012-01-12  9:57 ` Ian Campbell
2012-01-12 23:32   ` Daniel De Graaf
2012-01-12 10:33 ` Joanna Rutkowska
2012-01-12 10:48   ` Tim Deegan
2012-01-12 11:18     ` On Dom0 disaggregation (was: Re: [RFC PATCH 0/18] Xenstore stub domain) Joanna Rutkowska
2012-01-12 12:13       ` Tim Deegan
2012-01-12 13:30         ` On Dom0 disaggregation Joanna Rutkowska
2012-01-12 14:21           ` Tim Deegan
2012-01-12 14:23           ` Mihir Nanavati
2012-01-12 11:27     ` [RFC PATCH 0/18] Xenstore stub domain Ian Campbell
2012-01-12 11:33       ` Vasiliy Tolstov
2012-01-12 11:46         ` Ian Campbell
2012-01-12 11:35       ` Joanna Rutkowska
2012-01-12 11:46         ` Ian Campbell
2012-01-12 11:00   ` Keir Fraser
2012-01-12 16:12   ` Daniel De Graaf
2012-01-12 23:35 ` [PATCH v2 00/18] " Daniel De Graaf
2012-01-12 23:35   ` [PATCH 01/18] xen: reinstate previously unused XENMEM_remove_from_physmap hypercall Daniel De Graaf
2012-01-13  7:56     ` Jan Beulich
2012-01-18 10:36     ` Ian Campbell
2012-01-18 14:56       ` Daniel De Graaf
2012-01-18 16:06         ` Ian Campbell
2012-01-18 19:07           ` Daniel De Graaf
2012-01-19 10:32             ` Ian Campbell
2012-01-12 23:35   ` [PATCH 02/18] xen: allow global VIRQ handlers to be delegated to other domains Daniel De Graaf
2012-01-13  8:03     ` Jan Beulich
2012-01-13 13:58       ` Daniel De Graaf
2012-01-13 15:32         ` Jan Beulich
2012-01-18 10:39     ` Ian Campbell
2012-01-18 11:28       ` Jan Beulich
2012-01-18 11:44         ` Ian Campbell
2012-01-12 23:35   ` [PATCH 03/18] xen: use XSM instead of IS_PRIV for getdomaininfo Daniel De Graaf
2012-01-12 23:35   ` [PATCH 04/18] xen: Preserve reserved grant entries when switching versions Daniel De Graaf
2012-01-13  8:07     ` Jan Beulich
2012-01-18 10:43     ` Ian Campbell
2012-01-12 23:35   ` [PATCH 05/18] tools/libxl: pull xenstore/console domids from xenstore Daniel De Graaf
2012-01-18 10:47     ` Ian Campbell
2012-01-12 23:35   ` [PATCH 06/18] lib{xc, xl}: Seed grant tables with xenstore and console grants Daniel De Graaf
2012-01-18 11:05     ` Ian Campbell
2012-01-20 20:24       ` Daniel De Graaf
2012-01-12 23:35   ` [PATCH 07/18] mini-os: avoid crash if no console is provided Daniel De Graaf
2012-01-18 11:06     ` Ian Campbell
2012-01-12 23:35   ` [PATCH 08/18] mini-os: avoid crash if no xenstore " Daniel De Graaf
2012-01-18 11:08     ` Ian Campbell
2012-01-12 23:35   ` [PATCH 09/18] mini-os: remove per-fd evtchn limit Daniel De Graaf
2012-01-18 11:10     ` Ian Campbell
2012-01-12 23:35   ` [PATCH 10/18] xenstored: use grant references instead of map_foreign_range Daniel De Graaf
2012-01-18 11:15     ` Ian Campbell
2012-01-18 18:18       ` Daniel De Graaf
2012-01-12 23:35   ` [PATCH 11/18] xenstored: add NO_SOCKETS compilation option Daniel De Graaf
2012-01-18 11:23     ` Ian Campbell
2012-01-12 23:35   ` [PATCH 12/18] xenstored support for in-memory rather than FS based trivial DB (needed to run on mini-OS) Daniel De Graaf
2012-01-18 11:27     ` Ian Campbell
2012-01-12 23:35   ` [PATCH 13/18] xenstored: support running in minios stubdom Daniel De Graaf
2012-01-18 11:33     ` Ian Campbell
2012-01-18 17:13       ` Ian Jackson
2012-01-18 17:35         ` Ian Campbell
2012-01-24 16:24           ` Ian Jackson
2012-01-12 23:35   ` [PATCH 14/18] xenstored: always use xc_gnttab_munmap in stubdom Daniel De Graaf
2012-01-12 23:35   ` [PATCH 15/18] xenstored: add --event parameter for bootstrapping Daniel De Graaf
2012-01-18 11:35     ` Ian Campbell
2012-01-12 23:35   ` [PATCH 16/18] xenstored: use domain_is_unprivileged instead of checking conn->id Daniel De Graaf
2012-01-18 11:44     ` Ian Campbell
2012-01-18 18:31       ` Daniel De Graaf
2012-01-12 23:35   ` [PATCH 17/18] xenstored: add --priv-domid parameter Daniel De Graaf
2012-01-18 11:48     ` Ian Campbell
2012-01-18 14:41       ` Daniel De Graaf
2012-01-18 14:47         ` Ian Campbell
2012-01-12 23:35   ` [PATCH 18/18] xenstored: Add stub domain builder Daniel De Graaf
2012-01-18 11:50     ` Ian Campbell
2012-01-12 23:36   ` [PATCH] xenbus: Add support for xenbus backend in stub domain Daniel De Graaf
2012-01-13  8:20     ` Jan Beulich
2012-01-13 14:06       ` Daniel De Graaf
2012-01-13 15:37         ` Jan Beulich
2012-01-13 15:44           ` Daniel De Graaf
2012-01-13 16:00             ` Jan Beulich
2012-01-13 17:42               ` Daniel De Graaf
2012-01-16  8:19                 ` Jan Beulich
2012-01-18 12:07     ` Ian Campbell
2012-01-18 14:44       ` Daniel De Graaf
2012-01-18 10:23   ` [PATCH v2 00/18] Xenstore " Ian Campbell
2012-01-20 20:47 [PATCH v3 00/21] " Daniel De Graaf
2012-01-20 20:47 ` [PATCH] xenbus: Add support for xenbus backend in " Daniel De Graaf

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.