All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/15] Support for modifying parameters at runtime
@ 2017-08-28  7:34 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
                   ` (14 more replies)
  0 siblings, 15 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Stefano Stabellini, Wei Liu, George Dunlap,
	Andrew Cooper, Dario Faggioli, Ian Jackson, Tim Deegan,
	Paul Durrant, Jan Beulich, Daniel De Graaf

Currently parameters of the hypervisor (e.g. console log level) can be
set via boot command line. Instead of having to reboot the system in
case another setting is desired, being able to modify many of those
parameters at runtime would be the better option.

This patch series addresses this by adding a new xl command
"xl set-parameters" which takes a string similar to the boot command
line as parameter and passes this string to the hypervisor which will
then use the same parsing infrastructure as for the command line in
order to apply the parameter settings.

As error checks for invalid parameters or parameter values have been
very sparse if present at all in the hypervisor, the first part of this
patch series addresses this problem first: all custom parameter parsing
functions are being changed to return success or an error. The main
parsing function tests for generic parameter value errors (like e.g.
overflow) or invalid parameters and issues a message in case an error
has been detected. Most error messages in the custom parsing functions
are removed then.

While not strictly required for runtime parameter modification I
believe an improved parameter validation is a win with or without the
runtime parameter modification support.

* Patch 1 modifies the last remaining custom parameter parsing function
  not returning success or error to do so
* Patch 2 adds generic parameter error tests in the core parameter
  parsing functions
* Patches 3-8 remove custom parsing function error messages
* Patches 9-14 add the runtime parameter modification support
* Patch 15 adds support for runtime modification of some console related
  parameters 

Changes in V5:
- 38 patches dropped as they are already applied
- Patch 1: rename variable (value -> delim, val_str -> val_delim)
    (Jan Beulich)

Changes in V4:
- added new patch 01
- patches 19, 23, 32, 34: pass end of parameter value to parse_bool()
    (Jan Beulich)
- patch 21: issue a message in case of reboot=efi and no EFI runtime services
    (Jan Beulich)
- patch 23: style correction (Jan Beulich)
- patch 32: add __initdata (Jan Beulich)
- patch 35: differentiate error return values (Jan Beulich)
- patch 35: drop pointless test for input parameter being NULL (Jan Beulich)
- patch 40: removed test for empty string from parse_bool() again, avoid
    calling parse_bool() in that case (Jan Beulich)
- patch 40: print error number in failure case (Jan Beulich)
- patch 40: limit scope of some variables (Jan Beulich)
- patch 40: use type bool for bool_assert (Jan Beulich)
- patch 49: use copy_from_guest() (Jan Beulich)
- patch 49: add more descriptive comment to sysctl.h (Jan Beulich)

Changes in V3:
- patches 7, 14, 15, 24, 27, 34: cosmetic changes (Jan Beulich)
- patches 7, 9, 10, 18, 22, 25, 31, 33, 34: dont modify option value in
    parsing function
- patches 8, 22, 25: dont return out of loop (Jan Beulich)
- patch 9: fix error in parsing routine
- patch 18: let parse_psr_bool() return bool value (Jan Beulich)
- patch 18: return error in case no string matches (Jan Beulich)
- patch 20: dont stop loop at first invalid character (Jan Beulich)
- patch 31: remove prototype of cpufreq_cmdline_parse() from cpufreq.h
    and make it static
- patch 39: use function pointer in struct kernel_param (Jan Beulich)
- patch 39: better range check in assign_integer_param() (Jan Beulich)
- patch 39: dont assign int values in case of overflow (Jan Beulich)
- patch 39: allow multiple handlers for a parameter (Jan Beulich)
- patch 47: moved runtime parameter array in linker scripts (Jan Beulich)
- patch 47: renamed macros to *_runtime_param() (Jan Beulich)
- patch 47: added *runtime_only_param() macros (Jan Beulich)
- patch 47: let *_runtime_param() macros include boot param functionality
    (Jan Beulich)
- patch 48: check pad[] to be zero (Jan Beulich)
- patch 48: return E2BIG in case of parameters too long (Jan Beulich)
- patch 48: move max. parameter size define to sysctl.c (Jan Beulich)
- patch 49: zero padding fields in sysctl.u.set_parameter
- patch 50: use LOGEV() for error message
- patch 52: *_runtime_param() now includes boot parameter setting
    (Jan Beulich)

Changes in V2:
- patch 39 (xen: check parameter validity when parsing command line):
  replaced literal 8 by BITS_PER_BYTE (Wei Liu)
  added test for empty string to parse_bool()
- patch 47 (xen: add basic support for runtime parameter changing):
  added modification of ARM linker script (Wei Liu)
- patch 48 (xen: add hypercall for setting parameters at runtime):
  corrected XSM test (Daniel De Graaf)
- patch 50 (libxl: add libxl_set_parameters() function):
  corrected coding style (Wei Liu)

Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Cc: Dario Faggioli <dario.faggioli@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: Paul Durrant <paul.durrant@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>

Juergen Gross (15):
  xen/arch/x86/psr.c: let custom parameter parsing routines return errno
  xen: check parameter validity when parsing command line
  xen/arch/x86/apic.c: remove custom_param() error messages
  xen/arch/x86/cpu/mcheck/mce.c: remove custom_param() error messages
  xen/arch/x86/hvm/viridian.c: remove custom_param() error messages
  xen/arch/x86/io_apic.c: remove custom_param() error messages
  xen/common/kexec.c: remove custom_param() error messages
  xen/common/sched_credit2.c: remove custom_param() error messages
  xen: carve out a generic parsing function from _cmdline_parse()
  xen: add basic support for runtime parameter changing
  xen: add hypercall for setting parameters at runtime
  libxc: add function to set hypervisor parameters
  libxl: add libxl_set_parameters() function
  xl: add new xl command set-parameters
  xen: make some console related parameters settable at runtime

 docs/man/xl.pod.1.in                |  5 ++
 docs/misc/xen-command-line.markdown |  8 ++++
 tools/flask/policy/modules/dom0.te  |  2 +-
 tools/libxc/include/xenctrl.h       |  1 +
 tools/libxc/xc_misc.c               | 21 +++++++++
 tools/libxl/libxl.c                 | 15 ++++++
 tools/libxl/libxl.h                 |  8 ++++
 tools/xl/xl.h                       |  1 +
 tools/xl/xl_cmdtable.c              |  5 ++
 tools/xl/xl_misc.c                  | 20 ++++++++
 xen/arch/arm/xen.lds.S              |  4 ++
 xen/arch/x86/apic.c                 |  5 +-
 xen/arch/x86/cpu/mcheck/mce.c       |  4 --
 xen/arch/x86/hvm/viridian.c         | 10 ++--
 xen/arch/x86/io_apic.c              |  3 --
 xen/arch/x86/psr.c                  | 58 ++++++++++++++---------
 xen/arch/x86/xen.lds.S              |  4 ++
 xen/common/kernel.c                 | 94 +++++++++++++++++++++++++++++--------
 xen/common/kexec.c                  |  5 --
 xen/common/sched_credit2.c          |  2 -
 xen/common/sysctl.c                 | 36 ++++++++++++++
 xen/drivers/char/console.c          | 18 +++----
 xen/include/public/sysctl.h         | 20 ++++++++
 xen/include/xen/init.h              | 87 ++++++++++++++++++++++++++++++----
 xen/include/xen/lib.h               |  1 +
 xen/include/xen/types.h             |  3 ++
 xen/xsm/flask/hooks.c               |  3 ++
 xen/xsm/flask/policy/access_vectors |  2 +
 28 files changed, 362 insertions(+), 83 deletions(-)

-- 
2.12.3


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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v5 01/15] xen/arch/x86/psr.c: let custom parameter parsing routines return errno
  2017-08-28  7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
@ 2017-08-28  7:34 ` 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
                   ` (13 subsequent siblings)
  14 siblings, 1 reply; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Andrew Cooper, Jan Beulich

Modify the custom parameter parsing routines in:

xen/arch/x86/psr.c

to indicate whether the parameter value was parsed successfully.

Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
V5:
- rename variable (value -> delim, val_str -> val_delim) (Jan Beulich)
---
 xen/arch/x86/psr.c | 58 ++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 37 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index 25a85b65b2..4515100785 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -418,50 +418,66 @@ static const struct feat_props l2_cat_props = {
     .write_msr = l2_cat_write_msr,
 };
 
-static void __init parse_psr_bool(char *s, char *value, char *feature,
+static bool __init parse_psr_bool(const char *s, const char *delim,
+                                  const char *ss, const char *feature,
                                   unsigned int mask)
 {
-    if ( !strcmp(s, feature) )
+    if ( !strncmp(s, feature, delim - s) )
     {
-        if ( !value )
+        if ( !*delim )
             opt_psr |= mask;
         else
         {
-            int val_int = parse_bool(value, NULL);
+            int val_int = parse_bool(delim + 1, ss);
 
             if ( val_int == 0 )
                 opt_psr &= ~mask;
             else if ( val_int == 1 )
                 opt_psr |= mask;
+            else
+                return false;
         }
+        return true;
     }
+    return false;
 }
 
-static void __init parse_psr_param(char *s)
+static int __init parse_psr_param(const char *s)
 {
-    char *ss, *val_str;
+    const char *ss, *val_delim;
+    const char *q;
+    int rc = 0;
 
     do {
         ss = strchr(s, ',');
-        if ( ss )
-            *ss = '\0';
-
-        val_str = strchr(s, ':');
-        if ( val_str )
-            *val_str++ = '\0';
+        if ( !ss )
+            ss = strchr(s, '\0');
 
-        parse_psr_bool(s, val_str, "cmt", PSR_CMT);
-        parse_psr_bool(s, val_str, "cat", PSR_CAT);
-        parse_psr_bool(s, val_str, "cdp", PSR_CDP);
+        val_delim = strchr(s, ':');
+        if ( !val_delim )
+            val_delim = strchr(s, '\0');
 
-        if ( val_str && !strcmp(s, "rmid_max") )
-            opt_rmid_max = simple_strtoul(val_str, NULL, 0);
-
-        if ( val_str && !strcmp(s, "cos_max") )
-            opt_cos_max = simple_strtoul(val_str, NULL, 0);
+        if ( *val_delim && !strncmp(s, "rmid_max", val_delim - s) )
+        {
+            opt_rmid_max = simple_strtoul(val_delim + 1, &q, 0);
+            if ( *q && *q != ',' )
+                rc = -EINVAL;
+        }
+        else if ( *val_delim && !strncmp(s, "cos_max", val_delim - s) )
+        {
+            opt_cos_max = simple_strtoul(val_delim + 1, &q, 0);
+            if ( *q && *q != ',' )
+                rc = -EINVAL;
+        }
+        else if ( !parse_psr_bool(s, val_delim, ss, "cmt", PSR_CMT) &&
+                  !parse_psr_bool(s, val_delim, ss, "cat", PSR_CAT) &&
+                  !parse_psr_bool(s, val_delim, ss, "cdp", PSR_CDP) )
+            rc = -EINVAL;
 
         s = ss + 1;
-    } while ( ss );
+    } while ( *ss );
+
+    return rc;
 }
 custom_param("psr", parse_psr_param);
 
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 02/15] xen: check parameter validity when parsing command line
  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  7:34 ` Juergen Gross
  2017-08-28  7:34 ` [PATCH v5 03/15] xen/arch/x86/apic.c: remove custom_param() error messages Juergen Gross
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Stefano Stabellini, Wei Liu, George Dunlap,
	Andrew Cooper, Ian Jackson, Tim Deegan, Jan Beulich

Where possible check validity of parameters in _cmdline_parse() and
issue a warning message in case of an error detected.

In order to make sure a custom parameter parsing function really
returns a value (error or success), don't use a void pointer for
storing the function address, but a proper typed function pointer.

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: Wei Liu <wei.liu2@citrix.com>
---
V4:
- removed test for empty string from parse_bool() again, avoid calling
  parse_bool() in that case (Jan Beulich)
- print error number in failure case (Jan Beulich)
- limit scope of some variables (Jan Beulich)
- use type bool for bool_assert (Jan Beulich)

V3:
- use function pointer in struct kernel_param (Jan Beulich)
- better range check in assign_integer_param() (Jan Beulich)
- dont assign int values in case of overflow (Jan Beulich)
- allow multiple handlers for a parameter (Jan Beulich)

V2:
- replaced literal 8 by BITS_PER_BYTE (Wei Liu)
- added test for empty string to parse_bool()
---
 xen/common/kernel.c     | 68 ++++++++++++++++++++++++++++++++++++++-----------
 xen/include/xen/init.h  | 30 +++++++++++++++++-----
 xen/include/xen/types.h |  3 +++
 3 files changed, 80 insertions(+), 21 deletions(-)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 71bc547d17..a0611d6c7c 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -23,34 +23,43 @@ enum system_state system_state = SYS_STATE_early_boot;
 xen_commandline_t saved_cmdline;
 static const char __initconst opt_builtin_cmdline[] = CONFIG_CMDLINE;
 
-static void __init assign_integer_param(
+static int __init assign_integer_param(
     const struct kernel_param *param, uint64_t val)
 {
     switch ( param->len )
     {
     case sizeof(uint8_t):
-        *(uint8_t *)param->var = val;
+        if ( val > UINT8_MAX && val < (uint64_t)INT8_MIN )
+            return -EOVERFLOW;
+        *(uint8_t *)param->par.var = val;
         break;
     case sizeof(uint16_t):
-        *(uint16_t *)param->var = val;
+        if ( val > UINT16_MAX && val < (uint64_t)INT16_MIN )
+            return -EOVERFLOW;
+        *(uint16_t *)param->par.var = val;
         break;
     case sizeof(uint32_t):
-        *(uint32_t *)param->var = val;
+        if ( val > UINT32_MAX && val < (uint64_t)INT32_MIN )
+            return -EOVERFLOW;
+        *(uint32_t *)param->par.var = val;
         break;
     case sizeof(uint64_t):
-        *(uint64_t *)param->var = val;
+        *(uint64_t *)param->par.var = val;
         break;
     default:
         BUG();
     }
+
+    return 0;
 }
 
 static void __init _cmdline_parse(const char *cmdline)
 {
     char opt[128], *optval, *optkey, *q;
-    const char *p = cmdline;
+    const char *p = cmdline, *key;
     const struct kernel_param *param;
-    int bool_assert;
+    int rc;
+    bool bool_assert, found;
 
     for ( ; ; )
     {
@@ -84,46 +93,66 @@ static void __init _cmdline_parse(const char *cmdline)
         }
 
         /* Boolean parameters can be inverted with 'no-' prefix. */
+        key = optkey;
         bool_assert = !!strncmp("no-", optkey, 3);
         if ( !bool_assert )
             optkey += 3;
 
+        rc = 0;
+        found = false;
         for ( param = __setup_start; param < __setup_end; param++ )
         {
+            int rctmp;
+            const char *s;
+
             if ( strcmp(param->name, optkey) )
             {
                 if ( param->type == OPT_CUSTOM && q &&
                      strlen(param->name) == q + 1 - opt &&
                      !strncmp(param->name, opt, q + 1 - opt) )
                 {
+                    found = true;
                     optval[-1] = '=';
-                    ((void (*)(const char *))param->var)(q);
+                    rctmp = param->par.func(q);
                     optval[-1] = '\0';
+                    if ( !rc )
+                        rc = rctmp;
                 }
                 continue;
             }
 
+            rctmp = 0;
+            found = true;
             switch ( param->type )
             {
             case OPT_STR:
-                strlcpy(param->var, optval, param->len);
+                strlcpy(param->par.var, optval, param->len);
                 break;
             case OPT_UINT:
-                assign_integer_param(
+                rctmp = assign_integer_param(
                     param,
-                    simple_strtoll(optval, NULL, 0));
+                    simple_strtoll(optval, &s, 0));
+                if ( *s )
+                    rctmp = -EINVAL;
                 break;
             case OPT_BOOL:
-                if ( !parse_bool(*optval ? optval : "yes", NULL) )
+                rctmp = *optval ? parse_bool(optval, NULL) : 0;
+                if ( rctmp < 0 )
+                    break;
+                if ( !rctmp )
                     bool_assert = !bool_assert;
+                rctmp = 0;
                 assign_integer_param(param, bool_assert);
                 break;
             case OPT_SIZE:
-                assign_integer_param(
+                rctmp = assign_integer_param(
                     param,
-                    parse_size_and_unit(optval, NULL));
+                    parse_size_and_unit(optval, &s));
+                if ( *s )
+                    rctmp = -EINVAL;
                 break;
             case OPT_CUSTOM:
+                rctmp = -EINVAL;
                 if ( !bool_assert )
                 {
                     if ( *optval )
@@ -131,13 +160,22 @@ static void __init _cmdline_parse(const char *cmdline)
                     safe_strcpy(opt, "no");
                     optval = opt;
                 }
-                ((void (*)(const char *))param->var)(optval);
+                rctmp = param->par.func(optval);
                 break;
             default:
                 BUG();
                 break;
             }
+
+            if ( !rc )
+                rc = rctmp;
         }
+
+        if ( rc )
+            printk("parameter \"%s\" has invalid value \"%s\", rc=%d!\n",
+                    key, optval, rc);
+        if ( !found )
+            printk("parameter \"%s\" unknown!\n", key);
     }
 }
 
diff --git a/xen/include/xen/init.h b/xen/include/xen/init.h
index 25d2eef8dd..234ec25aae 100644
--- a/xen/include/xen/init.h
+++ b/xen/include/xen/init.h
@@ -83,7 +83,10 @@ struct kernel_param {
         OPT_CUSTOM
     } type;
     unsigned int len;
-    void *var;
+    union {
+        void *var;
+        int (*func)(const char *);
+    } par;
 };
 
 extern const struct kernel_param __setup_start[], __setup_end[];
@@ -95,23 +98,38 @@ extern const struct kernel_param __setup_start[], __setup_end[];
 
 #define custom_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
-    __kparam __setup_##_var = { __setup_str_##_var, OPT_CUSTOM, 0, _var }
+    __kparam __setup_##_var = \
+        { .name = __setup_str_##_var, \
+          .type = OPT_CUSTOM, \
+          .par.func = _var }
 #define boolean_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_BOOL, sizeof(_var), &_var }
+        { .name = __setup_str_##_var, \
+          .type = OPT_BOOL, \
+          .len = sizeof(_var), \
+          .par.var = &_var }
 #define integer_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_UINT, sizeof(_var), &_var }
+        { .name = __setup_str_##_var, \
+          .type = OPT_UINT, \
+          .len = sizeof(_var), \
+          .par.var = &_var }
 #define size_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_SIZE, sizeof(_var), &_var }
+        { .name = __setup_str_##_var, \
+          .type = OPT_SIZE, \
+          .len = sizeof(_var), \
+          .par.var = &_var }
 #define string_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_STR, sizeof(_var), &_var }
+        { .name = __setup_str_##_var, \
+          .type = OPT_STR, \
+          .len = sizeof(_var), \
+          .par.var = &_var }
 
 #endif /* __ASSEMBLY__ */
 
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index b1dbb8720a..03f0fe612e 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -14,12 +14,15 @@
 #define NULL ((void*)0)
 #endif
 
+#define INT8_MIN        (-127-1)
 #define INT16_MIN       (-32767-1)
 #define INT32_MIN       (-2147483647-1)
 
+#define INT8_MAX        (127)
 #define INT16_MAX       (32767)
 #define INT32_MAX       (2147483647)
 
+#define UINT8_MAX       (255)
 #define UINT16_MAX      (65535)
 #define UINT32_MAX      (4294967295U)
 
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 03/15] xen/arch/x86/apic.c: remove custom_param() error messages
  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  7:34 ` [PATCH v5 02/15] xen: check parameter validity when parsing command line Juergen Gross
@ 2017-08-28  7:34 ` Juergen Gross
  2017-08-28  7:34 ` [PATCH v5 04/15] xen/arch/x86/cpu/mcheck/mce.c: " Juergen Gross
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Andrew Cooper, Jan Beulich

With _cmdline_parse() now issuing error messages in case of illegal
parameters signalled by parsing functions specified in custom_param()
the message issued by apic_set_verbosity() can be removed.

Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/apic.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 325b48074a..2638414e08 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -800,11 +800,8 @@ static int __init apic_set_verbosity(const char *str)
         apic_verbosity = APIC_DEBUG;
     else if (strcmp("verbose", str) == 0)
         apic_verbosity = APIC_VERBOSE;
-    else {
-        printk(KERN_WARNING "APIC Verbosity level %s not recognised"
-               " use apic_verbosity=verbose or apic_verbosity=debug", str);
+    else
         return -EINVAL;
-    }
 
     return 0;
 }
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 04/15] xen/arch/x86/cpu/mcheck/mce.c: remove custom_param() error messages
  2017-08-28  7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
                   ` (2 preceding siblings ...)
  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 ` Juergen Gross
  2017-08-28  7:34 ` [PATCH v5 05/15] xen/arch/x86/hvm/viridian.c: " Juergen Gross
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Andrew Cooper, Jan Beulich

With _cmdline_parse() now issuing error messages in case of illegal
parameters signalled by parsing functions specified in custom_param()
the message issued by mce_set_verbosity() can be removed.

Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/mcheck/mce.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 8015dff8c4..7affe2591e 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -67,11 +67,7 @@ static int __init mce_set_verbosity(const char *str)
     if (strcmp("verbose", str) == 0)
         mce_verbosity = MCE_VERBOSE;
     else
-    {
-        printk(KERN_DEBUG "Machine Check verbosity level %s not recognised"
-               "use mce_verbosity=verbose", str);
         return -EINVAL;
-    }
 
     return 0;
 }
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 05/15] xen/arch/x86/hvm/viridian.c: remove custom_param() error messages
  2017-08-28  7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
                   ` (3 preceding siblings ...)
  2017-08-28  7:34 ` [PATCH v5 04/15] xen/arch/x86/cpu/mcheck/mce.c: " Juergen Gross
@ 2017-08-28  7:34 ` Juergen Gross
  2017-08-28  7:34 ` [PATCH v5 06/15] xen/arch/x86/io_apic.c: " Juergen Gross
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Andrew Cooper, Paul Durrant, Jan Beulich

With _cmdline_parse() now issuing error messages in case of illegal
parameters signalled by parsing functions specified in custom_param()
the message issued by parse_viridian_version() can be removed.

Cc: Paul Durrant <paul.durrant@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
---
 xen/arch/x86/hvm/viridian.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian.c b/xen/arch/x86/hvm/viridian.c
index 2edf9d0b23..e0546f32fc 100644
--- a/xen/arch/x86/hvm/viridian.c
+++ b/xen/arch/x86/hvm/viridian.c
@@ -1104,7 +1104,7 @@ static int __init parse_viridian_version(const char *arg)
         {
             n[i] = simple_strtoul(arg, &e, 0);
             if ( e != t )
-                goto fail;
+                break;
         }
 
         i++;
@@ -1112,12 +1112,12 @@ static int __init parse_viridian_version(const char *arg)
     } while ( *t );
 
     if ( i != 3 )
-        goto fail;
+        return -EINVAL;
 
     if ( ((typeof(viridian_major))n[0] != n[0]) ||
          ((typeof(viridian_minor))n[1] != n[1]) ||
          ((typeof(viridian_build))n[2] != n[2]) )
-        goto fail;
+        return -EINVAL;
 
     viridian_major = n[0];
     viridian_minor = n[1];
@@ -1126,10 +1126,6 @@ static int __init parse_viridian_version(const char *arg)
     printk("viridian-version = %#x,%#x,%#x\n",
            viridian_major, viridian_minor, viridian_build);
     return 0;
-
- fail:
-    printk(XENLOG_WARNING "Invalid viridian-version, using default\n");
-    return -EINVAL;
 }
 custom_param("viridian-version", parse_viridian_version);
 
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 06/15] xen/arch/x86/io_apic.c: remove custom_param() error messages
  2017-08-28  7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
                   ` (4 preceding siblings ...)
  2017-08-28  7:34 ` [PATCH v5 05/15] xen/arch/x86/hvm/viridian.c: " Juergen Gross
@ 2017-08-28  7:34 ` Juergen Gross
  2017-08-28  7:34 ` [PATCH v5 07/15] xen/common/kexec.c: " Juergen Gross
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Andrew Cooper, Jan Beulich

With _cmdline_parse() now issuing error messages in case of illegal
parameters signalled by parsing functions specified in custom_param()
the message issued by setup_ioapic_ack() can be removed.

Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/io_apic.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index f767c4560c..f959090ca0 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1594,10 +1594,7 @@ static int __init setup_ioapic_ack(const char *s)
         ioapic_ack_forced = true;
     }
     else
-    {
-        printk("Unknown ioapic_ack value specified: '%s'\n", s);
         return -EINVAL;
-    }
 
     return 0;
 }
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 07/15] xen/common/kexec.c: remove custom_param() error messages
  2017-08-28  7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
                   ` (5 preceding siblings ...)
  2017-08-28  7:34 ` [PATCH v5 06/15] xen/arch/x86/io_apic.c: " Juergen Gross
@ 2017-08-28  7:34 ` Juergen Gross
  2017-08-28  7:34 ` [PATCH v5 08/15] xen/common/sched_credit2.c: " Juergen Gross
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Andrew Cooper

With _cmdline_parse() now issuing error messages in case of illegal
parameters signalled by parsing functions specified in custom_param()
some messages issued by parse_low_crashinfo() and
parse_crashinfo_maxaddr() can be removed.

Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 xen/common/kexec.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/xen/common/kexec.c b/xen/common/kexec.c
index fcc68bd4d8..e0f1e3eafa 100644
--- a/xen/common/kexec.c
+++ b/xen/common/kexec.c
@@ -213,7 +213,6 @@ static int __init parse_low_crashinfo(const char *str)
         low_crashinfo_mode = LOW_CRASHINFO_ALL;
     else
     {
-        printk("Unknown low_crashinfo parameter '%s'.  Defaulting to min.\n", str);
         low_crashinfo_mode = LOW_CRASHINFO_MIN;
         return -EINVAL;
     }
@@ -240,11 +239,7 @@ static int __init parse_crashinfo_maxaddr(const char *str)
     if ( (addr = parse_size_and_unit(str, &q)) )
         crashinfo_maxaddr = addr;
     else
-    {
-        printk("Unable to parse crashinfo_maxaddr. Defaulting to %"PRIpaddr"\n",
-               crashinfo_maxaddr);
         return -EINVAL;
-    }
 
     return *q ? -EINVAL : 0;
 }
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 08/15] xen/common/sched_credit2.c: remove custom_param() error messages
  2017-08-28  7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
                   ` (6 preceding siblings ...)
  2017-08-28  7:34 ` [PATCH v5 07/15] xen/common/kexec.c: " Juergen Gross
@ 2017-08-28  7:34 ` Juergen Gross
  2017-08-28  7:34 ` [PATCH v5 09/15] xen: carve out a generic parsing function from _cmdline_parse() Juergen Gross
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, George Dunlap, Dario Faggioli

With _cmdline_parse() now issuing error messages in case of illegal
parameters signalled by parsing functions specified in custom_param()
the message issued by parse_credit2_runqueue() can be removed.

Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Dario Faggioli <dario.faggioli@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
---
 xen/common/sched_credit2.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index 9b1db1351f..2da9cc2ffb 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -352,8 +352,6 @@ static int parse_credit2_runqueue(const char *s)
         }
     }
 
-    printk("WARNING, unrecognized value of credit2_runqueue option!\n");
-
     return -EINVAL;
 }
 custom_param("credit2_runqueue", parse_credit2_runqueue);
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 09/15] xen: carve out a generic parsing function from _cmdline_parse()
  2017-08-28  7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
                   ` (7 preceding siblings ...)
  2017-08-28  7:34 ` [PATCH v5 08/15] xen/common/sched_credit2.c: " Juergen Gross
@ 2017-08-28  7:34 ` Juergen Gross
  2017-08-28  7:34 ` [PATCH v5 10/15] xen: add basic support for runtime parameter changing Juergen Gross
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Stefano Stabellini, Wei Liu, George Dunlap,
	Andrew Cooper, Ian Jackson, Tim Deegan, Jan Beulich

In order to support generic parameter parsing carve out the parser from
_cmdline_parse(). As this generic function might be called after boot
remove the __init annotations from all called sub-functions.

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: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/kernel.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index a0611d6c7c..6e2f5ed9da 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -23,8 +23,7 @@ enum system_state system_state = SYS_STATE_early_boot;
 xen_commandline_t saved_cmdline;
 static const char __initconst opt_builtin_cmdline[] = CONFIG_CMDLINE;
 
-static int __init assign_integer_param(
-    const struct kernel_param *param, uint64_t val)
+static int assign_integer_param(const struct kernel_param *param, uint64_t val)
 {
     switch ( param->len )
     {
@@ -53,12 +52,13 @@ static int __init assign_integer_param(
     return 0;
 }
 
-static void __init _cmdline_parse(const char *cmdline)
+static int parse_params(const char *cmdline, const struct kernel_param *start,
+                        const struct kernel_param *end)
 {
     char opt[128], *optval, *optkey, *q;
     const char *p = cmdline, *key;
     const struct kernel_param *param;
-    int rc;
+    int rc, final_rc = 0;
     bool bool_assert, found;
 
     for ( ; ; )
@@ -100,7 +100,7 @@ static void __init _cmdline_parse(const char *cmdline)
 
         rc = 0;
         found = false;
-        for ( param = __setup_start; param < __setup_end; param++ )
+        for ( param = start; param < end; param++ )
         {
             int rctmp;
             const char *s;
@@ -172,11 +172,24 @@ static void __init _cmdline_parse(const char *cmdline)
         }
 
         if ( rc )
+        {
             printk("parameter \"%s\" has invalid value \"%s\", rc=%d!\n",
                     key, optval, rc);
+            final_rc = rc;
+        }
         if ( !found )
+        {
             printk("parameter \"%s\" unknown!\n", key);
+            final_rc = -EINVAL;
+        }
     }
+
+    return final_rc;
+}
+
+static void __init _cmdline_parse(const char *cmdline)
+{
+    parse_params(cmdline, __setup_start, __setup_end);
 }
 
 /**
@@ -201,7 +214,7 @@ void __init cmdline_parse(const char *cmdline)
 #endif
 }
 
-int __init parse_bool(const char *s, const char *e)
+int parse_bool(const char *s, const char *e)
 {
     unsigned int len;
 
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 10/15] xen: add basic support for runtime parameter changing
  2017-08-28  7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
                   ` (8 preceding siblings ...)
  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
  2017-08-28  7:34 ` [PATCH v5 11/15] xen: add hypercall for setting parameters at runtime Juergen Gross
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Stefano Stabellini, Wei Liu, George Dunlap,
	Andrew Cooper, Ian Jackson, Tim Deegan, Jan Beulich

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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 11/15] xen: add hypercall for setting parameters at runtime
  2017-08-28  7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
                   ` (9 preceding siblings ...)
  2017-08-28  7:34 ` [PATCH v5 10/15] xen: add basic support for runtime parameter changing Juergen Gross
@ 2017-08-28  7:34 ` Juergen Gross
  2017-08-28  7:34 ` [PATCH v5 12/15] libxc: add function to set hypervisor parameters Juergen Gross
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Stefano Stabellini, Wei Liu, George Dunlap,
	Andrew Cooper, Ian Jackson, Tim Deegan, Jan Beulich,
	Daniel De Graaf

Add a sysctl hypercall to support setting parameters similar to
command line parameters, but at runtime. The parameters to set are
specified as a string, just like the boot parameters.

Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@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>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
---
V4:
- use copy_from_guest() (Jan Beulich)
- add more descriptive comment to sysctl.h (Jan Beulich)

V3:
- check pad[] to be zero (Jan Beulich)
- return E2BIG in case of parameters too long (Jan Beulich)
- move max. parameter size define to sysctl.c (Jan Beulich)

V2:
- corrected XSM test (Daniel De Graaf)
---
 tools/flask/policy/modules/dom0.te  |  2 +-
 xen/common/sysctl.c                 | 36 ++++++++++++++++++++++++++++++++++++
 xen/include/public/sysctl.h         | 20 ++++++++++++++++++++
 xen/xsm/flask/hooks.c               |  3 +++
 xen/xsm/flask/policy/access_vectors |  2 ++
 5 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/tools/flask/policy/modules/dom0.te b/tools/flask/policy/modules/dom0.te
index d0a4d91ac0..338caaf41e 100644
--- a/tools/flask/policy/modules/dom0.te
+++ b/tools/flask/policy/modules/dom0.te
@@ -16,7 +16,7 @@ allow dom0_t xen_t:xen {
 allow dom0_t xen_t:xen2 {
 	resource_op psr_cmt_op psr_cat_op pmu_ctrl get_symbol
 	get_cpu_levelling_caps get_cpu_featureset livepatch_op
-	gcov_op
+	gcov_op set_parameter
 };
 
 # Allow dom0 to use all XENVER_ subops that have checks.
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index ae58a0f650..a6882d1c9d 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -467,6 +467,42 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
             copyback = 1;
         break;
 
+    case XEN_SYSCTL_set_parameter:
+    {
+#define XEN_SET_PARAMETER_MAX_SIZE 1023
+        char *params;
+
+        if ( op->u.set_parameter.pad[0] || op->u.set_parameter.pad[1] ||
+             op->u.set_parameter.pad[2] )
+        {
+            ret = -EINVAL;
+            break;
+        }
+        if ( op->u.set_parameter.size > XEN_SET_PARAMETER_MAX_SIZE )
+        {
+            ret = -E2BIG;
+            break;
+        }
+        params = xmalloc_bytes(op->u.set_parameter.size + 1);
+        if ( !params )
+        {
+            ret = -ENOMEM;
+            break;
+        }
+        if ( copy_from_guest(params, op->u.set_parameter.params,
+                             op->u.set_parameter.size) )
+            ret = -EFAULT;
+        else
+        {
+            params[op->u.set_parameter.size] = 0;
+            ret = runtime_parse(params);
+        }
+
+        xfree(params);
+
+        break;
+    }
+
     default:
         ret = arch_do_sysctl(op, u_sysctl);
         copyback = 0;
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index 9e51af61e1..7830b987da 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -1096,6 +1096,24 @@ struct xen_sysctl_livepatch_op {
 typedef struct xen_sysctl_livepatch_op xen_sysctl_livepatch_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_livepatch_op_t);
 
+/*
+ * XEN_SYSCTL_set_parameter
+ *
+ * Change hypervisor parameters at runtime.
+ * The input string is parsed similar to the boot parameters.
+ * Parameters are a single string terminated by a NUL byte of max. size
+ * characters. Multiple settings can be specified by separating them
+ * with blanks.
+ */
+
+struct xen_sysctl_set_parameter {
+    XEN_GUEST_HANDLE_64(char) params;       /* IN: pointer to parameters. */
+    uint16_t size;                          /* IN: size of parameters. */
+    uint16_t pad[3];                        /* IN: MUST be zero. */
+};
+typedef struct xen_sysctl_set_parameter xen_sysctl_set_parameter_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_set_parameter_t);
+
 struct xen_sysctl {
     uint32_t cmd;
 #define XEN_SYSCTL_readconsole                    1
@@ -1124,6 +1142,7 @@ struct xen_sysctl {
 #define XEN_SYSCTL_get_cpu_levelling_caps        25
 #define XEN_SYSCTL_get_cpu_featureset            26
 #define XEN_SYSCTL_livepatch_op                  27
+#define XEN_SYSCTL_set_parameter                 28
     uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
     union {
         struct xen_sysctl_readconsole       readconsole;
@@ -1152,6 +1171,7 @@ struct xen_sysctl {
         struct xen_sysctl_cpu_levelling_caps cpu_levelling_caps;
         struct xen_sysctl_cpu_featureset    cpu_featureset;
         struct xen_sysctl_livepatch_op      livepatch;
+        struct xen_sysctl_set_parameter     set_parameter;
         uint8_t                             pad[128];
     } u;
 };
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 276ca97608..4989335f4a 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -828,6 +828,9 @@ static int flask_sysctl(int cmd)
     case XEN_SYSCTL_gcov_op:
         return avc_current_has_perm(SECINITSID_XEN, SECCLASS_XEN2,
                                     XEN2__GCOV_OP, NULL);
+    case XEN_SYSCTL_set_parameter:
+        return avc_current_has_perm(SECINITSID_XEN, SECCLASS_XEN2,
+                                    XEN2__SET_PARAMETER, NULL);
 
     default:
         return avc_unknown_permission("sysctl", cmd);
diff --git a/xen/xsm/flask/policy/access_vectors b/xen/xsm/flask/policy/access_vectors
index f276f04e29..da9f3dfb2e 100644
--- a/xen/xsm/flask/policy/access_vectors
+++ b/xen/xsm/flask/policy/access_vectors
@@ -101,6 +101,8 @@ class xen2
     livepatch_op
 # XEN_SYSCTL_gcov_op
     gcov_op
+# XEN_SYSCTL_set_parameter
+    set_parameter
 }
 
 # Classes domain and domain2 consist of operations that a domain performs on
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 12/15] libxc: add function to set hypervisor parameters
  2017-08-28  7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
                   ` (10 preceding siblings ...)
  2017-08-28  7:34 ` [PATCH v5 11/15] xen: add hypercall for setting parameters at runtime Juergen Gross
@ 2017-08-28  7:34 ` Juergen Gross
  2017-08-28  7:34 ` [PATCH v5 13/15] libxl: add libxl_set_parameters() function Juergen Gross
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Wei Liu, Ian Jackson

Add a new libxc function to set hypervisor parameters at runtime
similar to boot time parameters via command line.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
V3:
- zero padding fields in sysctl.u.set_parameter
---
 tools/libxc/include/xenctrl.h |  1 +
 tools/libxc/xc_misc.c         | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index c7710b8f36..ad5e6b3d77 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1210,6 +1210,7 @@ int xc_readconsolering(xc_interface *xch,
                        int clear, int incremental, uint32_t *pindex);
 
 int xc_send_debug_keys(xc_interface *xch, char *keys);
+int xc_set_parameters(xc_interface *xch, char *params);
 
 typedef xen_sysctl_physinfo_t xc_physinfo_t;
 typedef xen_sysctl_cputopo_t xc_cputopo_t;
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
index 2303293c6c..7e15e904e3 100644
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -187,6 +187,27 @@ int xc_send_debug_keys(xc_interface *xch, char *keys)
     return ret;
 }
 
+int xc_set_parameters(xc_interface *xch, char *params)
+{
+    int ret, len = strlen(params);
+    DECLARE_SYSCTL;
+    DECLARE_HYPERCALL_BOUNCE(params, len, XC_HYPERCALL_BUFFER_BOUNCE_IN);
+
+    if ( xc_hypercall_bounce_pre(xch, params) )
+        return -1;
+
+    sysctl.cmd = XEN_SYSCTL_set_parameter;
+    set_xen_guest_handle(sysctl.u.set_parameter.params, params);
+    sysctl.u.set_parameter.size = len;
+    memset(sysctl.u.set_parameter.pad, 0, sizeof(sysctl.u.set_parameter.pad));
+
+    ret = do_sysctl(xch, &sysctl);
+
+    xc_hypercall_bounce_post(xch, params);
+
+    return ret;
+}
+
 int xc_physinfo(xc_interface *xch,
                 xc_physinfo_t *put_info)
 {
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 13/15] libxl: add libxl_set_parameters() function
  2017-08-28  7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
                   ` (11 preceding siblings ...)
  2017-08-28  7:34 ` [PATCH v5 12/15] libxc: add function to set hypervisor parameters Juergen Gross
@ 2017-08-28  7:34 ` 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
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Wei Liu, Ian Jackson

Add a new libxl function to set hypervisor parameters at runtime
similar to boot time parameters via command line.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
V2:
- corrected coding style (Wei Liu)
- removed superfluous #ifdef (Wei Liu)

V3:
- use LOGEV() for error message
---
 tools/libxl/libxl.c | 15 +++++++++++++++
 tools/libxl/libxl.h |  8 ++++++++
 2 files changed, 23 insertions(+)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 0ef874406f..247c56cf83 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -652,6 +652,21 @@ int libxl_send_debug_keys(libxl_ctx *ctx, char *keys)
     return 0;
 }
 
+int libxl_set_parameters(libxl_ctx *ctx, char *params)
+{
+    int ret;
+    GC_INIT(ctx);
+
+    ret = xc_set_parameters(ctx->xch, params);
+    if (ret < 0) {
+        LOGEV(ERROR, ret, "setting parameters");
+        GC_FREE;
+        return ERROR_FAIL;
+    }
+    GC_FREE;
+    return 0;
+}
+
 static int fd_set_flags(libxl_ctx *ctx, int fd,
                         int fcntlgetop, int fcntlsetop, const char *fl,
                         int flagmask, int set_p)
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 229e289750..17045253ab 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -1051,6 +1051,13 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
  */
 #define LIBXL_HAVE_QED 1
 
+/*
+ * LIBXL_HAVE_SET_PARAMETERS
+ *
+ * If this is defined setting hypervisor parameters is supported.
+ */
+#define LIBXL_HAVE_SET_PARAMETERS 1
+
 typedef char **libxl_string_list;
 void libxl_string_list_dispose(libxl_string_list *sl);
 int libxl_string_list_length(const libxl_string_list *sl);
@@ -2105,6 +2112,7 @@ int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
                        libxl_trigger trigger, uint32_t vcpuid);
 int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq);
 int libxl_send_debug_keys(libxl_ctx *ctx, char *keys);
+int libxl_set_parameters(libxl_ctx *ctx, char *params);
 
 typedef struct libxl__xen_console_reader libxl_xen_console_reader;
 
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 14/15] xl: add new xl command set-parameters
  2017-08-28  7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
                   ` (12 preceding siblings ...)
  2017-08-28  7:34 ` [PATCH v5 13/15] libxl: add libxl_set_parameters() function Juergen Gross
@ 2017-08-28  7:34 ` Juergen Gross
  2017-08-28  7:34 ` [PATCH v5 15/15] xen: make some console related parameters settable at runtime Juergen Gross
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Wei Liu, Ian Jackson

Add a new xl command "set-parameters" to set hypervisor parameters at
runtime similar to boot time parameters via command line.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
 docs/man/xl.pod.1.in   |  5 +++++
 tools/xl/xl.h          |  1 +
 tools/xl/xl_cmdtable.c |  5 +++++
 tools/xl/xl_misc.c     | 20 ++++++++++++++++++++
 4 files changed, 31 insertions(+)

diff --git a/docs/man/xl.pod.1.in b/docs/man/xl.pod.1.in
index 16c83066fe..3d5f2f7359 100644
--- a/docs/man/xl.pod.1.in
+++ b/docs/man/xl.pod.1.in
@@ -822,6 +822,11 @@ Pass the VNC password to vncviewer via stdin.
 Send debug I<keys> to Xen. It is the same as pressing the Xen
 "conswitch" (Ctrl-A by default) three times and then pressing "keys".
 
+=item B<set-parameters> I<params>
+
+Set hypervisor parameters as specified in I<params>. This allows for some
+boot parameters of the hypervisor to be modified in the running systems.
+
 =item B<dmesg> [I<OPTIONS>]
 
 Reads the Xen message buffer, similar to dmesg on a Linux system.  The
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index aa95b77146..5d3d2a4835 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -154,6 +154,7 @@ int main_rename(int argc, char **argv);
 int main_trigger(int argc, char **argv);
 int main_sysrq(int argc, char **argv);
 int main_debug_keys(int argc, char **argv);
+int main_set_parameters(int argc, char **argv);
 int main_dmesg(int argc, char **argv);
 int main_top(int argc, char **argv);
 int main_networkattach(int argc, char **argv);
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 2c71a9f776..ba0159df67 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -309,6 +309,11 @@ struct cmd_spec cmd_table[] = {
       "Send debug keys to Xen",
       "<Keys>",
     },
+    { "set-parameters",
+      &main_set_parameters, 0, 1,
+      "Set hypervisor parameters",
+      "<Params>",
+    },
     { "dmesg",
       &main_dmesg, 0, 0,
       "Read and/or clear dmesg buffer",
diff --git a/tools/xl/xl_misc.c b/tools/xl/xl_misc.c
index 9c6227af23..dcf940a6d4 100644
--- a/tools/xl/xl_misc.c
+++ b/tools/xl/xl_misc.c
@@ -155,6 +155,26 @@ int main_debug_keys(int argc, char **argv)
     return EXIT_SUCCESS;
 }
 
+int main_set_parameters(int argc, char **argv)
+{
+    int opt;
+    char *params;
+
+    SWITCH_FOREACH_OPT(opt, "", NULL, "set-parameters", 1) {
+        /* No options */
+    }
+
+    params = argv[optind];
+
+    if (libxl_set_parameters(ctx, params)) {
+        fprintf(stderr, "cannot set parameters: %s\n", params);
+        fprintf(stderr, "Use \"xl dmesg\" to look for possible reason.\n");
+        return EXIT_FAILURE;
+    }
+
+    return EXIT_SUCCESS;
+}
+
 int main_devd(int argc, char **argv)
 {
     int ret = 0, opt = 0, daemonize = 1;
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v5 15/15] xen: make some console related parameters settable at runtime
  2017-08-28  7:34 [PATCH v5 00/15] Support for modifying parameters at runtime Juergen Gross
                   ` (13 preceding siblings ...)
  2017-08-28  7:34 ` [PATCH v5 14/15] xl: add new xl command set-parameters Juergen Gross
@ 2017-08-28  7:34 ` Juergen Gross
  14 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-08-28  7:34 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Stefano Stabellini, Wei Liu, George Dunlap,
	Andrew Cooper, Ian Jackson, Tim Deegan, Jan Beulich

Support modifying conswitch, console_timestamps, loglvl and
guest_loglvl at runtime.

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: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
V3:
- *_runtime_param() now includes boot parameter setting (Jan Beulich)
---
 docs/misc/xen-command-line.markdown |  8 ++++++++
 xen/drivers/char/console.c          | 18 +++++++++---------
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 4002eab08b..9797c8db2d 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -391,6 +391,8 @@ makes sense on its own.
 
 > Default: `none`
 
+> Can be modified at runtime
+
 Specify which timestamp format Xen should use for each console line.
 
 * `none`: No timestamps
@@ -417,6 +419,8 @@ into the console ring buffer.
 
 > Default: `conswitch=a`
 
+> Can be modified at runtime
+
 Specify which character should be used to switch serial input between
 Xen and dom0.  The required sequence is CTRL-&lt;switch char&gt; three
 times.
@@ -898,6 +902,8 @@ maximum number of maptrack frames domain.
 
 > Default: `guest_loglvl=none/warning`
 
+> Can be modified at runtime
+
 Set the logging level for Xen guests.  Any log message with equal more
 more importance will be printed.
 
@@ -1164,6 +1170,8 @@ if left disabled by the BIOS.
 
 > Default: `loglvl=warning`
 
+> Can be modified at runtime
+
 Set the logging level for Xen.  Any log message with equal more more
 importance will be printed.
 
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 36f94e6b94..19d0e74f17 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -40,7 +40,7 @@ string_param("console", opt_console);
 /* Char 2: If this character is 'x', then do not auto-switch to DOM0 when it */
 /*         boots. Any other value, or omitting the char, enables auto-switch */
 static unsigned char __read_mostly opt_conswitch[3] = "a";
-string_param("conswitch", opt_conswitch);
+string_runtime_param("conswitch", opt_conswitch);
 
 /* sync_console: force synchronous console output (useful for debugging). */
 static bool_t __initdata opt_sync_console;
@@ -68,7 +68,7 @@ enum con_timestamp_mode
 static enum con_timestamp_mode __read_mostly opt_con_timestamp_mode = TSM_NONE;
 
 static int parse_console_timestamps(const char *s);
-custom_param("console_timestamps", parse_console_timestamps);
+custom_runtime_param("console_timestamps", parse_console_timestamps);
 
 /* conring_size: allows a large console ring than default (16kB). */
 static uint32_t __initdata opt_conring_size;
@@ -134,8 +134,8 @@ static int parse_guest_loglvl(const char *s);
  * Similar definitions for guest_loglvl, but applies to guest tracing.
  * Defaults: loglvl=warning ; guest_loglvl=none/warning
  */
-custom_param("loglvl", parse_loglvl);
-custom_param("guest_loglvl", parse_guest_loglvl);
+custom_runtime_param("loglvl", parse_loglvl);
+custom_runtime_param("guest_loglvl", parse_guest_loglvl);
 
 static atomic_t print_everything = ATOMIC_INIT(0);
 
@@ -145,7 +145,7 @@ static atomic_t print_everything = ATOMIC_INIT(0);
         return (lvlnum);                                \
     }
 
-static int __init __parse_loglvl(const char *s, const char **ps)
+static int __parse_loglvl(const char *s, const char **ps)
 {
     ___parse_loglvl(s, ps, "none",    0);
     ___parse_loglvl(s, ps, "error",   1);
@@ -156,7 +156,7 @@ static int __init __parse_loglvl(const char *s, const char **ps)
     return 2; /* sane fallback */
 }
 
-static int __init _parse_loglvl(const char *s, int *lower, int *upper)
+static int _parse_loglvl(const char *s, int *lower, int *upper)
 {
     *lower = *upper = __parse_loglvl(s, &s);
     if ( *s == '/' )
@@ -167,12 +167,12 @@ static int __init _parse_loglvl(const char *s, int *lower, int *upper)
     return *s ? -EINVAL : 0;
 }
 
-static int __init parse_loglvl(const char *s)
+static int parse_loglvl(const char *s)
 {
     return _parse_loglvl(s, &xenlog_lower_thresh, &xenlog_upper_thresh);
 }
 
-static int __init parse_guest_loglvl(const char *s)
+static int parse_guest_loglvl(const char *s)
 {
     return _parse_loglvl(s, &xenlog_guest_lower_thresh,
                          &xenlog_guest_upper_thresh);
@@ -606,7 +606,7 @@ static int printk_prefix_check(char *p, char **pp)
             ((loglvl < upper_thresh) && printk_ratelimit()));
 } 
 
-static int __init parse_console_timestamps(const char *s)
+static int parse_console_timestamps(const char *s)
 {
     switch ( parse_bool(s, NULL) )
     {
-- 
2.12.3


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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v5 01/15] xen/arch/x86/psr.c: let custom parameter parsing routines return errno
  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
  0 siblings, 0 replies; 17+ messages in thread
From: Jan Beulich @ 2017-08-28  8:40 UTC (permalink / raw)
  To: Juergen Gross; +Cc: Andrew Cooper, xen-devel

>>> On 28.08.17 at 09:34, <jgross@suse.com> wrote:
> Modify the custom parameter parsing routines in:
> 
> xen/arch/x86/psr.c
> 
> to indicate whether the parameter value was parsed successfully.
> 
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>

Acked-by: Jan Beulich <jbeulich@suse.com>



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

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2017-08-28  8:40 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v5 10/15] xen: add basic support for runtime parameter changing Juergen Gross
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.