Skip to contentSkip to conversation

x86/mm: fix dump_pagetables with Xen PV

PATCH Applied Juergen Gross 3 participants 4 messages Feb 21, 2020 – Feb 29, 2020

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

PATCH 1/1 x86/mm: fix dump_pagetables with Xen PV

Commit 2ae27137b2db89 ("x86: mm: convert dump_pagetables to use walk_page_range") broke Xen PV guests as the hypervisor reserved hole in the memory map was not taken into account.

Fix that by starting the kernel range only at GUARD_HOLE_END_ADDR.

Fixes 2ae27137b2db89 ("x86: mm: convert dump_pagetables to use walk_page_range")
---
 arch/x86/mm/dump_pagetables.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
arch/x86/mm/dump_pagetables.c +1 -6
index 64229dad7eab..69309cd56fdf 100644
@@ -363,13 +363,8 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m,
 {
 	const struct ptdump_range ptdump_ranges[] = {
 #ifdef CONFIG_X86_64
-
-#define normalize_addr_shift (64 - (__VIRTUAL_MASK_SHIFT + 1))
-#define normalize_addr(u) ((signed long)((u) << normalize_addr_shift) >> \
-			   normalize_addr_shift)
-
 	{0, PTRS_PER_PGD * PGD_LEVEL_MULT / 2},
-	{normalize_addr(PTRS_PER_PGD * PGD_LEVEL_MULT / 2), ~0UL},
+	{GUARD_HOLE_END_ADDR, ~0UL},
 #else
 	{0, ~0UL},
 #endif
Signature · 1 line
2.16.4
Tested-by on v1 1/1
#1 lore raw

Hi Juergen,

Quoted 9 lines · Juergen Gross

Commit 2ae27137b2db89 ("x86: mm: convert dump_pagetables to use walk_page_range") broke Xen PV guests as the hypervisor reserved hole in the memory map was not taken into account.

Fix that by starting the kernel range only at GUARD_HOLE_END_ADDR.

Fixes 2ae27137b2db89 ("x86: mm: convert dump_pagetables to use walk_page_range")

I can confirm the crash has now disappeared:

Cheers,

Signature · 1 line
Julien Grall
#2 lore raw
In reply to Juergen Gross

Friendly ping...

Quoted 33 lines · Juergen Gross

Commit 2ae27137b2db89 ("x86: mm: convert dump_pagetables to use walk_page_range") broke Xen PV guests as the hypervisor reserved hole in the memory map was not taken into account.

Fix that by starting the kernel range only at GUARD_HOLE_END_ADDR.

Fixes 2ae27137b2db89 ("x86: mm: convert dump_pagetables to use walk_page_range")
---
  arch/x86/mm/dump_pagetables.c | 7 +------
  1 file changed, 1 insertion(+), 6 deletions(-)
arch/x86/mm/dump_pagetables.c +1 -6
index 64229dad7eab..69309cd56fdf 100644
@@ -363,13 +363,8 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m,
  {
  	const struct ptdump_range ptdump_ranges[] = {
  #ifdef CONFIG_X86_64
-
-#define normalize_addr_shift (64 - (__VIRTUAL_MASK_SHIFT + 1))
-#define normalize_addr(u) ((signed long)((u) << normalize_addr_shift) >> \
-			   normalize_addr_shift)
-
  	{0, PTRS_PER_PGD * PGD_LEVEL_MULT / 2},
-	{normalize_addr(PTRS_PER_PGD * PGD_LEVEL_MULT / 2), ~0UL},
+	{GUARD_HOLE_END_ADDR, ~0UL},
  #else
  	{0, ~0UL},
  #endif
merge bot Applied
#3 lore raw

[tip: x86/urgent] x86/mm: Fix dump_pagetables with Xen PV

In reply to Juergen Gross
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     bba42affa732d6fd5bd5c9678e6deacde2de1547
Gitweb:        https://git.kernel.org/tip/bba42affa732d6fd5bd5c9678e6deacde2de1547
Author:        Juergen Gross <[email protected]>
AuthorDate:    Fri, 21 Feb 2020 11:38:51 +01:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Sat, 29 Feb 2020 12:43:10 +01:00

x86/mm: Fix dump_pagetables with Xen PV

Commit 2ae27137b2db89 ("x86: mm: convert dump_pagetables to use walk_page_range") broke Xen PV guests as the hypervisor reserved hole in the memory map was not taken into account.

Fix that by starting the kernel range only at GUARD_HOLE_END_ADDR.

Fixes 2ae27137b2db89 ("x86: mm: convert dump_pagetables to use walk_page_range")
---
 arch/x86/mm/dump_pagetables.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
arch/x86/mm/dump_pagetables.c +1 -6
index 64229da..69309cd 100644
@@ -363,13 +363,8 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m,
 {
 	const struct ptdump_range ptdump_ranges[] = {
 #ifdef CONFIG_X86_64
-
-#define normalize_addr_shift (64 - (__VIRTUAL_MASK_SHIFT + 1))
-#define normalize_addr(u) ((signed long)((u) << normalize_addr_shift) >> \
-			   normalize_addr_shift)
-
 	{0, PTRS_PER_PGD * PGD_LEVEL_MULT / 2},
-	{normalize_addr(PTRS_PER_PGD * PGD_LEVEL_MULT / 2), ~0UL},
+	{GUARD_HOLE_END_ADDR, ~0UL},
 #else
 	{0, ~0UL},
 #endif