[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v1 6/6] xen: add runtime parameter reading support to hypfs



Add support to read values of hypervisor runtime parameters via the
hypervisor file system for all unsigned integer type runtime parameters.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 docs/misc/hypfs-paths.pandoc |  6 ++++++
 xen/common/kernel.c          | 27 +++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index 56ebdcd8be..d710b83185 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -62,3 +62,9 @@ hypervisor.
 #### /buildinfo/config = STRING
 
 The contents of the `xen/.config` file at the time of the hypervisor build.
+
+#### /params/
+
+A directory of runtime parameters (those can be set via xl set-parameters).
+The description of the different parameters can be found in
+`docs/misc/xen-command-line.pandoc`.
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 760917dab5..09787b5a34 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -7,6 +7,7 @@
 #include <xen/init.h>
 #include <xen/lib.h>
 #include <xen/errno.h>
+#include <xen/hypfs.h>
 #include <xen/version.h>
 #include <xen/sched.h>
 #include <xen/paging.h>
@@ -320,6 +321,32 @@ int cmdline_strcmp(const char *frag, const char *name)
     }
 }
 
+static struct hypfs_dir hypfs_params = {
+    .list = LIST_HEAD_INIT(hypfs_params.list),
+};
+
+static int __init runtime_param_hypfs_add(void)
+{
+    const struct kernel_param *param;
+    int ret;
+
+    ret = hypfs_new_dir(&hypfs_root, "params", &hypfs_params);
+    BUG_ON(ret);
+
+    for ( param = __param_start; param < __param_end; param++ )
+    {
+        if ( param->type == OPT_UINT && param->len == sizeof(unsigned int) )
+        {
+            ret = hypfs_new_entry_uint(&hypfs_params, param->name,
+                                       (unsigned int *)(param->par.var));
+            BUG_ON(ret);
+        }
+    }
+
+    return 0;
+}
+__initcall(runtime_param_hypfs_add);
+
 unsigned int tainted;
 
 /**
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.