From: Catalin Marinas <catalin.marinas@arm.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will@kernel.org>, James Morse <james.morse@arm.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm64: mm: avoid virt_to_phys(init_mm.pgd)
Date: Thu, 3 Oct 2019 16:40:02 +0100 [thread overview]
Message-ID: <20191003154002.GH21629@arrakis.emea.arm.com> (raw)
In-Reply-To: <20191003094932.10216-1-mark.rutland@arm.com>
On Thu, Oct 03, 2019 at 10:49:32AM +0100, Mark Rutland wrote:
> If we take an unhandled fault in the kernel, we call show_pte() to dump
> the {PGDP,PGD,PUD,PMD,PTE} values for the corresponding page table walk,
> where the PGDP value is virt_to_phys(mm->pgd).
>
> The boot-time and runtime kernel page tables, init_pg_dir and
> swapper_pg_dir respectively, are kernel symbols. Thus, it is not valid
> to call virt_to_phys() on either of these, though we'll do so if we take
> a fault on a TTBR1 address.
>
> When CONFIG_DEBUG_VIRTUAL is not selected, virt_to_phys() will silently
> fix this up. However, when CONFIG_DEBUG_VIRTUAL is selected, this
> results in splats as below. Depending on when these occur, they can
> happen to suppress information needed to debug the original unhandled
> fault, such as the backtrace:
>
> | Unable to handle kernel paging request at virtual address ffff7fffec73cf0f
> | Mem abort info:
> | ESR = 0x96000004
> | EC = 0x25: DABT (current EL), IL = 32 bits
> | SET = 0, FnV = 0
> | EA = 0, S1PTW = 0
> | Data abort info:
> | ISV = 0, ISS = 0x00000004
> | CM = 0, WnR = 0
> | ------------[ cut here ]------------
> | virt_to_phys used for non-linear address: 00000000102c9dbe (swapper_pg_dir+0x0/0x1000)
> | WARNING: CPU: 1 PID: 7558 at arch/arm64/mm/physaddr.c:15 __virt_to_phys+0xe0/0x170 arch/arm64/mm/physaddr.c:12
> | Kernel panic - not syncing: panic_on_warn set ...
> | SMP: stopping secondary CPUs
> | Dumping ftrace buffer:
> | (ftrace buffer empty)
> | Kernel Offset: disabled
> | CPU features: 0x0002,23000438
> | Memory Limit: none
> | Rebooting in 1 seconds..
>
> We can avoid this by ensuring that we call __pa_symbol() for
> init_mm.pgd, as this will always be a kernel symbol. As the dumped
> {PGD,PUD,PMD,PTE} values are the raw values from the relevant entries we
> don't need to handle these specially.
>
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: James Morse <james.morse@arm.com>
> Cc: Will Deacon <will@kernel.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2019-10-03 15:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-03 9:49 [PATCH] arm64: mm: avoid virt_to_phys(init_mm.pgd) Mark Rutland
2019-10-03 15:40 ` Catalin Marinas [this message]
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=20191003154002.GH21629@arrakis.emea.arm.com \
--to=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=will@kernel.org \
/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).