Skip to content

Commit

Permalink
Revert stubdom+xenstore 9pfs changes
Browse files Browse the repository at this point in the history
to unblock CI.  It turns out there are still issues in some configurations.

https://gitlab.com/xen-project/xen/-/pipelines/1188660609

This reverts commit f5e1c52.
This reverts commit a76f880.
This reverts commit 9389264.
This reverts commit 297a258.
This reverts commit 0b76178.

Signed-off-by: Andrew Cooper <[email protected]>
  • Loading branch information
andyhhp committed Feb 23, 2024
1 parent f5e1c52 commit 92babc8
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 107 deletions.
2 changes: 1 addition & 1 deletion stubdom/xenstore-minios.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CONFIG_NETFRONT=n
CONFIG_FBFRONT=n
CONFIG_KBDFRONT=n
CONFIG_CONSFRONT=n
CONFIG_XENBUS=n
CONFIG_LWIP=n
CONFIG_9PFRONT=y
CONFIG_BALLOON=y
XEN_INTERFACE_VERSION=__XEN_LATEST_INTERFACE_VERSION__
2 changes: 1 addition & 1 deletion stubdom/xenstorepvh-minios.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CONFIG_NETFRONT=n
CONFIG_FBFRONT=n
CONFIG_KBDFRONT=n
CONFIG_CONSFRONT=n
CONFIG_XENBUS=n
CONFIG_LWIP=n
CONFIG_9PFRONT=y
CONFIG_BALLOON=y
XEN_INTERFACE_VERSION=__XEN_LATEST_INTERFACE_VERSION__
1 change: 1 addition & 0 deletions tools/hotplug/Linux/init.d/sysconfig.xencommons.in
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ XENSTORED_ARGS=
## Default: Not defined, tracing off
#
# Log xenstored messages
# Only evaluated if XENSTORETYPE is "daemon".
#XENSTORED_TRACE=[yes|on|1]

## Type: integer
Expand Down
1 change: 0 additions & 1 deletion tools/hotplug/Linux/launch-xenstore.in
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . @CONFIG_DIR@/@CONFIG_LEAF
[ -z "$XENSTORE_DOMAIN_SIZE" ] && XENSTORE_DOMAIN_SIZE=8
XENSTORE_DOMAIN_ARGS="$XENSTORE_DOMAIN_ARGS --memory $XENSTORE_DOMAIN_SIZE"
[ -z "$XENSTORE_MAX_DOMAIN_SIZE" ] || XENSTORE_DOMAIN_ARGS="$XENSTORE_DOMAIN_ARGS --maxmem $XENSTORE_MAX_DOMAIN_SIZE"
[ -z "$XENSTORED_TRACE" ] || XENSTORE_DOMAIN_ARGS="$XENSTORE_DOMAIN_ARGS -T xenstored-trace.log"

echo -n Starting $XENSTORE_DOMAIN_KERNEL...
${LIBEXEC_BIN}/init-xenstore-domain $XENSTORE_DOMAIN_ARGS || exit 1
Expand Down
29 changes: 21 additions & 8 deletions tools/xenstored/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,19 @@ static int do_control_quota_s(const void *ctx, struct connection *conn,
return EINVAL;
}

#ifdef __MINIOS__
static int do_control_memreport(const void *ctx, struct connection *conn,
const char **vec, int num)
{
if (num)
return EINVAL;

talloc_report_full(NULL, stdout);

send_ack(conn, XS_CONTROL);
return 0;
}
#else
static int do_control_logfile(const void *ctx, struct connection *conn,
const char **vec, int num)
{
Expand All @@ -209,7 +222,7 @@ static int do_control_logfile(const void *ctx, struct connection *conn,

close_log();
talloc_free(tracefile);
tracefile = absolute_filename(NULL, vec[0]);
tracefile = talloc_strdup(NULL, vec[0]);
reopen_log();

send_ack(conn, XS_CONTROL);
Expand All @@ -220,7 +233,6 @@ static int do_control_memreport(const void *ctx, struct connection *conn,
const char **vec, int num)
{
FILE *fp;
const char *filename;
int fd;

if (num > 1)
Expand All @@ -243,12 +255,8 @@ static int do_control_memreport(const void *ctx, struct connection *conn,
if (!fp)
close(fd);
}
} else {
filename = absolute_filename(ctx, vec[0]);
if (!filename)
return ENOMEM;
fp = fopen(filename, "a");
}
} else
fp = fopen(vec[0], "a");

if (!fp)
return EBADF;
Expand All @@ -259,6 +267,7 @@ static int do_control_memreport(const void *ctx, struct connection *conn,
send_ack(conn, XS_CONTROL);
return 0;
}
#endif

static int do_control_print(const void *ctx, struct connection *conn,
const char **vec, int num)
Expand Down Expand Up @@ -300,8 +309,12 @@ static struct cmd_s cmds[] = {
"[-c <cmdline>] [-F] [-t <timeout>] <file>\n"
" Default timeout is 60 seconds.", 5 },
#endif
#ifdef __MINIOS__
{ "memreport", do_control_memreport, "" },
#else
{ "logfile", do_control_logfile, "<file>" },
{ "memreport", do_control_memreport, "[<file>]" },
#endif
{ "print", do_control_print, "<string>" },
{ "quota", do_control_quota,
"[set <name> <val>|<domid>|max [-r]]" },
Expand Down
15 changes: 2 additions & 13 deletions tools/xenstored/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ char **orig_argv;
LIST_HEAD(connections);
int tracefd = -1;
bool keep_orphans = false;
const char *tracefile = NULL;
char *tracefile = NULL;
static struct hashtable *nodes;
unsigned int trace_flags = TRACE_OBJ | TRACE_IO;

Expand Down Expand Up @@ -137,17 +137,6 @@ void trace_destroy(const void *data, const char *type)
trace("obj: DESTROY %s %p\n", type, data);
}

/*
* Return an absolute filename.
* In case of a relative filename given as input, prepend XENSTORE_LIB_DIR.
*/
const char *absolute_filename(const void *ctx, const char *filename)
{
if (filename[0] != '/')
return talloc_asprintf(ctx, XENSTORE_LIB_DIR "/%s", filename);
return talloc_strdup(ctx, filename);
}

void close_log(void)
{
if (tracefd >= 0)
Expand Down Expand Up @@ -2770,7 +2759,7 @@ int main(int argc, char *argv[])
#endif

if (tracefile)
tracefile = absolute_filename(NULL, tracefile);
tracefile = talloc_strdup(NULL, tracefile);

#ifndef NO_LIVE_UPDATE
/* Read state in case of live update. */
Expand Down
11 changes: 1 addition & 10 deletions tools/xenstored/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
#include "list.h"
#include "hashtable.h"

#define XENSTORE_LIB_DIR XEN_LIB_DIR "/xenstore"

#ifndef O_CLOEXEC
#define O_CLOEXEC 0
/* O_CLOEXEC support is needed for Live Update in the daemon case. */
Expand Down Expand Up @@ -341,7 +339,7 @@ void close_log(void);
extern int orig_argc;
extern char **orig_argv;

extern const char *tracefile;
extern char *tracefile;
extern int tracefd;

/* Trace flag values must be kept in sync with trace_switches[] contents. */
Expand Down Expand Up @@ -401,13 +399,6 @@ void handle_special_fds(void);
int get_socket_fd(void);
void set_socket_fd(int fd);

#ifdef __MINIOS__
void mount_9pfs(void);
#endif

const char *xenstore_rundir(void);
const char *absolute_filename(const void *ctx, const char *filename);

/* Close stdin/stdout/stderr to complete daemonize */
void finish_daemonize(void);

Expand Down
2 changes: 0 additions & 2 deletions tools/xenstored/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1236,8 +1236,6 @@ void stubdom_init(void)
barf_perror("Failed to initialize stubdom");

xenevtchn_notify(xce_handle, stubdom->port);

mount_9pfs();
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions tools/xenstored/lu_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void lu_get_dump_state(struct lu_dump_state *state)
state->size = 0;

state->filename = talloc_asprintf(NULL, "%s/state_dump",
xenstore_rundir());
xenstore_daemon_rundir());
if (!state->filename)
barf("Allocation failure");

Expand Down Expand Up @@ -65,7 +65,7 @@ FILE *lu_dump_open(const void *ctx)
int fd;

filename = talloc_asprintf(ctx, "%s/state_dump",
xenstore_rundir());
xenstore_daemon_rundir());
if (!filename)
return NULL;

Expand Down
62 changes: 0 additions & 62 deletions tools/xenstored/minios.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,10 @@
*/
#include <sys/types.h>
#include <sys/mman.h>
#include <syslog.h>
#include "talloc.h"
#include "core.h"
#include "utils.h"
#include <xen/grant_table.h>
#include <mini-os/lib.h>
#include <mini-os/9pfront.h>
#include <mini-os/sched.h>
#include <mini-os/xenbus.h>
#include <mini-os/xmalloc.h>

#define P9_STATE_PATH "device/9pfs/0/state"

static void *p9_device;

void finish_daemonize(void)
{
Expand Down Expand Up @@ -84,55 +74,3 @@ int get_socket_fd(void)
void set_socket_fd(int fd)
{
}

static void mount_thread(void *p)
{
xenbus_event_queue events = NULL;
char *err;
char *dummy;

err = xenbus_watch_path_token(XBT_NIL, P9_STATE_PATH, "9pfs", &events);
if (err) {
log("error \"%s\" when setting watch on \"%s\"\n", err,
P9_STATE_PATH);
free(err);
return;
}

for (;;) {
xenbus_wait_for_watch(&events);

/*
* We only care for existence of the state node.
* State changes are handled in init_9pfront().
*/
err = xenbus_read(XBT_NIL, P9_STATE_PATH, &dummy);
if (!err)
break;
free(err);
}

free(dummy);

err = xenbus_unwatch_path_token(XBT_NIL, P9_STATE_PATH, "9pfs");
if (err) {
log("error \"%s\" when unwatching \"%s\", leaking watch\n",
err, P9_STATE_PATH);
free(err);
}

p9_device = init_9pfront(0, XENSTORE_LIB_DIR);

/* Start logging if selected. */
reopen_log();
}

void mount_9pfs(void)
{
create_thread("mount-9pfs", mount_thread, NULL);
}

const char *xenstore_rundir(void)
{
return XENSTORE_LIB_DIR;
}
8 changes: 1 addition & 7 deletions tools/xenstored/posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,9 @@ void early_init(bool live_update, bool dofork, const char *pidfile)
{
reopen_log();

/* Make sure xenstored directories exist. */
/* Make sure xenstored directory exists. */
/* Errors ignored here, will be reported when we open files */
mkdir(xenstore_daemon_rundir(), 0755);
mkdir(XENSTORE_LIB_DIR, 0755);

if (dofork) {
openlog("xenstored", 0, LOG_DAEMON);
Expand Down Expand Up @@ -407,8 +406,3 @@ void set_socket_fd(int fd)
{
sock = fd;
}

const char *xenstore_rundir(void)
{
return xenstore_daemon_rundir();
}

0 comments on commit 92babc8

Please sign in to comment.