Skip to contentSkip to conversation

Add persistent memory support

PATCH In review Baoquan He 5 participants 12 messages Aug 19, 2015 – Sep 23, 2015

Subsystems (2)
lore
Share & tools
lore

Baoquan He

author
#0 lore raw

PATCH v3 1/1 Add persistent memory support

Kernel add E820_PRAM or E820_PMEM type for NVDIMM memory device. Now support them in kexec too.

---
 include/x86/x86-linux.h            |  2 ++
 kexec/arch/i386/crashdump-x86.c    | 15 ++++++++++++---
 kexec/arch/i386/kexec-x86-common.c | 10 ++++++++++
 kexec/arch/i386/x86-linux-setup.c  |  6 ++++++
 kexec/firmware_memmap.c            |  4 ++++
 kexec/kexec.h                      |  2 ++
 6 files changed, 36 insertions(+), 3 deletions(-)
include/x86/x86-linux.h +2 -0
index 50c7324..7834751 100644
@@ -21,6 +21,8 @@ struct e820entry {
 #define E820_RESERVED	2
 #define E820_ACPI	3 /* usable as RAM once ACPI tables have been read */
 #define E820_NVS	4
+#define E820_PMEM       7
+#define E820_PRAM       12
 } __attribute__((packed));
 #endif
 
kexec/arch/i386/crashdump-x86.c +12 -3
index 82bf239..598a78f 100644
@@ -301,6 +301,10 @@ 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,"Persistent Memory (legacy)\n",27) == 0 ) {
+			type = RANGE_PRAM;
+		} else if(memcmp(str,"Persistent Memory\n",18) == 0 ) {
+			type = RANGE_PMEM;
 		} else if(memcmp(str,"reserved\n",9) == 0 ) {
 			type = RANGE_RESERVED;
 		} else if (memcmp(str, "GART\n", 5) == 0) {
@@ -640,6 +644,8 @@ static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk,
 		strcat (str_mmap, "K$");
 	else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
 		strcat (str_mmap, "K#");
+	else if (type == RANGE_PRAM)
+		strcat (str_mmap, "K!");
 
 	ultoa(startk, str_tmp);
 	strcat (str_mmap, str_tmp);
@@ -674,10 +680,11 @@ static int cmdline_add_memmap(char *cmdline, struct memory_range *memmap_p)
 		endk = (memmap_p[i].end + 1)/1024;
 		type = memmap_p[i].type;
 
-		/* Only adding memory regions of RAM and ACPI */
+		/* Only adding memory regions of RAM and ACPI and Persistent Mem */
 		if (type != RANGE_RAM &&
 		    type != RANGE_ACPI &&
-		    type != RANGE_ACPI_NVS)
+		    type != RANGE_ACPI_NVS &&
+		    type != RANGE_PRAM)
 			continue;
 
 		if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
@@ -997,7 +1004,9 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
 		unsigned long start, end, size, type;
 		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_RESERVED
+			|| mem_range[i].type == RANGE_PMEM
+			|| mem_range[i].type == RANGE_PRAM))
 			continue;
 		start = mem_range[i].start;
 		end = mem_range[i].end;
kexec/arch/i386/kexec-x86-common.c +10 -0
index 3624192..28e5fc8 100644
@@ -94,6 +94,12 @@ static int get_memory_ranges_proc_iomem(struct memory_range **range, int *ranges
 		else if (memcmp(str, "ACPI Non-volatile Storage\n", 26) == 0) {
 			type = RANGE_ACPI_NVS;
 		}
+		else if (memcmp(str, "Persistent Memory (legacy)\n", 27) == 0) {
+			type = RANGE_PRAM;
+		}
+		else if (memcmp(str, "Persistent Memory\n", 18) == 0) {
+			type = RANGE_PMEM;
+		}
 		else {
 			continue;
 		}
@@ -149,6 +155,10 @@ unsigned xen_e820_to_kexec_type(uint32_t type)
 			return RANGE_ACPI;
 		case E820_NVS:
 			return RANGE_ACPI_NVS;
+		case E820_PMEM:
+			return RANGE_PMEM;
+		case E820_PRAM:
+			return RANGE_PRAM;
 		case E820_RESERVED:
 		default:
 			return RANGE_RESERVED;
kexec/arch/i386/x86-linux-setup.c +6 -0
index 9271c6c..c75adaa 100644
@@ -705,6 +705,12 @@ static void add_e820_map_from_mr(struct x86_linux_param_header *real_mode,
 			case RANGE_ACPI_NVS:
 				e820[i].type = E820_NVS;
 				break;
+			case RANGE_PMEM:
+				e820[i].type = E820_PMEM;
+				break;
+			case RANGE_PRAM:
+				e820[i].type = E820_PRAM;
+				break;
 			default:
 			case RANGE_RESERVED:
 				e820[i].type = E820_RESERVED;
kexec/firmware_memmap.c +4 -0
index 6be3c7c..4d84f00 100644
@@ -168,6 +168,10 @@ static int parse_memmap_entry(const char *entry, struct memory_range *range)
 		range->type = RANGE_ACPI_NVS;
 	else if (strcmp(type, "Uncached RAM") == 0)
 		range->type = RANGE_UNCACHED;
+	else if (strcmp(type, "Persistent Memory (legacy)") == 0)
+		range->type = RANGE_PRAM;
+	else if (strcmp(type, "Persistent Memory") == 0)
+		range->type = RANGE_PMEM;
 	else {
 		fprintf(stderr, "Unknown type (%s) while parsing %s. Please "
 			"report this as bug. Using RANGE_RESERVED now.\n",
kexec/kexec.h +2 -0
index b129c15..0fa977f 100644
@@ -136,6 +136,8 @@ struct memory_range {
 #define RANGE_ACPI	2
 #define RANGE_ACPI_NVS	3
 #define RANGE_UNCACHED	4
+#define RANGE_PMEM		6
+#define RANGE_PRAM		11
 };
 
 struct memory_ranges {
Signature · 7 lines
2.1.0


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

Hi,

Quoted 44 lines · Baoquan He

Kernel add E820_PRAM or E820_PMEM type for NVDIMM memory device. Now support them in kexec too.

---
 include/x86/x86-linux.h            |  2 ++
 kexec/arch/i386/crashdump-x86.c    | 15 ++++++++++++---
 kexec/arch/i386/kexec-x86-common.c | 10 ++++++++++
 kexec/arch/i386/x86-linux-setup.c  |  6 ++++++
 kexec/firmware_memmap.c            |  4 ++++
 kexec/kexec.h                      |  2 ++
 6 files changed, 36 insertions(+), 3 deletions(-)
include/x86/x86-linux.h +2 -0
index 50c7324..7834751 100644
@@ -21,6 +21,8 @@ struct e820entry {
 #define E820_RESERVED	2
 #define E820_ACPI	3 /* usable as RAM once ACPI tables have been read */
 #define E820_NVS	4
+#define E820_PMEM       7
+#define E820_PRAM       12
 } __attribute__((packed));
 #endif
 
kexec/arch/i386/crashdump-x86.c +4 -0
index 82bf239..598a78f 100644
@@ -301,6 +301,10 @@ 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,"Persistent Memory (legacy)\n",27) == 0 ) {
+			type = RANGE_PRAM;
+		} else if(memcmp(str,"Persistent Memory\n",18) == 0 ) {
+			type = RANGE_PMEM;
 		} else if(memcmp(str,"reserved\n",9) == 0 ) {
 			type = RANGE_RESERVED;
 		} else if (memcmp(str, "GART\n", 5) == 0) {

kexec/arch/i386/crashdump-x86.c static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk, · line 648

Quoted 5 lines
kexec/arch/i386/crashdump-x86.c +2 -0
@@ -640,6 +644,8 @@ static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk,
 		strcat (str_mmap, "K$");
 	else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
 		strcat (str_mmap, "K#");
+	else if (type == RANGE_PRAM)
+		strcat (str_mmap, "K!");

Since we have switched to use e820 it is not necessary to supporting new things in legacy memmap interface?

Quoted 111 lines
kexec/arch/i386/crashdump-x86.c +6 -3
 	ultoa(startk, str_tmp);
 	strcat (str_mmap, str_tmp);
@@ -674,10 +680,11 @@ static int cmdline_add_memmap(char *cmdline, struct memory_range *memmap_p)
 		endk = (memmap_p[i].end + 1)/1024;
 		type = memmap_p[i].type;
 
-		/* Only adding memory regions of RAM and ACPI */
+		/* Only adding memory regions of RAM and ACPI and Persistent Mem */
 		if (type != RANGE_RAM &&
 		    type != RANGE_ACPI &&
-		    type != RANGE_ACPI_NVS)
+		    type != RANGE_ACPI_NVS &&
+		    type != RANGE_PRAM)
 			continue;
 
 		if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
@@ -997,7 +1004,9 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
 		unsigned long start, end, size, type;
 		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_RESERVED
+			|| mem_range[i].type == RANGE_PMEM
+			|| mem_range[i].type == RANGE_PRAM))
 			continue;
 		start = mem_range[i].start;
 		end = mem_range[i].end;
kexec/arch/i386/kexec-x86-common.c +10 -0
index 3624192..28e5fc8 100644
@@ -94,6 +94,12 @@ static int get_memory_ranges_proc_iomem(struct memory_range **range, int *ranges
 		else if (memcmp(str, "ACPI Non-volatile Storage\n", 26) == 0) {
 			type = RANGE_ACPI_NVS;
 		}
+		else if (memcmp(str, "Persistent Memory (legacy)\n", 27) == 0) {
+			type = RANGE_PRAM;
+		}
+		else if (memcmp(str, "Persistent Memory\n", 18) == 0) {
+			type = RANGE_PMEM;
+		}
 		else {
 			continue;
 		}
@@ -149,6 +155,10 @@ unsigned xen_e820_to_kexec_type(uint32_t type)
 			return RANGE_ACPI;
 		case E820_NVS:
 			return RANGE_ACPI_NVS;
+		case E820_PMEM:
+			return RANGE_PMEM;
+		case E820_PRAM:
+			return RANGE_PRAM;
 		case E820_RESERVED:
 		default:
 			return RANGE_RESERVED;
kexec/arch/i386/x86-linux-setup.c +6 -0
index 9271c6c..c75adaa 100644
@@ -705,6 +705,12 @@ static void add_e820_map_from_mr(struct x86_linux_param_header *real_mode,
 			case RANGE_ACPI_NVS:
 				e820[i].type = E820_NVS;
 				break;
+			case RANGE_PMEM:
+				e820[i].type = E820_PMEM;
+				break;
+			case RANGE_PRAM:
+				e820[i].type = E820_PRAM;
+				break;
 			default:
 			case RANGE_RESERVED:
 				e820[i].type = E820_RESERVED;
kexec/firmware_memmap.c +4 -0
index 6be3c7c..4d84f00 100644
@@ -168,6 +168,10 @@ static int parse_memmap_entry(const char *entry, struct memory_range *range)
 		range->type = RANGE_ACPI_NVS;
 	else if (strcmp(type, "Uncached RAM") == 0)
 		range->type = RANGE_UNCACHED;
+	else if (strcmp(type, "Persistent Memory (legacy)") == 0)
+		range->type = RANGE_PRAM;
+	else if (strcmp(type, "Persistent Memory") == 0)
+		range->type = RANGE_PMEM;
 	else {
 		fprintf(stderr, "Unknown type (%s) while parsing %s. Please "
 			"report this as bug. Using RANGE_RESERVED now.\n",
kexec/kexec.h +2 -0
index b129c15..0fa977f 100644
@@ -136,6 +136,8 @@ struct memory_range {
 #define RANGE_ACPI	2
 #define RANGE_ACPI_NVS	3
 #define RANGE_UNCACHED	4
+#define RANGE_PMEM		6
+#define RANGE_PRAM		11
 };
 
 struct memory_ranges {
Signature · 7 lines
2.1.0


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

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

author
#2 lore raw
Quoted 20 lines · Dave Young

Hi,

Quoted 16 lines · Baoquan He
kexec/arch/i386/crashdump-x86.c +4 -0
index 82bf239..598a78f 100644
@@ -301,6 +301,10 @@ 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,"Persistent Memory (legacy)\n",27) == 0 ) {
+			type = RANGE_PRAM;
+		} else if(memcmp(str,"Persistent Memory\n",18) == 0 ) {
+			type = RANGE_PMEM;
 		} else if(memcmp(str,"reserved\n",9) == 0 ) {
 			type = RANGE_RESERVED;
 		} else if (memcmp(str, "GART\n", 5) == 0) {
@@ -640,6 +644,8 @@ static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk,
Quoted 8 lines

kexec/arch/i386/crashdump-x86.c static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk, · line 648

Quoted 5 lines
kexec/arch/i386/crashdump-x86.c +2 -0
 		strcat (str_mmap, "K$");
 	else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
 		strcat (str_mmap, "K#");
+	else if (type == RANGE_PRAM)
+		strcat (str_mmap, "K!");

Since we have switched to use e820 it is not necessary to supporting new things in legacy memmap interface?

Well, I am not sure about this. Kexec-tools provides memmap method to pass the memory ranges, then either we continue supporting it or we delete it. Now is this OK we just keep legacy memmap code there and ignore it? If people check the man page and find --pass-memmap-cmdline and intend to try, then kexec/kdump fail, then how do we go with it?

Thanks
Baoquan

Quoted 1 line

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

#3 lore raw
Quoted 30 lines · Baoquan He
Quoted 20 lines · Dave Young

Hi,

Quoted 16 lines · Baoquan He
kexec/arch/i386/crashdump-x86.c +4 -0
index 82bf239..598a78f 100644
@@ -301,6 +301,10 @@ 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,"Persistent Memory (legacy)\n",27) == 0 ) {
+			type = RANGE_PRAM;
+		} else if(memcmp(str,"Persistent Memory\n",18) == 0 ) {
+			type = RANGE_PMEM;
 		} else if(memcmp(str,"reserved\n",9) == 0 ) {
 			type = RANGE_RESERVED;
 		} else if (memcmp(str, "GART\n", 5) == 0) {
@@ -640,6 +644,8 @@ static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk,
Quoted 8 lines

kexec/arch/i386/crashdump-x86.c static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk, · line 648

Quoted 5 lines
kexec/arch/i386/crashdump-x86.c +2 -0
 		strcat (str_mmap, "K$");
 	else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
 		strcat (str_mmap, "K#");
+	else if (type == RANGE_PRAM)
+		strcat (str_mmap, "K!");

Since we have switched to use e820 it is not necessary to supporting new things in legacy memmap interface?

Quoted 5 lines

Well, I am not sure about this. Kexec-tools provides memmap method to pass the memory ranges, then either we continue supporting it or we delete it. Now is this OK we just keep legacy memmap code there and ignore it? If people check the man page and find --pass-memmap-cmdline and intend to try, then kexec/kdump fail, then how do we go with it?

It is a legacy interface, IMO we should deprecate it and remove it after a period like several release cycle.

Thanks
Dave

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

author
#4 lore raw
Quoted 31 lines · Dave Young
Quoted 30 lines · Baoquan He
Quoted 28 lines · Dave Young

Hi,

Quoted 16 lines · Baoquan He
kexec/arch/i386/crashdump-x86.c +4 -0
index 82bf239..598a78f 100644
@@ -301,6 +301,10 @@ 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,"Persistent Memory (legacy)\n",27) == 0 ) {
+			type = RANGE_PRAM;
+		} else if(memcmp(str,"Persistent Memory\n",18) == 0 ) {
+			type = RANGE_PMEM;
 		} else if(memcmp(str,"reserved\n",9) == 0 ) {
 			type = RANGE_RESERVED;
 		} else if (memcmp(str, "GART\n", 5) == 0) {

kexec/arch/i386/crashdump-x86.c static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk, · line 648

Quoted 5 lines
kexec/arch/i386/crashdump-x86.c +2 -0
@@ -640,6 +644,8 @@ static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk,
 		strcat (str_mmap, "K$");
 	else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
 		strcat (str_mmap, "K#");
+	else if (type == RANGE_PRAM)
+		strcat (str_mmap, "K!");

Since we have switched to use e820 it is not necessary to supporting new things in legacy memmap interface?

Quoted 8 lines
Quoted 5 lines

Well, I am not sure about this. Kexec-tools provides memmap method to pass the memory ranges, then either we continue supporting it or we delete it. Now is this OK we just keep legacy memmap code there and ignore it? If people check the man page and find --pass-memmap-cmdline and intend to try, then kexec/kdump fail, then how do we go with it?

It is a legacy interface, IMO we should deprecate it and remove it after a period like several release cycle.

So if customers still want to specify memmap there isn't a way.

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

#5 lore raw
Quoted 38 lines · Baoquan He
Quoted 37 lines · Dave Young
Quoted 35 lines · Baoquan He
Quoted 20 lines · Dave Young

Hi,

Quoted 16 lines · Baoquan He
kexec/arch/i386/crashdump-x86.c +4 -0
index 82bf239..598a78f 100644
@@ -301,6 +301,10 @@ 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,"Persistent Memory (legacy)\n",27) == 0 ) {
+			type = RANGE_PRAM;
+		} else if(memcmp(str,"Persistent Memory\n",18) == 0 ) {
+			type = RANGE_PMEM;
 		} else if(memcmp(str,"reserved\n",9) == 0 ) {
 			type = RANGE_RESERVED;
 		} else if (memcmp(str, "GART\n", 5) == 0) {
@@ -640,6 +644,8 @@ static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk,
Quoted 8 lines

kexec/arch/i386/crashdump-x86.c static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk, · line 648

Quoted 5 lines
kexec/arch/i386/crashdump-x86.c +2 -0
 		strcat (str_mmap, "K$");
 	else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
 		strcat (str_mmap, "K#");
+	else if (type == RANGE_PRAM)
+		strcat (str_mmap, "K!");

Since we have switched to use e820 it is not necessary to supporting new things in legacy memmap interface?

Well, I am not sure about this. Kexec-tools provides memmap method to pass the memory ranges, then either we continue supporting it or we delete it. Now is this OK we just keep legacy memmap code there and ignore it? If people check the man page and find --pass-memmap-cmdline and intend to try, then kexec/kdump fail, then how do we go with it?

Quoted 5 lines
Quoted 2 lines

It is a legacy interface, IMO we should deprecate it and remove it after a period like several release cycle.

So if customers still want to specify memmap there isn't a way.

Why do one use memmap with new kexec-tools?

There's no reason to use the old interface, I do not think there's any benefit since new interface works well and be more scalable.

Thanks
Dave

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

#6 lore raw
Quoted 49 lines · Dave Young
Quoted 48 lines · Baoquan He
Quoted 46 lines · Dave Young
Quoted 36 lines · Baoquan He
Quoted 26 lines · Dave Young

Hi,

Quoted 22 lines · Baoquan He
kexec/arch/i386/crashdump-x86.c +3 -0
index 82bf239..598a78f 100644
@@ -301,6 +301,10 @@ 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,"Persistent Memory 
 (legacy)\n",27) == 0 ) {
+			type = RANGE_PRAM;
+		} else if(memcmp(str,"Persistent Memory\n",18) 

== 0 ) {

kexec/arch/i386/crashdump-x86.c +1 -0
+			type = RANGE_PMEM;
 		} else if(memcmp(str,"reserved\n",9) == 0 ) {
 			type = RANGE_RESERVED;
 		} else if (memcmp(str, "GART\n", 5) == 0) {
@@ -640,6 +644,8 @@ static void cmdline_add_memmap_internal(char 
 *cmdline, unsigned long startk,
Quoted 8 lines

kexec/arch/i386/crashdump-x86.c static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk, · line 648

Quoted 5 lines
kexec/arch/i386/crashdump-x86.c +2 -0
 		strcat (str_mmap, "K$");
 	else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
 		strcat (str_mmap, "K#");
+	else if (type == RANGE_PRAM)
+		strcat (str_mmap, "K!");

Since we have switched to use e820 it is not necessary to supporting new things in legacy memmap interface?

Quoted 6 lines

Well, I am not sure about this. Kexec-tools provides memmap method to pass the memory ranges, then either we continue supporting it or we delete it. Now is this OK we just keep legacy memmap code there and ignore it? If people check the man page and find --pass-memmap -cmdline and intend to try, then kexec/kdump fail, then how do we go with it?

It is a legacy interface, IMO we should deprecate it and remove it after a period like several release cycle.

Quoted 7 lines
Quoted 2 lines

So if customers still want to specify memmap there isn't a way.

Why do one use memmap with new kexec-tools?

There's no reason to use the old interface, I do not think there's any benefit since new interface works well and be more scalable.

Unless --pass-memmap-cmdline has already been deprecated, I think it should keep up with the kernel update in the memmap cmd-line. IOW, if we do not keep it up, it should be marked as deprecated.

Thanks,
-Toshi

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

#7 lore raw
Quoted 53 lines · Toshi Kani
Quoted 52 lines · Dave Young
Quoted 50 lines · Baoquan He
Quoted 44 lines · Dave Young
Quoted 36 lines · Baoquan He
Quoted 26 lines · Dave Young

Hi,

Quoted 22 lines · Baoquan He
kexec/arch/i386/crashdump-x86.c +3 -0
index 82bf239..598a78f 100644
@@ -301,6 +301,10 @@ 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,"Persistent Memory 
 (legacy)\n",27) == 0 ) {
+			type = RANGE_PRAM;
+		} else if(memcmp(str,"Persistent Memory\n",18) 

== 0 ) {

kexec/arch/i386/crashdump-x86.c +1 -0
+			type = RANGE_PMEM;
 		} else if(memcmp(str,"reserved\n",9) == 0 ) {
 			type = RANGE_RESERVED;
 		} else if (memcmp(str, "GART\n", 5) == 0) {
@@ -640,6 +644,8 @@ static void cmdline_add_memmap_internal(char 
 *cmdline, unsigned long startk,
Quoted 8 lines

kexec/arch/i386/crashdump-x86.c static void cmdline_add_memmap_internal(char · line 649

Quoted 5 lines
kexec/arch/i386/crashdump-x86.c +2 -0
 		strcat (str_mmap, "K$");
 	else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
 		strcat (str_mmap, "K#");
+	else if (type == RANGE_PRAM)
+		strcat (str_mmap, "K!");

Since we have switched to use e820 it is not necessary to supporting new things in legacy memmap interface?

Quoted 6 lines

Well, I am not sure about this. Kexec-tools provides memmap method to pass the memory ranges, then either we continue supporting it or we delete it. Now is this OK we just keep legacy memmap code there and ignore it? If people check the man page and find --pass-memmap -cmdline and intend to try, then kexec/kdump fail, then how do we go with it?

Quoted 2 lines

It is a legacy interface, IMO we should deprecate it and remove it after a period like several release cycle.

So if customers still want to specify memmap there isn't a way.

Quoted 8 lines
Quoted 4 lines

Why do one use memmap with new kexec-tools?

There's no reason to use the old interface, I do not think there's any benefit since new interface works well and be more scalable.

Unless --pass-memmap-cmdline has already been deprecated, I think it should keep up with the kernel update in the memmap cmd-line. IOW, if we do not keep it up, it should be marked as deprecated.

Hmm, after looking into old discussion, I found that the options is there for the known issue for calgary iommu. I really doubt there's someone is using it but who knows.

calgary code uses saved_max_pfn which is only calculaed when there's memmap=exactmap cmdline params. So before removing the limitation we still need carry the old interface.

Hence, I will not object Bao's changes in his patch any more.

Thanks
Dave

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

#8 lore raw

On Tue, Aug 25, 2015 at 03:37:19PM +0800, Dave Young wrote:

[snip]

Quoted 9 lines

Hmm, after looking into old discussion, I found that the options is there for the known issue for calgary iommu. I really doubt there's someone is using it but who knows.

calgary code uses saved_max_pfn which is only calculaed when there's memmap=exactmap cmdline params. So before removing the limitation we still need carry the old interface.

Hence, I will not object Bao's changes in his patch any more.

Thanks, on the strength of that comment I have applied this patch.

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

#9 lore raw
Quoted 8 lines · On Wed, 2 Sep 2015 10:04:10 +0900 Simon Horman <[email protected]> wrote:

On Tue, Aug 25, 2015 at 03:37:19PM +0800, Dave Young wrote:

[snip]

Quoted 4 lines

Hmm, after looking into old discussion, I found that the options is there for the known issue for calgary iommu. I really doubt there's someone is using it but who knows.

Quoted 7 lines
Quoted 5 lines

calgary code uses saved_max_pfn which is only calculaed when there's memmap=exactmap cmdline params. So before removing the limitation we still need carry the old interface.

Hence, I will not object Bao's changes in his patch any more.

Thanks, on the strength of that comment I have applied this patch.

Argh. After adding this patch, kexec-tools no longer builds --with-xen:

gcc -g -O2 -fno-strict-aliasing -Wall -Wstrict-prototypes -I./include -I./util_lib/include -Iinclude/ -I./kexec/arch/x86_64/include -c -MD -o kexec/arch/i386/kexec-x86-common.o kexec/arch/i386/kexec-x86-common.c kexec/arch/i386/kexec-x86-common.c: In function ‘xen_e820_to_kexec_type’:
kexec/arch/i386/kexec-x86-common.c:158:8: error: ‘E820_PMEM’ undeclared (first use in this function)
case E820_PMEM:

        ^
kexec/arch/i386/kexec-x86-common.c:158:8: note: each undeclared identifier is reported only once for each function it appears in
kexec/arch/i386/kexec-x86-common.c:160:8: error: ‘E820_PRAM’ undeclared (first use in this function)
   case E820_PRAM:
        ^

Makefile:113: návod pro cíl „kexec/arch/i386/kexec-x86-common.o“ selhal
make: *** [kexec/arch/i386/kexec-x86-common.o] Chyba 1

This happens, because other E820_* macros are defined in /usr/include/xenctrl.h, but not E820_PMEM and E820_PRAM.

I'm unsure how to fix it.

Petr T

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

author
#10 lore raw
Quoted 11 lines · Petr Tesarik

Argh. After adding this patch, kexec-tools no longer builds --with-xen:

gcc -g -O2 -fno-strict-aliasing -Wall -Wstrict-prototypes -I./include -I./util_lib/include -Iinclude/ -I./kexec/arch/x86_64/include -c -MD -o kexec/arch/i386/kexec-x86-common.o kexec/arch/i386/kexec-x86-common.c kexec/arch/i386/kexec-x86-common.c: In function ‘xen_e820_to_kexec_type’:
kexec/arch/i386/kexec-x86-common.c:158:8: error: ‘E820_PMEM’ undeclared (first use in this function)
case E820_PMEM:

        ^
kexec/arch/i386/kexec-x86-common.c:158:8: note: each undeclared identifier is reported only once for each function it appears in
kexec/arch/i386/kexec-x86-common.c:160:8: error: ‘E820_PRAM’ undeclared (first use in this function)
   case E820_PRAM:
        ^
Quoted 5 lines

Makefile:113: návod pro cíl „kexec/arch/i386/kexec-x86-common.o“ selhal
make: *** [kexec/arch/i386/kexec-x86-common.o] Chyba 1

This happens, because other E820_* macros are defined in /usr/include/xenctrl.h, but not E820_PMEM and E820_PRAM.

I defined E820_PMEM and E820_PRAM as kernel does. Maybe 2 ways:
1) Change them in /usr/include/xenctrl.h
2) Add 2 adapter function to adjust them when they come into and go out of kexec.

Quoted 4 lines

I'm unsure how to fix it.

Petr T

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

author
#11 lore raw
In reply to Petr Tesarik
Quoted 11 lines · Petr Tesarik

kexec/arch/i386/kexec-x86-common.c:158:8: note: each undeclared identifier is reported only once for each function it appears in kexec/arch/i386/kexec-x86-common.c:160:8: error: ‘E820_PRAM’ undeclared (first use in this function)
case E820_PRAM:

        ^

Makefile:113: návod pro cíl „kexec/arch/i386/kexec-x86-common.o“ selhal
make: *** [kexec/arch/i386/kexec-x86-common.o] Chyba 1

This happens, because other E820_* macros are defined in /usr/include/xenctrl.h, but not E820_PMEM and E820_PRAM.

I'm unsure how to fix it.

Or if xen doesn't support these 2 memory types, I can revert below change for xen:

@@ -149,6 +155,10 @@ unsigned xen_e820_to_kexec_type(uint32_t type)

                        return RANGE_ACPI;
                case E820_NVS:
                        return RANGE_ACPI_NVS;
+               case E820_PMEM:
+                       return RANGE_PMEM;
+               case E820_PRAM:
+                       return RANGE_PRAM;
                case E820_RESERVED:
                default:
                        return RANGE_RESERVED;

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