linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Steve Capper <Steve.Capper@arm.com>
To: Qian Cai <cai@lca.pw>
Cc: Catalin Marinas <Catalin.Marinas@arm.com>, nd <nd@arm.com>,
	Will Deacon <Will.Deacon@arm.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: kernel_page_tables issue with CONFIG_ARM64_USER_VA_BITS_52=y
Date: Mon, 4 Feb 2019 10:27:24 +0000	[thread overview]
Message-ID: <20190204102715.GA11645@capper-debian.cambridge.arm.com> (raw)
In-Reply-To: <1549054142.6911.25.camel@lca.pw>

On Fri, Feb 01, 2019 at 03:49:02PM -0500, Qian Cai wrote:
> On Fri, 2019-02-01 at 13:48 +0000, Will Deacon wrote:
> > Hi Qian Cai,

[...]

> Unfortunately, although this takes care of kernel_page_tables, it breaks
> efi_page_tables.
> 
> # cat /sys/kernel/debug/efi_page_tables
> BUG()
> 
> # ./scripts/faddr2line vmlinux walk_pgd+0x84/0x254
> walk_pgd+0x84/0x254:
> __read_once_size at include/linux/compiler.h:193 (discriminator 1)
> (inlined by) walk_pgd at arch/arm64/mm/dump.c:345 (discriminator 1)
> 
> 344:        do {
> 345:                pgd_t pgd = READ_ONCE(*pgdp);
> 346:                next = pgd_addr_end(addr, 0);
> 
> kernel BUG at arch/arm64/mm/dump.c:332!
> 
>                 } else {
>                         BUG_ON(pud_bad(pud));
>                         walk_pmd(st, pudp, addr, next);
>

Hi Qian Cai,
Apologies for missing the efi_page_tables.

Does the following (applied to Will's fix) help?

Cheers,
-- 
Steve

--->8

diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c
index 00ca2adeb5ef..42ac8fd15e59 100644
--- a/arch/arm64/mm/dump.c
+++ b/arch/arm64/mm/dump.c
@@ -339,11 +339,12 @@ static void walk_pgd(struct pg_state *st, struct mm_struct *mm,
 		     unsigned long start)
 {
 	unsigned long next, addr = start;
+	unsigned long end = (start < TASK_SIZE_64) ? TASK_SIZE_64 : 0;
 	pgd_t *pgdp = pgd_offset(mm, addr);
 
 	do {
 		pgd_t pgd = READ_ONCE(*pgdp);
-		next = pgd_addr_end(addr, 0);
+		next = pgd_addr_end(addr, end);
 
 		if (pgd_none(pgd)) {
 			note_page(st, addr, 1, pgd_val(pgd));
@@ -351,7 +352,7 @@ static void walk_pgd(struct pg_state *st, struct mm_struct *mm,
 			BUG_ON(pgd_bad(pgd));
 			walk_pud(st, pgdp, addr, next);
 		}
-	} while (pgdp++, addr = next, addr);
+	} while (pgdp++, addr = next, addr != end);
 }
 
 void ptdump_walk_pgd(struct seq_file *m, struct ptdump_info *info)
diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c
index 23ea1ed409d1..16757966c3bf 100644
--- a/drivers/firmware/efi/arm-runtime.c
+++ b/drivers/firmware/efi/arm-runtime.c
@@ -38,7 +38,8 @@ static struct ptdump_info efi_ptdump_info = {
 	.mm		= &efi_mm,
 	.markers	= (struct addr_marker[]){
 		{ 0,		"UEFI runtime start" },
-		{ DEFAULT_MAP_WINDOW_64, "UEFI runtime end" }
+		{ DEFAULT_MAP_WINDOW_64, "UEFI runtime end" },
+		{ -1, NULL }
 	},
 	.base_addr	= 0,
 };

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-02-04 10:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-01  4:01 kernel_page_tables issue with CONFIG_ARM64_USER_VA_BITS_52=y Qian Cai
2019-02-01 13:48 ` Will Deacon
2019-02-01 18:53   ` Steve Capper
2019-02-01 20:49   ` Qian Cai
2019-02-04 10:27     ` Steve Capper [this message]
2019-02-04 13:51       ` Ard Biesheuvel
2019-02-04 13:57       ` Qian Cai
2019-02-04 14:15         ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190204102715.GA11645@capper-debian.cambridge.arm.com \
    --to=steve.capper@arm.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=Will.Deacon@arm.com \
    --cc=cai@lca.pw \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=nd@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).