Skip to contentSkip to conversation

kdump: fix an error that can not parse the e820 reserved region

PATCH In review Lianbo Jiang 3 participants 5 messages Sep 6, 2018 – Oct 8, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kdump: fix an error that can not parse the e820 reserved region

When kexec-tools load the kernel and initramfs for kdump, kexec-tools will read /proc/iomem and recreate the e820 ranges for kdump kernel. But it fails to parse the e820 reserved region, because the memcmp() is case sensitive when comparing the string. In fact, it may be "Reserved" or "reserved" in the /proc/iomem, so we have to fix these cases.

---
 kexec/arch/i386/crashdump-x86.c | 2 ++
 1 file changed, 2 insertions(+)
kexec/arch/i386/crashdump-x86.c +2 -0
index 437e8a8..140f45b 100644
@@ -289,6 +289,8 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
 			type = RANGE_PMEM;
 		} else if(memcmp(str,"reserved\n",9) == 0 ) {
 			type = RANGE_RESERVED;
+		} 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;
Signature · 7 lines
2.17.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Reviewed-by on v2 1/1
#1 lore raw
Quoted 32 lines · Lianbo Jiang

When kexec-tools load the kernel and initramfs for kdump, kexec-tools will read /proc/iomem and recreate the e820 ranges for kdump kernel. But it fails to parse the e820 reserved region, because the memcmp() is case sensitive when comparing the string. In fact, it may be "Reserved" or "reserved" in the /proc/iomem, so we have to fix these cases.

---
 kexec/arch/i386/crashdump-x86.c | 2 ++
 1 file changed, 2 insertions(+)
kexec/arch/i386/crashdump-x86.c +2 -0
index 437e8a8..140f45b 100644
@@ -289,6 +289,8 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
 			type = RANGE_PMEM;
 		} else if(memcmp(str,"reserved\n",9) == 0 ) {
 			type = RANGE_RESERVED;
+		} 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;
Signature · 7 lines
2.17.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Thanks
Dave

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw
Quoted 29 lines · Dave Young
Quoted 28 lines · Lianbo Jiang

When kexec-tools load the kernel and initramfs for kdump, kexec-tools will read /proc/iomem and recreate the e820 ranges for kdump kernel. But it fails to parse the e820 reserved region, because the memcmp() is case sensitive when comparing the string. In fact, it may be "Reserved" or "reserved" in the /proc/iomem, so we have to fix these cases.

---
 kexec/arch/i386/crashdump-x86.c | 2 ++
 1 file changed, 2 insertions(+)
kexec/arch/i386/crashdump-x86.c +2 -0
index 437e8a8..140f45b 100644
@@ -289,6 +289,8 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
 			type = RANGE_PMEM;
 		} else if(memcmp(str,"reserved\n",9) == 0 ) {
 			type = RANGE_RESERVED;
+		} 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;
Signature · 1 line
2.17.1
Quoted 6 lines
Quoted 4 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Sorry for letting this slip through the cracks.
I've applied this now.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw
Quoted 37 lines · Simon Horman
Quoted 29 lines · Dave Young
Quoted 28 lines · Lianbo Jiang

When kexec-tools load the kernel and initramfs for kdump, kexec-tools will read /proc/iomem and recreate the e820 ranges for kdump kernel. But it fails to parse the e820 reserved region, because the memcmp() is case sensitive when comparing the string. In fact, it may be "Reserved" or "reserved" in the /proc/iomem, so we have to fix these cases.

---
 kexec/arch/i386/crashdump-x86.c | 2 ++
 1 file changed, 2 insertions(+)
kexec/arch/i386/crashdump-x86.c +2 -0
index 437e8a8..140f45b 100644
@@ -289,6 +289,8 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
 			type = RANGE_PMEM;
 		} else if(memcmp(str,"reserved\n",9) == 0 ) {
 			type = RANGE_RESERVED;
+		} 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;
Signature · 1 line
2.17.1
Quoted 6 lines
Quoted 4 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Quoted 2 lines

Sorry for letting this slip through the cracks.
I've applied this now.

Simon, thank you!

Dave

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#4 lore raw
In reply to Simon Horman
Quoted 37 lines · Simon Horman
Quoted 29 lines · Dave Young
Quoted 28 lines · Lianbo Jiang

When kexec-tools load the kernel and initramfs for kdump, kexec-tools will read /proc/iomem and recreate the e820 ranges for kdump kernel. But it fails to parse the e820 reserved region, because the memcmp() is case sensitive when comparing the string. In fact, it may be "Reserved" or "reserved" in the /proc/iomem, so we have to fix these cases.

---
 kexec/arch/i386/crashdump-x86.c | 2 ++
 1 file changed, 2 insertions(+)
kexec/arch/i386/crashdump-x86.c +2 -0
index 437e8a8..140f45b 100644
@@ -289,6 +289,8 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
 			type = RANGE_PMEM;
 		} else if(memcmp(str,"reserved\n",9) == 0 ) {
 			type = RANGE_RESERVED;
+		} 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;
Signature · 1 line
2.17.1
Quoted 6 lines
Quoted 4 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Quoted 3 lines

Sorry for letting this slip through the cracks.
I've applied this now.

Thank you, Simon and Dave.

Quoted 5 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec