Skip to contentSkip to conversation

Build libxc on rump kernel

PATCH In review Wei Liu 3 participants 17 messages Mar 3, 2015 – Mar 6, 2015

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

v2 cover Build libxc on rump kernel

Wei Liu (5):
NetBSDRump: provide evtchn.h
libxc: split off xc_minios_common.c
libxc: split off xc_netbsd_evtchn.c
libxc: minios: introduce abstraction for files[]
libxc: rumpxen: provide xc_osdep_info

 tools/include/xen-sys/NetBSDRump/evtchn.h |  86 ++++++++
 tools/libxc/Makefile                      |   6 +-
 tools/libxc/xc_minios.c                   | 243 +---------------------
 tools/libxc/xc_minios_common.c            | 322 ++++++++++++++++++++++++++++++
 tools/libxc/xc_netbsd.c                   | 168 +---------------
 tools/libxc/xc_netbsd_evtchn.c            | 196 ++++++++++++++++++
 tools/libxc/xc_netbsd_rumpkern.c          |  59 ++++++
 tools/libxc/xc_private.h                  |   3 +
 8 files changed, 675 insertions(+), 408 deletions(-)
 create mode 100644 tools/include/xen-sys/NetBSDRump/evtchn.h
 create mode 100644 tools/libxc/xc_minios_common.c
 create mode 100644 tools/libxc/xc_netbsd_evtchn.c
 create mode 100644 tools/libxc/xc_netbsd_rumpkern.c
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v2 1/5 NetBSDRump: provide evtchn.h

Xen's build system has a target for rump kernel called NetBSDRump. We want to build libxc against rump kernel, so we need to copy NetBSD's evtchn.h to NetBSDRump. This copy is not very likely to diverge from NetBSD's copy, but we don't preclude such possibility.

The actual implementation of evtch code will be factored out from libxc's NetBSD osdep code.

---
Changes in v2:
1. Better commit message.

---
 tools/include/xen-sys/NetBSDRump/evtchn.h | 86 +++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100644 tools/include/xen-sys/NetBSDRump/evtchn.h
tools/include/xen-sys/NetBSDRump/evtchn.h new file +86 -0
new file mode 100644
index 0000000..2d8a1f9
@@ -0,0 +1,86 @@
+/* $NetBSD: evtchn.h,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $ */
+/******************************************************************************
+ * evtchn.h
+ * 
+ * Interface to /dev/xen/evtchn.
+ * 
+ * Copyright (c) 2003-2005, K A Fraser
+ * 
+ * This file may be distributed separately from the Linux kernel, or
+ * incorporated into other software packages, subject to the following license:
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __NetBSD_EVTCHN_H__
+#define __NetBSD_EVTCHN_H__
+
+/*
+ * Bind a fresh port to VIRQ @virq.
+ */
+#define IOCTL_EVTCHN_BIND_VIRQ				\
+	_IOWR('E', 4, struct ioctl_evtchn_bind_virq)
+struct ioctl_evtchn_bind_virq {
+	unsigned int virq;
+	unsigned int port;
+};
+
+/*
+ * Bind a fresh port to remote <@remote_domain, @remote_port>.
+ */
+#define IOCTL_EVTCHN_BIND_INTERDOMAIN			\
+	_IOWR('E', 5, struct ioctl_evtchn_bind_interdomain)
+struct ioctl_evtchn_bind_interdomain {
+	unsigned int remote_domain, remote_port;
+	unsigned int port;
+};
+
+/*
+ * Allocate a fresh port for binding to @remote_domain.
+ */
+#define IOCTL_EVTCHN_BIND_UNBOUND_PORT			\
+	_IOWR('E', 6, struct ioctl_evtchn_bind_unbound_port)
+struct ioctl_evtchn_bind_unbound_port {
+	unsigned int remote_domain;
+	unsigned int port;
+};
+
+/*
+ * Unbind previously allocated @port.
+ */
+#define IOCTL_EVTCHN_UNBIND				\
+	_IOW('E', 7, struct ioctl_evtchn_unbind)
+struct ioctl_evtchn_unbind {
+	unsigned int port;
+};
+
+/*
+ * Send event to previously allocated @port.
+ */
+#define IOCTL_EVTCHN_NOTIFY				\
+	_IOW('E', 8, struct ioctl_evtchn_notify)
+struct ioctl_evtchn_notify {
+	unsigned int port;
+};
+
+/* Clear and reinitialise the event buffer. Clear error condition. */
+#define IOCTL_EVTCHN_RESET				\
+	_IO('E', 9)
+
+#endif /* __NetBSD_EVTCHN_H__ */
Signature · 1 line
1.9.1
Acked-by on v2 1/5
#2 lore raw

Re: [PATCH v2 1/5] NetBSDRump: provide evtchn.h

Quoted 10 lines · Wei Liu

Xen's build system has a target for rump kernel called NetBSDRump. We want to build libxc against rump kernel, so we need to copy NetBSD's evtchn.h to NetBSDRump. This copy is not very likely to diverge from NetBSD's copy, but we don't preclude such possibility.

The actual implementation of evtch code will be factored out from libxc's NetBSD osdep code.

author
#3 lore raw

PATCH v2 2/5 libxc: split off xc_minios_common.c

In reply to Wei Liu

Rump kernel is going to use some but not all of the machinery previously in xc_minios.c. Split the privcmd and gnttab code into its own file. This part is pure code motion.

But we also have to:

- Alter the Makefile to build and link xc_minios_common.c too.

- Rename some of the minios_*_ops symbols to have proper namespaceing and make them have external linkage, so that the init code (which remains in xc_minios.c) can reference them.

- Call these *_ops symbols xc_*_ops so that we can mix and match in the future. This does not impede the existing mechanisms for run-time overriding. (But leave a comment next to the new declarations in xc_private.h saying not to use these.)

- Change map_frames_ex to minios_map_frames_ex if compiling on rump kernel.

---
Changes in v2:
1. xc_minios_privcmd.c -> xc_minios_common.c.

---
 tools/libxc/Makefile           |   2 +-
 tools/libxc/xc_minios.c        | 243 +---------------------------------
 tools/libxc/xc_minios_common.c | 291 +++++++++++++++++++++++++++++++++++++++++
 tools/libxc/xc_private.h       |   3 +
 4 files changed, 299 insertions(+), 240 deletions(-)
 create mode 100644 tools/libxc/xc_minios_common.c
tools/libxc/Makefile +1 -1
index 6fa88c7..3a0ff22 100644
@@ -47,7 +47,7 @@ CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c xc_linux_osdep.c
 CTRL_SRCS-$(CONFIG_FreeBSD) += xc_freebsd.c xc_freebsd_osdep.c
 CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
 CTRL_SRCS-$(CONFIG_NetBSD) += xc_netbsd.c
-CTRL_SRCS-$(CONFIG_MiniOS) += xc_minios.c
+CTRL_SRCS-$(CONFIG_MiniOS) += xc_minios.c xc_minios_common.c
 
 GUEST_SRCS-y :=
 GUEST_SRCS-y += xg_private.c xc_suspend.c
tools/libxc/xc_minios.c +4 -239

272 lines not on this page · raw message

tools/libxc/xc_minios_common.c new file +291 -0

291 lines not on this page · raw message

tools/libxc/xc_private.h +3 -0
index 45b8644..152465f 100644
@@ -111,6 +111,9 @@ struct xc_interface_core {
     xc_osdep_handle  ops_handle; /* opaque data for xc_osdep_ops */
 };
 
+/* Do not use these directly; go via the handle you already have. */
+extern struct xc_osdep_ops xc_privcmd_ops, xc_evtchn_ops, xc_gnttab_ops;
+
 void xc_report_error(xc_interface *xch, int code, const char *fmt, ...)
     __attribute__((format(printf,3,4)));
 void xc_reportv(xc_interface *xch, xentoollog_logger *lg, xentoollog_level,
Signature · 1 line
1.9.1
Acked-by on v2 2/5
#4 lore raw

Re: [PATCH v2 2/5] libxc: split off xc_minios_common.c

Quoted 17 lines · Wei Liu

Rump kernel is going to use some but not all of the machinery previously in xc_minios.c. Split the privcmd and gnttab code into its own file. This part is pure code motion.

But we also have to:

- Alter the Makefile to build and link xc_minios_common.c too.

- Rename some of the minios_*_ops symbols to have proper namespaceing and make them have external linkage, so that the init code (which remains in xc_minios.c) can reference them.

- Call these *_ops symbols xc_*_ops so that we can mix and match in the future. This does not impede the existing mechanisms for run-time overriding. (But leave a comment next to the new declarations in xc_private.h saying not to use these.)

Quoted 6 lines

- Change map_frames_ex to minios_map_frames_ex if compiling on rump kernel.

author
#5 lore raw

PATCH v2 3/5 libxc: split off xc_netbsd_evtchn.c

In reply to Wei Liu

Rump kernel is going to use some but not all of the machinery previously in xc_netbsd.c. Split the evtchn and ancillary code into its own file. This part is pure code motion.

But we also have to alter the Makefile, and rename some symbols, as with xc_minios*.c.

---
Changes in v2:
1. xc_netbsd_user.c -> xc_netbsd_evtchn.c.

---
 tools/libxc/Makefile           |   2 +-
 tools/libxc/xc_netbsd.c        | 168 +----------------------------------
 tools/libxc/xc_netbsd_evtchn.c | 196 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 198 insertions(+), 168 deletions(-)
 create mode 100644 tools/libxc/xc_netbsd_evtchn.c
tools/libxc/Makefile +1 -1
index 3a0ff22..8bf7344 100644
@@ -46,7 +46,7 @@ CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c
 CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c xc_linux_osdep.c
 CTRL_SRCS-$(CONFIG_FreeBSD) += xc_freebsd.c xc_freebsd_osdep.c
 CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
-CTRL_SRCS-$(CONFIG_NetBSD) += xc_netbsd.c
+CTRL_SRCS-$(CONFIG_NetBSD) += xc_netbsd.c xc_netbsd_evtchn.c
 CTRL_SRCS-$(CONFIG_MiniOS) += xc_minios.c xc_minios_common.c
 
 GUEST_SRCS-y :=
tools/libxc/xc_netbsd.c +1 -167

180 lines not on this page · raw message

tools/libxc/xc_netbsd_evtchn.c new file +196 -0

196 lines not on this page · raw message

Signature · 1 line
1.9.1
#6 lore raw

Re: [PATCH v2 3/5] libxc: split off xc_netbsd_evtchn.c

Quoted 7 lines · Wei Liu

iff --git a/tools/libxc/xc_netbsd_evtchn.c
b/tools/libxc/xc_netbsd_evtchn.c
new file mode 100644
index 0000000..b5c2491

tools/libxc/xc_netbsd_evtchn.c line 7

Quoted 7 lines
tools/libxc/xc_netbsd_evtchn.c new file +7 -0
@@ -0,0 +1,196 @@
+/******************************************************************************
+ *
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * xc_gnttab functions:
+ * Copyright (c) 2007-2008, D G Murray <[email protected]>

Is this the same cut-and-paste-o as last time or was there a second one I didn't spot?

Ian.

author
#7 lore raw

Re: [PATCH v2 3/5] libxc: split off xc_netbsd_evtchn.c

Quoted 10 lines · Ian Campbell
Quoted 9 lines · Wei Liu

iff --git a/tools/libxc/xc_netbsd_evtchn.c
b/tools/libxc/xc_netbsd_evtchn.c
new file mode 100644
index 0000000..b5c2491

tools/libxc/xc_netbsd_evtchn.c new file +2 -0
@@ -0,0 +1,196 @@
+/******************************************************************************
+ *
Quoted 9 lines

tools/libxc/xc_netbsd_evtchn.c line 7

Quoted 5 lines
tools/libxc/xc_netbsd_evtchn.c new file +5 -0
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * xc_gnttab functions:
+ * Copyright (c) 2007-2008, D G Murray <[email protected]>

Is this the same cut-and-paste-o as last time or was there a second one I didn't spot?

This is a different patch. I fixed the one you mentioned last time.

I will fix this as well.

Wei.

Quoted 2 lines

Ian.

author
#8 lore raw

PATCH v2 4/5 libxc: minios: introduce abstraction for files[]

In reply to Wei Liu

We are going to want to reuse this code for NetBSD rump kernels, where there is no gntmap device and we just want to call the MiniOS gntmap code directly.

As part of this we want to abstract away the use of files[] inside the actual functions. Do this with a #define whose definition we are going to make conditional in just a moment.

No functional change in this patch.

---
Changes in v2:
1. Fix a bug spotted by Jürgen.

---
 tools/libxc/xc_minios_common.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
tools/libxc/xc_minios_common.c +7 -8
index 8b08cde..c38b5f2 100644
@@ -208,12 +208,14 @@ struct xc_osdep_ops xc_privcmd_ops = {
     },
 };
 
+#define GNTMAP(h) (files[(int)(h)].gntmap)
+
 static xc_osdep_handle minios_gnttab_open(xc_gnttab *xcg)
 {
     int fd = alloc_fd(FTYPE_GNTMAP);
     if ( fd == -1 )
         return XC_OSDEP_OPEN_ERROR;
-    gntmap_init(&files[fd].gntmap);
+    gntmap_init(&GNTMAP(fd));
     return (xc_osdep_handle)fd;
 }
 
@@ -225,7 +227,7 @@ static int minios_gnttab_close(xc_gnttab *xcg, xc_osdep_handle h)
 
 void minios_gnttab_close_fd(int fd)
 {
-    gntmap_fini(&files[fd].gntmap);
+    gntmap_fini(&GNTMAP(fd));
     files[fd].type = FTYPE_NONE;
 }
 
@@ -235,7 +237,6 @@ static void *minios_gnttab_grant_map(xc_gnttab *xcg, xc_osdep_handle h,
                                      uint32_t notify_offset,
                                      evtchn_port_t notify_port)
 {
-    int fd = (int)h;
     int stride = 1;
     if (flags & XC_GRANT_MAP_SINGLE_DOMAIN)
         stride = 0;
@@ -243,7 +244,7 @@ static void *minios_gnttab_grant_map(xc_gnttab *xcg, xc_osdep_handle h,
         errno = ENOSYS;
         return NULL;
     }
-    return gntmap_map_grant_refs(&files[fd].gntmap,
+    return gntmap_map_grant_refs(&GNTMAP(fd),
                                  count, domids, stride,
                                  refs, prot & PROT_WRITE);
 }
@@ -252,9 +253,8 @@ static int minios_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h,
                                 void *start_address,
                                 uint32_t count)
 {
-    int fd = (int)h;
     int ret;
-    ret = gntmap_munmap(&files[fd].gntmap,
+    ret = gntmap_munmap(&GNTMAP(fd),
                         (unsigned long) start_address,
                         count);
     if (ret < 0) {
@@ -267,9 +267,8 @@ static int minios_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h,
 static int minios_gnttab_set_max_grants(xc_gnttab *xcg, xc_osdep_handle h,
                              uint32_t count)
 {
-    int fd = (int)h;
     int ret;
-    ret = gntmap_set_max_grants(&files[fd].gntmap,
+    ret = gntmap_set_max_grants(&GNTMAP(fd),
                                 count);
     if (ret < 0) {
         errno = -ret;
Signature · 7 lines
1.9.1


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
author
#9 lore raw

PATCH v2 5/5 libxc: rumpxen: provide xc_osdep_info

In reply to Wei Liu

This allows programs which use the bulk of libxc to link. We use /dev/xenevt for event channels, the raw minios functions for privcmd and gnttab, and the netbsd versions of discard_file_cache and xc_memalign.

---
 tools/libxc/Makefile             |  2 ++
 tools/libxc/xc_minios_common.c   | 34 ++++++++++++++++++++++-
 tools/libxc/xc_netbsd_rumpkern.c | 59 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 94 insertions(+), 1 deletion(-)
 create mode 100644 tools/libxc/xc_netbsd_rumpkern.c
tools/libxc/Makefile +2 -0
index 8bf7344..c8a5442 100644
@@ -48,6 +48,8 @@ CTRL_SRCS-$(CONFIG_FreeBSD) += xc_freebsd.c xc_freebsd_osdep.c
 CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
 CTRL_SRCS-$(CONFIG_NetBSD) += xc_netbsd.c xc_netbsd_evtchn.c
 CTRL_SRCS-$(CONFIG_MiniOS) += xc_minios.c xc_minios_common.c
+CTRL_SRCS-$(CONFIG_NetBSDRump) += xc_netbsd_rumpkern.c xc_netbsd_evtchn.c
+CTRL_SRCS-$(CONFIG_NetBSDRump) += xc_minios_common.c
 
 GUEST_SRCS-y :=
 GUEST_SRCS-y += xg_private.c xc_suspend.c
tools/libxc/xc_minios_common.c +33 -1
index c38b5f2..fd201fd 100644
@@ -43,7 +43,17 @@
 
 #ifdef __RUMPRUN__
 # define map_frames_ex minios_map_frames_ex
-#endif /* __RUMPRUN__ */
+
+static xc_osdep_handle minios_privcmd_open(xc_interface *xch)
+{
+    return 1;
+}
+static int minios_privcmd_close(xc_interface *xch, xc_osdep_handle h)
+{
+    return 0;
+}
+
+#else /* !__RUMPRUN__ */
 
 void minios_interface_close_fd(int fd);
 void minios_gnttab_close_fd(int fd);
@@ -69,6 +79,8 @@ void minios_interface_close_fd(int fd)
     files[fd].type = FTYPE_NONE;
 }
 
+#endif /* !__RUMPRUN__ */
+
 static void *minios_privcmd_alloc_hypercall_buffer(xc_interface *xch,
 						   xc_osdep_handle h,
 						   int npages)
@@ -208,6 +220,24 @@ struct xc_osdep_ops xc_privcmd_ops = {
     },
 };
 
+#ifdef __RUMPRUN__
+
+static struct gntmap static_gntmap;
+
+#define GNTMAP(h) static_gntmap
+
+static xc_osdep_handle minios_gnttab_open(xc_gnttab *xcg)
+{
+    return 1;
+}
+
+static int minios_gnttab_close(xc_gnttab *xcg, xc_osdep_handle h)
+{
+    return 0;
+}
+
+#else /* !__RUMPRUN__ */
+
 #define GNTMAP(h) (files[(int)(h)].gntmap)
 
 static xc_osdep_handle minios_gnttab_open(xc_gnttab *xcg)
@@ -231,6 +261,8 @@ void minios_gnttab_close_fd(int fd)
     files[fd].type = FTYPE_NONE;
 }
 
+#endif /* !__RUMPRUN__ */
+
 static void *minios_gnttab_grant_map(xc_gnttab *xcg, xc_osdep_handle h,
                                      uint32_t count, int flags, int prot,
                                      uint32_t *domids, uint32_t *refs,
tools/libxc/xc_netbsd_rumpkern.c new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
1.9.1
Acked-by on v2 5/5
#10 lore raw

Re: [PATCH v2 5/5] libxc: rumpxen: provide xc_osdep_info

Quoted 7 lines · Wei Liu, le Tue 03 Mar 2015 15:57:21 +0000, a écrit :

This allows programs which use the bulk of libxc to link. We use /dev/xenevt for event channels, the raw minios functions for privcmd and gnttab, and the netbsd versions of discard_file_cache and xc_memalign.

tools/libxc/xc_minios_common.c line 54

Quoted 8 lines
tools/libxc/xc_minios_common.c +8 -0
+static xc_osdep_handle minios_privcmd_open(xc_interface *xch)
+{
+    return 1;
+}
+static xc_osdep_handle minios_gnttab_open(xc_gnttab *xcg)
+{
+    return 1;
+}

Perhaps return a different fd number?

Samuel

author
#11 lore raw

Re: [PATCH v2 5/5] libxc: rumpxen: provide xc_osdep_info

Quoted 11 lines · Samuel Thibault
Quoted 7 lines · Wei Liu, le Tue 03 Mar 2015 15:57:21 +0000, a écrit :

This allows programs which use the bulk of libxc to link. We use /dev/xenevt for event channels, the raw minios functions for privcmd and gnttab, and the netbsd versions of discard_file_cache and xc_memalign.

Quoted 11 lines

tools/libxc/xc_minios_common.c line 54

Quoted 8 lines
tools/libxc/xc_minios_common.c +8 -0
+static xc_osdep_handle minios_privcmd_open(xc_interface *xch)
+{
+    return 1;
+}
+static xc_osdep_handle minios_gnttab_open(xc_gnttab *xcg)
+{
+    return 1;
+}

Perhaps return a different fd number?

After thinking a bit more I think we should use alloc_fd(FTYPE_*) for all file descriptor allocation.

Wei.

Quoted 1 line

Samuel

author
#12 lore raw

Re: [PATCH v2 5/5] libxc: rumpxen: provide xc_osdep_info

Quoted 24 lines · Wei Liu
Quoted 11 lines · Samuel Thibault
Quoted 7 lines · Wei Liu, le Tue 03 Mar 2015 15:57:21 +0000, a écrit :

This allows programs which use the bulk of libxc to link. We use /dev/xenevt for event channels, the raw minios functions for privcmd and gnttab, and the netbsd versions of discard_file_cache and xc_memalign.

Quoted 11 lines

tools/libxc/xc_minios_common.c line 54

Quoted 8 lines
tools/libxc/xc_minios_common.c +8 -0
+static xc_osdep_handle minios_privcmd_open(xc_interface *xch)
+{
+    return 1;
+}
+static xc_osdep_handle minios_gnttab_open(xc_gnttab *xcg)
+{
+    return 1;
+}

Perhaps return a different fd number?

Quoted 3 lines

After thinking a bit more I think we should use alloc_fd(FTYPE_*) for all file descriptor allocation.

(Sorry for speaking to myself)

Just tried that, failed.

Rump kernel doesn't use mini-os's fd management facility so there is no alloc_fd etc. On the other hand this makes me think number 1 is as good as any other number we can use.

Wei.

Quoted 3 lines

Wei.

Quoted 1 line

Samuel

#13 lore raw

Re: [PATCH v2 5/5] libxc: rumpxen: provide xc_osdep_info

Quoted 3 lines · Wei Liu, le Tue 03 Mar 2015 16:58:07 +0000, a écrit :

Rump kernel doesn't use mini-os's fd management facility so there is no alloc_fd etc. On the other hand this makes me think number 1 is as good as any other number we can use.

Does Rump have not fd at all? It'd probably still be good to have different, even if hardcoded, fd numbers, for potentially easier debugging.

Samuel

#14 lore raw

Re: [PATCH v2 5/5] libxc: rumpxen: provide xc_osdep_info

Quoted 8 lines · Samuel Thibault
Quoted 3 lines · Wei Liu, le Tue 03 Mar 2015 16:58:07 +0000, a écrit :

Rump kernel doesn't use mini-os's fd management facility so there is no alloc_fd etc. On the other hand this makes me think number 1 is as good as any other number we can use.

Does Rump have not fd at all? It'd probably still be good to have different, even if hardcoded, fd numbers, for potentially easier debugging.

In particular 1 is normally stdout, which could be confusing.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#15 lore raw

Re: [PATCH v2 5/5] libxc: rumpxen: provide xc_osdep_info

In reply to Samuel Thibault
Quoted 6 lines · Samuel Thibault
Quoted 3 lines · Wei Liu, le Tue 03 Mar 2015 16:58:07 +0000, a écrit :

Rump kernel doesn't use mini-os's fd management facility so there is no alloc_fd etc. On the other hand this makes me think number 1 is as good as any other number we can use.

Does Rump have not fd at all? It'd probably still be good to have

AIUI it's using NetBSD's facility or it just doesn't care.

The mini-os fork (!) in rump kernel doesn't have alloc_fd etc.

Quoted 2 lines

different, even if hardcoded, fd numbers, for potentially easier debugging.

Fair enough. I'm going to use ... 0xff (and probably comes with a #define in code).

Wei.

Quoted 2 lines

Samuel

#16 lore raw

Re: [PATCH v2 5/5] libxc: rumpxen: provide xc_osdep_info

In reply to Wei Liu
Quoted 24 lines · Wei Liu, le Tue 03 Mar 2015 16:41:23 +0000, a écrit :
Quoted 11 lines · Samuel Thibault
Quoted 7 lines · Wei Liu, le Tue 03 Mar 2015 15:57:21 +0000, a écrit :

This allows programs which use the bulk of libxc to link. We use /dev/xenevt for event channels, the raw minios functions for privcmd and gnttab, and the netbsd versions of discard_file_cache and xc_memalign.

Quoted 11 lines

tools/libxc/xc_minios_common.c line 54

Quoted 8 lines
tools/libxc/xc_minios_common.c +8 -0
+static xc_osdep_handle minios_privcmd_open(xc_interface *xch)
+{
+    return 1;
+}
+static xc_osdep_handle minios_gnttab_open(xc_gnttab *xcg)
+{
+    return 1;
+}

Perhaps return a different fd number?

Quoted 2 lines

After thinking a bit more I think we should use alloc_fd(FTYPE_*) for all file descriptor allocation.

That would make sense, yes.

Samuel