[PATCH v7 7/9] x86, cleanup: kexec memory range .end to be inclusive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Later kexec and kdump memory range will be mapped to E820entry. But
currently kexec memory range .end field is exclusive while crash memory
range is inclusive.

Given the fact that the exported proc iomem and sysfs memmap are both
inclusive, change kexec memory range .end to be inclusive. Later the
unified memory range of both kexec and kdump can use the same E820
filling code.

Signed-off-by: WANG Chao <chaowang at redhat.com>
Acked-by: Dave Young <dyoung at redhat.com>
Tested-by: Linn Crosetto <linn at hp.com>
---
 kexec/arch/i386/kexec-x86-common.c | 3 +--
 kexec/arch/i386/x86-linux-setup.c  | 2 +-
 kexec/firmware_memmap.c            | 1 -
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c
index e416177..bc622e9 100644
--- a/kexec/arch/i386/kexec-x86-common.c
+++ b/kexec/arch/i386/kexec-x86-common.c
@@ -79,7 +79,6 @@ static int get_memory_ranges_proc_iomem(struct memory_range **range, int *ranges
 		if (count != 2)
 			continue;
 		str = line + consumed;
-		end = end + 1;
 
 		dbgprintf("%016Lx-%016Lx : %s", start, end, str);
 
@@ -188,7 +187,7 @@ static int get_memory_ranges_xen(struct memory_range **range, int *ranges)
 
 	for (i = 0; i < rc; ++i) {
 		memory_range[i].start = e820entries[i].addr;
-		memory_range[i].end = e820entries[i].addr + e820entries[i].size;
+		memory_range[i].end = e820entries[i].addr + e820entries[i].size - 1;
 		memory_range[i].type = xen_e820_to_kexec_type(e820entries[i].type);
 	}
 
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index 8ed36cc..9f8355f 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -784,7 +784,7 @@ void setup_linux_system_parameters(struct kexec_info *info,
 	real_mode->e820_map_nr = ranges;
 	for(i = 0; i < ranges; i++) {
 		real_mode->e820_map[i].addr = range[i].start;
-		real_mode->e820_map[i].size = range[i].end - range[i].start;
+		real_mode->e820_map[i].size = range[i].end - range[i].start + 1;
 		switch (range[i].type) {
 		case RANGE_RAM:
 			real_mode->e820_map[i].type = E820_RAM; 
diff --git a/kexec/firmware_memmap.c b/kexec/firmware_memmap.c
index 9598933..6be3c7c 100644
--- a/kexec/firmware_memmap.c
+++ b/kexec/firmware_memmap.c
@@ -145,7 +145,6 @@ static int parse_memmap_entry(const char *entry, struct memory_range *range)
 	range->end = parse_numeric_sysfs(filename);
 	if (range->end == ULLONG_MAX)
 		return -1;
-	range->end++; /* inclusive vs. exclusive ranges */
 
 	/*
 	 * entry/type
-- 
1.9.0




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux