Skip to contentSkip to conversation

makedumpfile: s390x: Add 2GB frame support for page table walker

PATCH In review Michael Holzheu 2 participants 4 messages Oct 19, 2012 – Oct 23, 2012

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

PATCH 1/1 makedumpfile: s390x: Add 2GB frame support for page table walker

On s390 the zEC12 machines support 2GB frames. In order to walk page tables correctly add support to the page table walker function so it detects 2GB frames.

---
 arch/s390x.c   |    6 ++++++
 makedumpfile.h |    1 +
 2 files changed, 7 insertions(+)
arch/s390x.c +6 -0
@@ -247,6 +247,11 @@ vtop_s390x(unsigned long vaddr)
 			return NOT_PADDR;
 		}
 		table = entry & _REGION_ENTRY_ORIGIN;
+		if ((entry & _REGION_ENTRY_LARGE) && (level == 1)) {
+			table &= ~0x7fffffffUL;
+			paddr = table + (vaddr & 0x7ffffffUL);
+			return paddr;
+		}
 		len = RSG_TABLE_LENGTH(entry);
 		level--;
 	}
@@ -257,6 +262,7 @@ vtop_s390x(unsigned long vaddr)
 	 * if no, then get the page table entry using PX index.
 	 */
 	if (entry & _SEGMENT_ENTRY_LARGE) {
+		table &= ~_PAGE_BYTE_INDEX_MASK;
 		paddr = table + (vaddr &  _PAGE_BYTE_INDEX_MASK);
 	} else {
 		entry = _kl_pg_table_deref_s390x(vaddr,
makedumpfile.h +1 -0
@@ -563,6 +563,7 @@ do { \
 #define _REGION_ENTRY_TYPE_MASK	0x0c	/* region table type mask */
 #define _REGION_ENTRY_INVALID	0x20	/* invalid region table entry */
 #define _REGION_ENTRY_LENGTH	0x03	/* region table length */
+#define _REGION_ENTRY_LARGE	0x400
 #define _REGION_OFFSET_MASK	0x7ffUL	/* region/segment table offset mask */
 
 #define RSG_TABLE_LEVEL(x)	(((x) & _REGION_ENTRY_TYPE_MASK) >> 2)

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

#1 lore raw

Hello Michael,

Quoted 6 lines · On Fri, 19 Oct 2012 18:29:12 +0200 Michael Holzheu…

On s390 the zEC12 machines support 2GB frames. In order to walk page tables correctly add support to the page table walker function so it detects 2GB frames.

Thank you for your work. I have a question.

Quoted 8 lines
---
 arch/s390x.c   |    6 ++++++
 makedumpfile.h |    1 +
 2 files changed, 7 insertions(+)

arch/s390x.c vtop_s390x(unsigned long vaddr) · line 252

Quoted 6 lines
arch/s390x.c +3 -0
@@ -247,6 +247,11 @@ vtop_s390x(unsigned long vaddr)
 			return NOT_PADDR;
 		}
 		table = entry & _REGION_ENTRY_ORIGIN;
+		if ((entry & _REGION_ENTRY_LARGE) && (level == 1)) {
+			table &= ~0x7fffffffUL;
+			paddr = table + (vaddr & 0x7ffffffUL);
                                                 ^^^^^^^^^^^

There is 0x7ffffff(27bit) but the patch for crash uses 0x7fffffff(31bit). Which is correct ?

Thanks
Atsushi Kumagai

Quoted 25 lines
arch/s390x.c +3 -0
+			return paddr;
+		}
 		len = RSG_TABLE_LENGTH(entry);
 		level--;
 	}
@@ -257,6 +262,7 @@ vtop_s390x(unsigned long vaddr)
 	 * if no, then get the page table entry using PX index.
 	 */
 	if (entry & _SEGMENT_ENTRY_LARGE) {
+		table &= ~_PAGE_BYTE_INDEX_MASK;
 		paddr = table + (vaddr &  _PAGE_BYTE_INDEX_MASK);
 	} else {
 		entry = _kl_pg_table_deref_s390x(vaddr,
makedumpfile.h +1 -0
@@ -563,6 +563,7 @@ do { \
 #define _REGION_ENTRY_TYPE_MASK	0x0c	/* region table type mask */
 #define _REGION_ENTRY_INVALID	0x20	/* invalid region table entry */
 #define _REGION_ENTRY_LENGTH	0x03	/* region table length */
+#define _REGION_ENTRY_LARGE	0x400
 #define _REGION_OFFSET_MASK	0x7ffUL	/* region/segment table offset mask */
 
 #define RSG_TABLE_LEVEL(x)	(((x) & _REGION_ENTRY_TYPE_MASK) >> 2)
Quoted 4 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

#2 lore raw

Hello Atsushi,

Quoted 4 lines · On Mon, 22 Oct 2012 16:20:56 +0900 Atsushi Kumagai…

Hello Michael,

On Fri, 19 Oct 2012 18:29:12 +0200
Michael Holzheu <[email protected]> wrote:

[snip]

Quoted 11 lines

arch/s390x.c vtop_s390x(unsigned long vaddr) · line 253

Quoted 10 lines
arch/s390x.c +3 -0
@@ -247,6 +247,11 @@ vtop_s390x(unsigned long vaddr)
 			return NOT_PADDR;
 		}
 		table = entry & _REGION_ENTRY_ORIGIN;
+		if ((entry & _REGION_ENTRY_LARGE) && (level == 1))
 {
+			table &= ~0x7fffffffUL;
+			paddr = table + (vaddr & 0x7ffffffUL);
                                                 ^^^^^^^^^^^
Quoted 2 lines

There is 0x7ffffff(27bit) but the patch for crash uses 0x7fffffff(31bit). Which is correct ?

You are right! This is a typo in the makedumpfile patch. It should be 0x7fffffff (31 bit). Thanks for your careful review!

Here the corrected patch:

---
 arch/s390x.c   | 6 ++++++
 makedumpfile.h | 1 +
 2 files changed, 7 insertions(+)
arch/s390x.c +6 -0
index 02b9e63..5854f10 100644
@@ -247,6 +247,11 @@ vtop_s390x(unsigned long vaddr)
 			return NOT_PADDR;
 		}
 		table = entry & _REGION_ENTRY_ORIGIN;
+		if ((entry & _REGION_ENTRY_LARGE) && (level == 1)) {
+			table &= ~0x7fffffffUL;
+			paddr = table + (vaddr & 0x7fffffffUL);
+			return paddr;
+		}
 		len = RSG_TABLE_LENGTH(entry);
 		level--;
 	}
@@ -257,6 +262,7 @@ vtop_s390x(unsigned long vaddr)
 	 * if no, then get the page table entry using PX index.
 	 */
 	if (entry & _SEGMENT_ENTRY_LARGE) {
+		table &= ~_PAGE_BYTE_INDEX_MASK;
 		paddr = table + (vaddr &  _PAGE_BYTE_INDEX_MASK);
 	} else {
 		entry = _kl_pg_table_deref_s390x(vaddr,
makedumpfile.h +1 -0
index 2b88fa4..62bc5cc 100644
@@ -563,6 +563,7 @@ do { \
 #define _REGION_ENTRY_TYPE_MASK	0x0c	/* region table type mask */
 #define _REGION_ENTRY_INVALID	0x20	/* invalid region table entry */
 #define _REGION_ENTRY_LENGTH	0x03	/* region table length */
+#define _REGION_ENTRY_LARGE	0x400
 #define _REGION_OFFSET_MASK	0x7ffUL	/* region/segment table offset mask */
 
 #define RSG_TABLE_LEVEL(x)	(((x) & _REGION_ENTRY_TYPE_MASK) >> 2)

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

#3 lore raw

Hello Michael,

On Mon, 22 Oct 2012 11:21:14 +0200
Michael Holzheu <[email protected]> wrote:

[snip]

Quoted 14 lines
Quoted 11 lines

arch/s390x.c vtop_s390x(unsigned long vaddr) · line 253

Quoted 10 lines
arch/s390x.c +3 -0
@@ -247,6 +247,11 @@ vtop_s390x(unsigned long vaddr)
 			return NOT_PADDR;
 		}
 		table = entry & _REGION_ENTRY_ORIGIN;
+		if ((entry & _REGION_ENTRY_LARGE) && (level == 1))
 {
+			table &= ~0x7fffffffUL;
+			paddr = table + (vaddr & 0x7ffffffUL);
                                                 ^^^^^^^^^^^
Quoted 2 lines

There is 0x7ffffff(27bit) but the patch for crash uses 0x7fffffff(31bit). Which is correct ?

Quoted 4 lines

You are right! This is a typo in the makedumpfile patch. It should be 0x7fffffff (31 bit). Thanks for your careful review!

Here the corrected patch:

OK, I will merge it into v1.5.1.

Thanks
Atushi Kumagai

Quoted 35 lines
---
 arch/s390x.c   | 6 ++++++
 makedumpfile.h | 1 +
 2 files changed, 7 insertions(+)
arch/s390x.c +6 -0
index 02b9e63..5854f10 100644
@@ -247,6 +247,11 @@ vtop_s390x(unsigned long vaddr)
 			return NOT_PADDR;
 		}
 		table = entry & _REGION_ENTRY_ORIGIN;
+		if ((entry & _REGION_ENTRY_LARGE) && (level == 1)) {
+			table &= ~0x7fffffffUL;
+			paddr = table + (vaddr & 0x7fffffffUL);
+			return paddr;
+		}
 		len = RSG_TABLE_LENGTH(entry);
 		level--;
 	}
@@ -257,6 +262,7 @@ vtop_s390x(unsigned long vaddr)
 	 * if no, then get the page table entry using PX index.
 	 */
 	if (entry & _SEGMENT_ENTRY_LARGE) {
+		table &= ~_PAGE_BYTE_INDEX_MASK;
 		paddr = table + (vaddr &  _PAGE_BYTE_INDEX_MASK);
 	} else {
 		entry = _kl_pg_table_deref_s390x(vaddr,
makedumpfile.h +0 -0
index 2b88fa4..62bc5cc 100644

makedumpfile.h do { \ · line 569

Quoted 7 lines
makedumpfile.h +1 -0
@@ -563,6 +563,7 @@ do { \
 #define _REGION_ENTRY_TYPE_MASK	0x0c	/* region table type mask */
 #define _REGION_ENTRY_INVALID	0x20	/* invalid region table entry */
 #define _REGION_ENTRY_LENGTH	0x03	/* region table length */
+#define _REGION_ENTRY_LARGE	0x400
 #define _REGION_OFFSET_MASK	0x7ffUL	/* region/segment table offset mask */
 
 #define RSG_TABLE_LEVEL(x)	(((x) & _REGION_ENTRY_TYPE_MASK) >> 2)

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