diff mbox series

x86/mm: fix dump_pagetables with Xen PV

Message ID 20200221103851.7855-1-jgross@suse.com (mailing list archive)
State Accepted
Commit bba42affa732d6fd5bd5c9678e6deacde2de1547
Headers show
Series x86/mm: fix dump_pagetables with Xen PV | expand

Commit Message

Jürgen Groß Feb. 21, 2020, 10:38 a.m. UTC
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")
Reported-by: Julien Grall <julien@xen.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/mm/dump_pagetables.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Julien Grall Feb. 21, 2020, 10:51 a.m. UTC | #1
Hi Juergen,

On 21/02/2020 10:38, Juergen Gross wrote:
> 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")
> Reported-by: Julien Grall <julien@xen.org>
> Signed-off-by: Juergen Gross <jgross@suse.com>

I can confirm the crash has now disappeared:

Tested-by: Julien Grall <julien@xen.org>

Cheers,
Jürgen Groß Feb. 28, 2020, 3:30 p.m. UTC | #2
Friendly ping...

On 21.02.20 11:38, Juergen Gross wrote:
> 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")
> Reported-by: Julien Grall <julien@xen.org>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>   arch/x86/mm/dump_pagetables.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
> index 64229dad7eab..69309cd56fdf 100644
> --- a/arch/x86/mm/dump_pagetables.c
> +++ b/arch/x86/mm/dump_pagetables.c
> @@ -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
>
diff mbox series

Patch

diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index 64229dad7eab..69309cd56fdf 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -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