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

[Xen-devel] [PATCH 47/52] xen: add basic support for runtime parameter changing



Add the needed infrastructure for runtime parameter changing similar
to that used at boot time via cmdline. We are using the same parsing
functions as for cmdline parsing, but with a different array of
parameter definitions.

Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Tim Deegan <tim@xxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 xen/arch/x86/xen.lds.S |  4 ++++
 xen/common/kernel.c    |  5 +++++
 xen/include/xen/init.h | 22 ++++++++++++++++++++--
 xen/include/xen/lib.h  |  1 +
 4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index ff08bbe42a..5bd7912759 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -226,6 +226,10 @@ SECTIONS
        __start_schedulers_array = .;
        *(.data.schedulers)
        __end_schedulers_array = .;
+       . = ALIGN(POINTER_ALIGN);
+       __param_start = .;
+       *(.data.param)
+       __param_end = .;
   } :text
 
   .data : {                    /* Data */
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 0d63685c4f..6883a4f22f 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -178,6 +178,11 @@ static void __init _cmdline_parse(const char *cmdline)
     parse_params(cmdline, __setup_start, __setup_end);
 }
 
+int runtime_parse(const char *line)
+{
+    return parse_params(line, __param_start, __param_end);
+}
+
 /**
  *    cmdline_parse -- parses the xen command line.
  * If CONFIG_CMDLINE is set, it would be parsed prior to @cmdline.
diff --git a/xen/include/xen/init.h b/xen/include/xen/init.h
index 25d2eef8dd..7c7f92c6b2 100644
--- a/xen/include/xen/init.h
+++ b/xen/include/xen/init.h
@@ -87,11 +87,16 @@ struct kernel_param {
 };
 
 extern const struct kernel_param __setup_start[], __setup_end[];
+extern const struct kernel_param __param_start[], __param_end[];
+
+#define __dataparam       __used_section(".data.param")
+
+#define __param(att)      static const att \
+    __attribute__((__aligned__(sizeof(void *)))) struct kernel_param
 
 #define __setup_str static const __initconst \
     __attribute__((__aligned__(1))) char
-#define __kparam static const __initsetup \
-    __attribute__((__aligned__(sizeof(void *)))) struct kernel_param
+#define __kparam          __param(__initsetup)
 
 #define custom_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
@@ -113,6 +118,19 @@ extern const struct kernel_param __setup_start[], 
__setup_end[];
     __kparam __setup_##_var = \
         { __setup_str_##_var, OPT_STR, sizeof(_var), &_var }
 
+#define __rtparam         __param(__dataparam)
+
+#define custom_param_runtime(_name, _var) \
+    __rtparam __rtpar_##_var = { _name, OPT_CUSTOM, 0, _var }
+#define boolean_param_runtime(_name, _var) \
+    __rtparam __rtpar_##_var = { _name, OPT_BOOL, sizeof(_var), &_var }
+#define integer_param_runtime(_name, _var) \
+    __rtparam __rtpar_##_var = { _name, OPT_UINT, sizeof(_var), &_var }
+#define size_param_runtime(_name, _var) \
+    __rtparam __rtpar_##_var = { _name, OPT_SIZE, sizeof(_var), &_var }
+#define string_param_runtime(_name, _var) \
+    __rtparam __rtpar_##_var = { _name, OPT_STR, sizeof(_var), &_var }
+
 #endif /* __ASSEMBLY__ */
 
 #ifdef CONFIG_LATE_HWDOM
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 995a85a7db..5651498de2 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -71,6 +71,7 @@
 struct domain;
 
 void cmdline_parse(const char *cmdline);
+int runtime_parse(const char *line);
 int parse_bool(const char *s);
 
 /*#define DEBUG_TRACE_DUMP*/
-- 
2.12.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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