From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v5 10/15] xen: add basic support for runtime parameter changing
Date: Mon, 28 Aug 2017 09:34:45 +0200 [thread overview]
Message-ID: <20170828073450.12024-11-jgross@suse.com> (raw)
In-Reply-To: <20170828073450.12024-1-jgross@suse.com>
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@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
V2:
- added modification of ARM linker script (Wei Liu)
V3:
- moved runtime parameter array in linker scripts (Jan Beulich)
- renamed macros to *_runtime_param() (Jan Beulich)
- added *runtime_only_param() macros (Jan Beulich)
- let *_runtime_param() macros include boot param functionality
(Jan Beulich)
---
xen/arch/arm/xen.lds.S | 4 ++++
xen/arch/x86/xen.lds.S | 4 ++++
xen/common/kernel.c | 5 +++++
xen/include/xen/init.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++--
xen/include/xen/lib.h | 1 +
5 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 2d54f224ec..c9b9546435 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -61,6 +61,10 @@ SECTIONS
*(.lockprofile.data)
__lock_profile_end = .;
#endif
+ . = ALIGN(POINTER_ALIGN);
+ __param_start = .;
+ *(.data.param)
+ __param_end = .;
} :text
#if defined(BUILD_ID)
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index ff08bbe42a..6a7bbb8ca1 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -120,6 +120,10 @@ SECTIONS
*(.lockprofile.data)
__lock_profile_end = .;
#endif
+ . = ALIGN(POINTER_ALIGN);
+ __param_start = .;
+ *(.data.param)
+ __param_end = .;
} :text
#if defined(BUILD_ID)
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 6e2f5ed9da..f96e402515 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -192,6 +192,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 234ec25aae..db06c76fdf 100644
--- a/xen/include/xen/init.h
+++ b/xen/include/xen/init.h
@@ -90,11 +90,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; \
@@ -131,6 +136,54 @@ extern const struct kernel_param __setup_start[], __setup_end[];
.len = sizeof(_var), \
.par.var = &_var }
+#define __rtparam __param(__dataparam)
+
+#define custom_runtime_only_param(_name, _var) \
+ __rtparam __rtpar_##_var = \
+ { .name = _name, \
+ .type = OPT_CUSTOM, \
+ .par.func = _var }
+#define boolean_runtime_only_param(_name, _var) \
+ __rtparam __rtpar_##_var = \
+ { .name = _name, \
+ .type = OPT_BOOL, \
+ .len = sizeof(_var), \
+ .par.var = &_var }
+#define integer_runtime_only_param(_name, _var) \
+ __rtparam __rtpar_##_var = \
+ { .name = _name, \
+ .type = OPT_UINT, \
+ .len = sizeof(_var), \
+ .par.var = &_var }
+#define size_runtime_only_param(_name, _var) \
+ __rtparam __rtpar_##_var = \
+ { .name = _name, \
+ .type = OPT_SIZE, \
+ .len = sizeof(_var), \
+ .par.var = &_var }
+#define string_runtime_only_param(_name, _var) \
+ __rtparam __rtpar_##_var = \
+ { .name = _name, \
+ .type = OPT_STR, \
+ .len = sizeof(_var), \
+ .par.var = &_var }
+
+#define custom_runtime_param(_name, _var) \
+ custom_param(_name, _var); \
+ custom_runtime_only_param(_name, _var)
+#define boolean_runtime_param(_name, _var) \
+ boolean_param(_name, _var); \
+ boolean_runtime_only_param(_name, _var)
+#define integer_runtime_param(_name, _var) \
+ integer_param(_name, _var); \
+ integer_runtime_only_param(_name, _var)
+#define size_runtime_param(_name, _var) \
+ size_param(_name, _var); \
+ size_runtime_only_param(_name, _var)
+#define string_runtime_param(_name, _var) \
+ string_param(_name, _var); \
+ string_runtime_only_param(_name, _var)
+
#endif /* __ASSEMBLY__ */
#ifdef CONFIG_LATE_HWDOM
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 8e57bbd021..ed00ae1379 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, const char *e);
/*#define DEBUG_TRACE_DUMP*/
--
2.12.3
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-08-28 7:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-28 7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
2017-08-28 7:34 ` [PATCH v5 01/15] xen/arch/x86/psr.c: let custom parameter parsing routines return errno Juergen Gross
2017-08-28 8:40 ` Jan Beulich
2017-08-28 7:34 ` [PATCH v5 02/15] xen: check parameter validity when parsing command line Juergen Gross
2017-08-28 7:34 ` [PATCH v5 03/15] xen/arch/x86/apic.c: remove custom_param() error messages Juergen Gross
2017-08-28 7:34 ` [PATCH v5 04/15] xen/arch/x86/cpu/mcheck/mce.c: " Juergen Gross
2017-08-28 7:34 ` [PATCH v5 05/15] xen/arch/x86/hvm/viridian.c: " Juergen Gross
2017-08-28 7:34 ` [PATCH v5 06/15] xen/arch/x86/io_apic.c: " Juergen Gross
2017-08-28 7:34 ` [PATCH v5 07/15] xen/common/kexec.c: " Juergen Gross
2017-08-28 7:34 ` [PATCH v5 08/15] xen/common/sched_credit2.c: " Juergen Gross
2017-08-28 7:34 ` [PATCH v5 09/15] xen: carve out a generic parsing function from _cmdline_parse() Juergen Gross
2017-08-28 7:34 ` Juergen Gross [this message]
2017-08-28 7:34 ` [PATCH v5 11/15] xen: add hypercall for setting parameters at runtime Juergen Gross
2017-08-28 7:34 ` [PATCH v5 12/15] libxc: add function to set hypervisor parameters Juergen Gross
2017-08-28 7:34 ` [PATCH v5 13/15] libxl: add libxl_set_parameters() function Juergen Gross
2017-08-28 7:34 ` [PATCH v5 14/15] xl: add new xl command set-parameters Juergen Gross
2017-08-28 7:34 ` [PATCH v5 15/15] xen: make some console related parameters settable at runtime Juergen Gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170828073450.12024-11-jgross@suse.com \
--to=jgross@suse.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).