Skip to contentSkip to conversation

kexec: Provide user friendly option for memory limit

PATCH In review Simon Crowe 2 participants 3 messages Apr 27, 2017 – Apr 28, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kexec: Provide user friendly option for memory limit

grub2 requires that the '<' character be escaped which is inconvienet for users, provide a more natural specifier.

---
 docs/misc/kexec_and_kdump.txt       |  8 +++++++-
 docs/misc/xen-command-line.markdown |  5 +++++
 xen/common/kexec.c                  | 12 ++++++++++--
 3 files changed, 22 insertions(+), 3 deletions(-)
docs/misc/kexec_and_kdump.txt +7 -1
index 2f93771..0842b3d 100644
@@ -136,7 +136,13 @@ command line parameter to the Xen hypervisor. It has two forms:
 
       e.g. crashkernel=128M@256M
 
-   Regardless of which of the two forms of the crashkernel command line you
+  iii) crashkernel=size,below=offset
+
+      This allows us to place the crash kernel within the usuable address
+      space without having to worry about a specific phyiscal address.
+      The '<' and 'below' options are  synonymous
+
+   Regardless of which of the forms of the crashkernel command line you
    use, the crash kernel region should appear in /proc/iomem on x86. If it
    doesn't then either the crashkernel parameter is missing, or for some
    reason the region couldn't be placed - for instance because it is too large.
docs/misc/xen-command-line.markdown +5 -0
index 450b222..59e51dc 100644
@@ -474,6 +474,7 @@ combination with the `low_crashinfo` command line option.
 ### crashkernel
 > `= <ramsize-range>:<size>[,...][{@,<}<offset>]`
 > `= <size>[{@,<}<offset>]`
+> `= <size>,below=offset`
 
 Specify sizes and optionally placement of the crash kernel reservation
 area.  The `<ramsize-range>:<size>` pairs indicate how much memory to
@@ -485,6 +486,10 @@ A trailing `@<offset>` specifies the exact address this area should be
 placed at, whereas `<` in place of `@` just specifies an upper bound of
 the address range the area should fall into.
 
+< and below are synonyomous, the latter being useful for grub2 systems
+which would otherwise require escaping of the < option
+
+
 ### credit2\_balance\_over
 > `= <integer>`
 
xen/common/kexec.c +10 -2
index fbca8a6..3381070 100644
@@ -88,7 +88,7 @@ static void *crash_heap_current = NULL, *crash_heap_end = NULL;
 /*
  * Parse command lines in the format
  *
- *   crashkernel=<ramsize-range>:<size>[,...][{@,<}<address>]
+ *   crashkernel=<ramsize-range>:<size>[,...][{@,<,below=}<address>]
  *
  * with <ramsize-range> being of form
  *
@@ -97,6 +97,10 @@ static void *crash_heap_current = NULL, *crash_heap_end = NULL;
  * as well as the legacy ones in the format
  *
  *   crashkernel=<size>[{@,<}<address>]
+ *   crashkernel=<size>,below=address
+ *
+ * < and below are synonyomous, the latter being useful for grub2 systems
+ * which would otherwise require escaping of the < option
  */
 static void __init parse_crashkernel(const char *str)
 {
@@ -111,7 +115,7 @@ static void __init parse_crashkernel(const char *str)
             {
                 printk(XENLOG_WARNING "crashkernel: too many ranges\n");
                 cur = NULL;
-                str = strpbrk(str, "@<");
+                str = strpbrk(str, "@,<");
                 break;
             }
 
@@ -162,6 +166,10 @@ static void __init parse_crashkernel(const char *str)
             kexec_crash_area.start = parse_size_and_unit(cur = str + 1, &str);
         else if ( *str == '<' )
             kexec_crash_area_limit = parse_size_and_unit(cur = str + 1, &str);
+        else if ( !strncmp(str, ",below=", 7) )
+        {
+            kexec_crash_area_limit = parse_size_and_unit(cur = str + 7, &str);
+        }
         else
             printk(XENLOG_WARNING "crashkernel: '%s' ignored\n", str);
     }

--
2.7.4

?

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

Reviewed-by on v1 1/1
#1 lore raw

xen/common/kexec.c static void __init parse_crashkernel(const char *str) · line 174

Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 27.04.17 at 14:22, <[email protected]> wrote:
xen/common/kexec.c +4 -0
@@ -162,6 +166,10 @@ static void __init parse_crashkernel(const char *str)
             kexec_crash_area.start = parse_size_and_unit(cur = str + 1, &str);
         else if ( *str == '<' )
             kexec_crash_area_limit = parse_size_and_unit(cur = str + 1, &str);
+        else if ( !strncmp(str, ",below=", 7) )
+        {
+            kexec_crash_area_limit = parse_size_and_unit(cur = str + 7, &str);
+        }
         else
             printk(XENLOG_WARNING "crashkernel: '%s' ignored\n", str);

The braces you add are inconsistent with surrounding code. With them dropped

You should also have Cc-ed the maintainer of the code.

Jan

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

#2 lore raw

Jan

Ok i will make the change and resubmit

Thanks again

Regards

xen/common/kexec.c static void __init parse_crashkernel(const char *str) · line 174

Quoted 11 lines · On Fri, Apr 28, 2017 at 11:37 AM +0100, "Jan Beulich"…
Quoted 1 line
Quoted 1 line · On 27.04.17 at 14:22, wrote:
xen/common/kexec.c +4 -0
@@ -162,6 +166,10 @@ static void __init parse_crashkernel(const char *str)
             kexec_crash_area.start = parse_size_and_unit(cur = str + 1, &str);
         else if ( *str == '<' )
             kexec_crash_area_limit = parse_size_and_unit(cur = str + 1, &str);
+        else if ( !strncmp(str, ",below=", 7) )
+        {
+            kexec_crash_area_limit = parse_size_and_unit(cur = str + 7, &str);
+        }
         else
             printk(XENLOG_WARNING "crashkernel: '%s' ignored\n", str);

The braces you add are inconsistent with surrounding code. With them dropped
Reviewed-by: Jan Beulich

You should also have Cc-ed the maintainer of the code.

Jan

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