Skip to contentSkip to conversation

book3s/ppc64: Lower the max real address to 53 bits for kernels >= v4.11

PATCH Superseded Bhupesh Sharma 4 participants 6 messages Sep 8, 2017 – Sep 12, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 book3s/ppc64: Lower the max real address to 53 bits for kernels >= v4.11

Kernel commit 2f18d533757da3899f4bedab0b2c051b080079dc lowered the max real address on ppc64 to 53 bits.

Make similar changes in makedumpfile (on basis of the underlying kernel version), without which the makedumpfile will fail to create a dumpfile and instead throw a SEGV fault as shown below on kernels >= v4.11:

 # makedumpfile --split -d 31 -x vmlinux vmcore dumpfile_{1,2,3} 2>&1

The kernel version is not supported.
The makedumpfile operation may be incomplete.

 [ 1196.252094] makedumpfile[2367]: unhandled signal 11 at
 00000100f7011ca8 nip 000000001001eecc lr 000000001001f3c0 code 30001
 Segmentation fault
---
 makedumpfile.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
makedumpfile.h +3 -2
index 7d81bbcf2234..142753d84e8d 100644
@@ -684,8 +684,9 @@ unsigned long get_kvbase_arm64(void);
 #define PMD_MASKED_BITS_64K_4_6  0xc0000000000000ffUL
 
 #define PTE_RPN_MASK_DEFAULT  0xffffffffffffffffUL
-#define PTE_RPN_SIZE_L4_4_6   (info->page_size == 65536 ? 41 : 45)
-#define PTE_RPN_MASK_L4_4_6   (((1UL << PTE_RPN_SIZE_L4_4_6) - 1) << info->page_shift)
+#define PAGE_PA_MAX_L4_4_6    (info->kernel_version >= KERNEL_VERSION(4,11,0) ? 53 : 57)
+#define PTE_RPN_MASK_L4_4_6   \
+	(((1UL << PAGE_PA_MAX_L4_4_6) - 1) & ~((1UL << info->page_shift) - 1))
 #define PTE_RPN_SHIFT_L4_4_6  info->page_shift
 
 #define PGD_MASKED_BITS_4_7  0xc0000000000000ffUL
Signature · 7 lines
2.7.4


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

Hello Bhupesh,

Quoted 25 lines

Kernel commit 2f18d533757da3899f4bedab0b2c051b080079dc lowered the max real address on ppc64 to 53 bits.

Make similar changes in makedumpfile (on basis of the underlying kernel version), without which the makedumpfile will fail to create a dumpfile and instead throw a SEGV fault as shown below on kernels >= v4.11:

# makedumpfile --split -d 31 -x vmlinux vmcore dumpfile_{1,2,3} 2>&1

The kernel version is not supported.
The makedumpfile operation may be incomplete.

[ 1196.252094] makedumpfile[2367]: unhandled signal 11 at

00000100f7011ca8 nip 000000001001eecc lr 000000001001f3c0 code 30001 Segmentation fault

---
makedumpfile.h | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
makedumpfile.h +0 -0
index 7d81bbcf2234..142753d84e8d 100644

makedumpfile.h unsigned long get_kvbase_arm64(void); · line 689

Quoted 8 lines
makedumpfile.h +3 -2
@@ -684,8 +684,9 @@ unsigned long get_kvbase_arm64(void);
 #define PMD_MASKED_BITS_64K_4_6  0xc0000000000000ffUL
 
 #define PTE_RPN_MASK_DEFAULT  0xffffffffffffffffUL
-#define PTE_RPN_SIZE_L4_4_6   (info->page_size == 65536 ? 41 : 45)
-#define PTE_RPN_MASK_L4_4_6   (((1UL << PTE_RPN_SIZE_L4_4_6) - 1) << info->page_shift)
+#define PAGE_PA_MAX_L4_4_6    (info->kernel_version >= KERNEL_VERSION(4,11,0) ? 53 : 57)
+#define PTE_RPN_MASK_L4_4_6   \
+	(((1UL << PAGE_PA_MAX_L4_4_6) - 1) & ~((1UL << info->page_shift) - 1))

This fix is a bit complicated, please introduce *_L4_4_11 simply.

Thanks
Atsushi Kumagai

Quoted 6 lines
makedumpfile.h +0 -1
 #define PTE_RPN_SHIFT_L4_4_6  info->page_shift
 
 #define PGD_MASKED_BITS_4_7  0xc0000000000000ffUL
--

2.7.4

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

#2 lore raw

Hello Atsushi,

Quoted 29 lines · Atsushi Kumagai

Hello Bhupesh,

Quoted 27 lines

Kernel commit 2f18d533757da3899f4bedab0b2c051b080079dc lowered the max real address on ppc64 to 53 bits.

Make similar changes in makedumpfile (on basis of the underlying kernel version), without which the makedumpfile will fail to create a dumpfile and instead throw a SEGV fault as shown below on kernels >= v4.11:

# makedumpfile --split -d 31 -x vmlinux vmcore dumpfile_{1,2,3} 2>&1

The kernel version is not supported.
The makedumpfile operation may be incomplete.

[ 1196.252094] makedumpfile[2367]: unhandled signal 11 at

00000100f7011ca8 nip 000000001001eecc lr 000000001001f3c0 code 30001 Segmentation fault

---
makedumpfile.h | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
makedumpfile.h +0 -0
index 7d81bbcf2234..142753d84e8d 100644
@@ -684,8 +684,9 @@ unsigned long get_kvbase_arm64(void);
 #define PMD_MASKED_BITS_64K_4_6  0xc0000000000000ffUL
 
Quoted 8 lines

makedumpfile.h unsigned long get_kvbase_arm64(void); · line 689

Quoted 6 lines
makedumpfile.h +3 -2
 #define PTE_RPN_MASK_DEFAULT  0xffffffffffffffffUL
-#define PTE_RPN_SIZE_L4_4_6   (info->page_size == 65536 ? 41 : 45)
-#define PTE_RPN_MASK_L4_4_6   (((1UL << PTE_RPN_SIZE_L4_4_6) - 1) << info->page_shift)
+#define PAGE_PA_MAX_L4_4_6    (info->kernel_version >= KERNEL_VERSION(4,11,0) ? 53 : 57)
+#define PTE_RPN_MASK_L4_4_6   \
+      (((1UL << PAGE_PA_MAX_L4_4_6) - 1) & ~((1UL << info->page_shift) - 1))

This fix is a bit complicated, please introduce *_L4_4_11 simply.

Thanks for the review. I understood your point.
I will send a v2 shortly which should address your inputs.

Regards,
Bhupesh

Quoted 8 lines
Quoted 7 lines
makedumpfile.h +0 -1
 #define PTE_RPN_SHIFT_L4_4_6  info->page_shift
 
 #define PGD_MASKED_BITS_4_7  0xc0000000000000ffUL
--

2.7.4

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

#3 lore raw
In reply to Bhupesh Sharma

Cc more people.

Quoted 39 lines · Bhupesh Sharma

Kernel commit 2f18d533757da3899f4bedab0b2c051b080079dc lowered the max real address on ppc64 to 53 bits.

Make similar changes in makedumpfile (on basis of the underlying kernel version), without which the makedumpfile will fail to create a dumpfile and instead throw a SEGV fault as shown below on kernels >= v4.11:

 # makedumpfile --split -d 31 -x vmlinux vmcore dumpfile_{1,2,3} 2>&1

The kernel version is not supported.
The makedumpfile operation may be incomplete.

 [ 1196.252094] makedumpfile[2367]: unhandled signal 11 at
 00000100f7011ca8 nip 000000001001eecc lr 000000001001f3c0 code 30001
 Segmentation fault
---
 makedumpfile.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
makedumpfile.h +3 -2
index 7d81bbcf2234..142753d84e8d 100644
@@ -684,8 +684,9 @@ unsigned long get_kvbase_arm64(void);
 #define PMD_MASKED_BITS_64K_4_6  0xc0000000000000ffUL
 
 #define PTE_RPN_MASK_DEFAULT  0xffffffffffffffffUL
-#define PTE_RPN_SIZE_L4_4_6   (info->page_size == 65536 ? 41 : 45)
-#define PTE_RPN_MASK_L4_4_6   (((1UL << PTE_RPN_SIZE_L4_4_6) - 1) << info->page_shift)
+#define PAGE_PA_MAX_L4_4_6    (info->kernel_version >= KERNEL_VERSION(4,11,0) ? 53 : 57)
+#define PTE_RPN_MASK_L4_4_6   \
+	(((1UL << PAGE_PA_MAX_L4_4_6) - 1) & ~((1UL << info->page_shift) - 1))
 #define PTE_RPN_SHIFT_L4_4_6  info->page_shift
 
 #define PGD_MASKED_BITS_4_7  0xc0000000000000ffUL
Signature · 1 line
2.7.4

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

Acked-by
#4 lore raw
Quoted 17 lines · Dave Young

Cc more people.

Quoted 14 lines · Bhupesh Sharma

Kernel commit 2f18d533757da3899f4bedab0b2c051b080079dc lowered the max real address on ppc64 to 53 bits.

Make similar changes in makedumpfile (on basis of the underlying kernel version), without which the makedumpfile will fail to create a dumpfile and instead throw a SEGV fault as shown below on kernels >= v4.11:

  # makedumpfile --split -d 31 -x vmlinux vmcore dumpfile_{1,2,3} 2>&1

The kernel version is not supported.
The makedumpfile operation may be incomplete.

  [ 1196.252094] makedumpfile[2367]: unhandled signal 11 at
  00000100f7011ca8 nip 000000001001eecc lr 000000001001f3c0 code 30001
  Segmentation fault

I have not hit the above problem, but for the sake of correctness, this patch is needed for >= 4.11.0 kernels. So..

Quoted 20 lines
Quoted 20 lines
---
  makedumpfile.h | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
makedumpfile.h +3 -2
index 7d81bbcf2234..142753d84e8d 100644
@@ -684,8 +684,9 @@ unsigned long get_kvbase_arm64(void);
  #define PMD_MASKED_BITS_64K_4_6  0xc0000000000000ffUL
 
  #define PTE_RPN_MASK_DEFAULT  0xffffffffffffffffUL
-#define PTE_RPN_SIZE_L4_4_6   (info->page_size == 65536 ? 41 : 45)
-#define PTE_RPN_MASK_L4_4_6   (((1UL << PTE_RPN_SIZE_L4_4_6) - 1) << info->page_shift)
+#define PAGE_PA_MAX_L4_4_6    (info->kernel_version >= KERNEL_VERSION(4,11,0) ? 53 : 57)
+#define PTE_RPN_MASK_L4_4_6   \
+	(((1UL << PAGE_PA_MAX_L4_4_6) - 1) & ~((1UL << info->page_shift) - 1))
  #define PTE_RPN_SHIFT_L4_4_6  info->page_shift
 
Quoted 4 lines
Quoted 4 lines
makedumpfile.h +0 -0
  #define PGD_MASKED_BITS_4_7  0xc0000000000000ffUL
Signature · 1 line
2.7.4

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

#5 lore raw

Hi Hari,

Quoted 23 lines · Hari Bathini
Quoted 19 lines · Dave Young

Cc more people.

Quoted 15 lines · Bhupesh Sharma

Kernel commit 2f18d533757da3899f4bedab0b2c051b080079dc lowered the max real address on ppc64 to 53 bits.

Make similar changes in makedumpfile (on basis of the underlying kernel version), without which the makedumpfile will fail to create a dumpfile and instead throw a SEGV fault as shown below on kernels >= v4.11:

  # makedumpfile --split -d 31 -x vmlinux vmcore dumpfile_{1,2,3} 2>&1

The kernel version is not supported.
The makedumpfile operation may be incomplete.

  [ 1196.252094] makedumpfile[2367]: unhandled signal 11 at
  00000100f7011ca8 nip 000000001001eecc lr 000000001001f3c0 code 30001
  Segmentation fault
Quoted 4 lines

I have not hit the above problem, but for the sake of correctness, this patch is needed for >= 4.11.0 kernels. So..

Thanks for the review. As Atsushi suggested some changes in v1, I am sharing a v2 version shortly.

Kindly review the same as well.

Regards,
Bhupesh

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
---
  makedumpfile.h | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
makedumpfile.h +1 -2
index 7d81bbcf2234..142753d84e8d 100644
@@ -684,8 +684,9 @@ unsigned long get_kvbase_arm64(void);
  #define PMD_MASKED_BITS_64K_4_6  0xc0000000000000ffUL
    #define PTE_RPN_MASK_DEFAULT  0xffffffffffffffffUL
-#define PTE_RPN_SIZE_L4_4_6   (info->page_size == 65536 ? 41 : 45)
-#define PTE_RPN_MASK_L4_4_6   (((1UL << PTE_RPN_SIZE_L4_4_6) - 1) <<
 info->page_shift)
+#define PAGE_PA_MAX_L4_4_6    (info->kernel_version >=
 KERNEL_VERSION(4,11,0) ? 53 : 57)
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
makedumpfile.h +2 -2
+#define PTE_RPN_MASK_L4_4_6   \
+       (((1UL << PAGE_PA_MAX_L4_4_6) - 1) & ~((1UL << info->page_shift)
- 1))
  #define PTE_RPN_SHIFT_L4_4_6  info->page_shift
    #define PGD_MASKED_BITS_4_7  0xc0000000000000ffUL
--

2.7.4

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