Back port 2 revert commits

In 2.0.4, Cliff from HP posted 2 patches:
e35aa29 kexec: include reserved e820 sections in crash kernel
4932034 kexec: lengthen the kernel command line image

However, with both of them kdump kernel may fail to boot, and
are useless because of restriction in kernel side. In upstream,
they have been reverted. Now back port these 2 revert commits.
Also since the commit 1a4e90b has dependency, back port commit
dc607e4 which is depended on by commit 1a4e90b too.

1a4e90b Revert "kexec: include reserved e820 sections in crash kernel"
dc607e4 kexec: i386: Add cmdline_add_memmap_internal() to reduce the code duplication
8274916 Revert: "kexec: lengthen the kernel command line image"
This commit is contained in:
Baoquan He 2013-09-27 16:33:18 +08:00
parent 7c48f71b6f
commit 377b01b270
4 changed files with 294 additions and 0 deletions

View File

@ -0,0 +1,102 @@
From 1a4e90ba221684e563bf1baf06f3547cd95e60b0 Mon Sep 17 00:00:00 2001
Message-Id: <1a4e90ba221684e563bf1baf06f3547cd95e60b0.1380267809.git.bhe@redhat.com>
From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Date: Sun, 31 Mar 2013 11:12:53 +0800
Subject: [PATCH] Revert "kexec: include reserved e820 sections in crash
kernel"
This reverts commit e35aa29fb40b37bf86d980b2e19af5e01c2d2549.
This patch is based on the commit 49320340f705694e387d794f7f19d407ad9baefa
"kexec: lengthen the kernel command line image"
Since the latter commit has been reverted due to its useless, this
patch should be reverted too.
Besides, This patch also changed a kernel restriction of max segments
from 16 to 70. Though kexec-tools could have more segments, more than 16,
the kexec_load syscall will still fail for the kernel side has a restriction
of 16.
Cc: Cliff Wickman <cpw@sgi.com>
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
kexec/arch/i386/crashdump-x86.c | 31 ++-----------------------------
kexec/kexec-syscall.h | 2 +-
2 files changed, 3 insertions(+), 30 deletions(-)
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 4167e5e..e44fceb 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -247,8 +247,6 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
type = RANGE_ACPI;
} else if(memcmp(str,"ACPI Non-volatile Storage\n",26) == 0 ) {
type = RANGE_ACPI_NVS;
- } else if(memcmp(str,"reserved\n", 9) == 0 ) {
- type = RANGE_RESERVED;
} else if (memcmp(str, "GART\n", 5) == 0) {
gart_start = start;
gart_end = end;
@@ -908,27 +906,6 @@ static void get_backup_area(struct kexec_info *info,
info->backup_src_size = BACKUP_SRC_END - BACKUP_SRC_START + 1;
}
-/* Appends memmap=X$Y commandline for reserved memory to command line*/
-static int cmdline_add_memmap_reserved(char *cmdline, unsigned long start,
- unsigned long end)
-{
- int align = 1024;
- unsigned long startk, endk;
-
- if (!(end - start))
- return 0;
-
- startk = start/1024;
- endk = (end + align - 1)/1024;
- cmdline_add_memmap_internal(cmdline, startk, endk, RANGE_RESERVED);
-
-#ifdef DEBUG
- printf("Command line after adding reserved memmap\n");
- printf("%s\n", cmdline);
-#endif
- return 0;
-}
-
/* Loads additional segments in case of a panic kernel is being loaded.
* One segment for backup region, another segment for storing elf headers
* for crash memory image.
@@ -1076,15 +1053,11 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
for (i = 0; i < CRASH_MAX_MEMORY_RANGES; i++) {
unsigned long start, end;
if ( !( mem_range[i].type == RANGE_ACPI
- || mem_range[i].type == RANGE_ACPI_NVS
- || mem_range[i].type == RANGE_RESERVED) )
+ || mem_range[i].type == RANGE_ACPI_NVS) )
continue;
start = mem_range[i].start;
end = mem_range[i].end;
- if (mem_range[i].type == RANGE_RESERVED)
- cmdline_add_memmap_reserved(mod_cmdline, start, end);
- else
- cmdline_add_memmap_acpi(mod_cmdline, start, end);
+ cmdline_add_memmap_acpi(mod_cmdline, start, end);
}
return 0;
}
diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
index f5ee992..b56cb00 100644
--- a/kexec/kexec-syscall.h
+++ b/kexec/kexec-syscall.h
@@ -78,7 +78,7 @@ static inline long kexec_load(void *entry, unsigned long nr_segments,
#define KEXEC_ARCH_MIPS ( 8 << 16)
#define KEXEC_ARCH_CRIS (76 << 16)
-#define KEXEC_MAX_SEGMENTS 70
+#define KEXEC_MAX_SEGMENTS 16
#ifdef __i386__
#define KEXEC_ARCH_NATIVE KEXEC_ARCH_386
--
1.8.3.1

View File

@ -0,0 +1,35 @@
From 827491661670e3d7f8edf08cce2ed0f423d710eb Mon Sep 17 00:00:00 2001
Message-Id: <827491661670e3d7f8edf08cce2ed0f423d710eb.1380270065.git.bhe@redhat.com>
From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Date: Wed, 27 Mar 2013 20:42:28 +0800
Subject: [PATCH] Revert: "kexec: lengthen the kernel command line image"
This reverts commit 49320340f705694e387d794f7f19d407ad9baefa. The change
of COMMAND_LINE_SIZE cannot solve Cliff's problem since the kernel side
has the restriction, so it is useless. Let's recover the original value
defined by kernel side.
Cc: Cliff Wickman <cpw@sgi.com>
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
include/x86/x86-linux.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
index 6681f9e..0949dc2 100644
--- a/include/x86/x86-linux.h
+++ b/include/x86/x86-linux.h
@@ -197,7 +197,7 @@ struct x86_linux_param_header {
uint8_t _pad8[48]; /* 0xcd0 */
struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */
/* 0xeec */
-#define COMMAND_LINE_SIZE (64*1024)
+#define COMMAND_LINE_SIZE 2048
};
struct x86_linux_faked_param_header {
--
1.8.3.1

View File

@ -0,0 +1,150 @@
From dc607e4d43308140b4cee6c4503ee71f32b827ad Mon Sep 17 00:00:00 2001
Message-Id: <dc607e4d43308140b4cee6c4503ee71f32b827ad.1380269355.git.bhe@redhat.com>
From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Date: Thu, 28 Mar 2013 21:09:59 +0800
Subject: [PATCH] kexec: i386: Add cmdline_add_memmap_internal() to reduce the
code duplication
Functions:
- cmdline_add_memmap()
- cmdline_add_memmap_acpi()
- cmdline_add_memmap_reserved()
is kind of similar, So add a new function cmdline_add_memmap_internal() to
hold the common codes, reducing the duplication.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
kexec/arch/i386/crashdump-x86.c | 74 ++++++++++++++++++-----------------------
1 file changed, 33 insertions(+), 41 deletions(-)
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 5462f8b..9ab648b 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -685,13 +685,40 @@ static void ultoa(unsigned long i, char *str)
}
}
+static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk,
+ unsigned long endk, int type)
+{
+ int cmdlen, len;
+ char str_mmap[256], str_tmp[20];
+
+ strcpy (str_mmap, " memmap=");
+ ultoa((endk-startk), str_tmp);
+ strcat (str_mmap, str_tmp);
+
+ if (type == RANGE_RAM)
+ strcat (str_mmap, "K@");
+ else if (type == RANGE_RESERVED)
+ strcat (str_mmap, "K$");
+ else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
+ strcat (str_mmap, "K#");
+
+ ultoa(startk, str_tmp);
+ strcat (str_mmap, str_tmp);
+ strcat (str_mmap, "K");
+ len = strlen(str_mmap);
+ cmdlen = strlen(cmdline) + len;
+ if (cmdlen > (COMMAND_LINE_SIZE - 1))
+ die("Command line overflow\n");
+ strcat(cmdline, str_mmap);
+}
+
/* Adds the appropriate memmap= options to command line, indicating the
* memory regions the new kernel can use to boot into. */
static int cmdline_add_memmap(char *cmdline, struct memory_range *memmap_p)
{
int i, cmdlen, len;
unsigned long min_sizek = 100;
- char str_mmap[256], str_tmp[20];
+ char str_mmap[256];
/* Exact map */
strcpy(str_mmap, " memmap=exactmap");
@@ -713,18 +740,7 @@ static int cmdline_add_memmap(char *cmdline, struct memory_range *memmap_p)
* up precious command line length. */
if ((endk - startk) < min_sizek)
continue;
- strcpy (str_mmap, " memmap=");
- ultoa((endk-startk), str_tmp);
- strcat (str_mmap, str_tmp);
- strcat (str_mmap, "K@");
- ultoa(startk, str_tmp);
- strcat (str_mmap, str_tmp);
- strcat (str_mmap, "K");
- len = strlen(str_mmap);
- cmdlen = strlen(cmdline) + len;
- if (cmdlen > (COMMAND_LINE_SIZE - 1))
- die("Command line overflow\n");
- strcat(cmdline, str_mmap);
+ cmdline_add_memmap_internal(cmdline, startk, endk, RANGE_RAM);
}
dbgprintf("Command line after adding memmap\n");
@@ -817,27 +833,15 @@ static enum coretype get_core_type(struct crash_elf_info *elf_info,
static int cmdline_add_memmap_acpi(char *cmdline, unsigned long start,
unsigned long end)
{
- int cmdlen, len, align = 1024;
+ int align = 1024;
unsigned long startk, endk;
- char str_mmap[256], str_tmp[20];
if (!(end - start))
return 0;
startk = start/1024;
endk = (end + align - 1)/1024;
- strcpy (str_mmap, " memmap=");
- ultoa((endk - startk), str_tmp);
- strcat (str_mmap, str_tmp);
- strcat (str_mmap, "K#");
- ultoa(startk, str_tmp);
- strcat (str_mmap, str_tmp);
- strcat (str_mmap, "K");
- len = strlen(str_mmap);
- cmdlen = strlen(cmdline) + len;
- if (cmdlen > (COMMAND_LINE_SIZE - 1))
- die("Command line overflow\n");
- strcat(cmdline, str_mmap);
+ cmdline_add_memmap_internal(cmdline, startk, endk, RANGE_ACPI);
dbgprintf("Command line after adding acpi memmap\n");
dbgprintf("%s\n", cmdline);
@@ -907,27 +911,15 @@ static void get_backup_area(struct kexec_info *info,
static int cmdline_add_memmap_reserved(char *cmdline, unsigned long start,
unsigned long end)
{
- int cmdlen, len, align = 1024;
+ int align = 1024;
unsigned long startk, endk;
- char str_mmap[256], str_tmp[20];
if (!(end - start))
return 0;
startk = start/1024;
endk = (end + align - 1)/1024;
- strcpy (str_mmap, " memmap=");
- ultoa((endk - startk), str_tmp);
- strcat (str_mmap, str_tmp);
- strcat (str_mmap, "K$");
- ultoa(startk, str_tmp);
- strcat (str_mmap, str_tmp);
- strcat (str_mmap, "K");
- len = strlen(str_mmap);
- cmdlen = strlen(cmdline) + len;
- if (cmdlen > (COMMAND_LINE_SIZE - 1))
- die("Command line overflow\n");
- strcat(cmdline, str_mmap);
+ cmdline_add_memmap_internal(cmdline, startk, endk, RANGE_RESERVED);
#ifdef DEBUG
printf("Command line after adding reserved memmap\n");
--
1.8.3.1

View File

@ -52,6 +52,9 @@ Obsoletes: diskdumputils netdump
# #
# Patches 0 through 100 are meant for x86 kexec-tools enablement # Patches 0 through 100 are meant for x86 kexec-tools enablement
# #
Patch001: kexec-tools-2.0.4-Revert-kexec-lengthen-the-kernel-command-line-image.patch
Patch002: kexec-tools-2.0.4-kexec-i386-Add-cmdline_add_memmap_internal-to-reduce.patch
Patch003: kexec-tools-2.0.4-Revert-kexec-include-reserved-e820-sections-in-crash.patch
# #
# Patches 101 through 200 are meant for x86_64 kexec-tools enablement # Patches 101 through 200 are meant for x86_64 kexec-tools enablement
@ -111,6 +114,10 @@ tar -z -x -v -f %{SOURCE19}
%patch601 -p1 %patch601 -p1
%patch604 -p1 %patch604 -p1
%patch605 -p1 %patch605 -p1
%patch001 -p1
%patch002 -p1
%patch003 -p1
tar -z -x -v -f %{SOURCE13} tar -z -x -v -f %{SOURCE13}