From: Will Deacon <will@kernel.org>
To: Zhen Lei <thunder.leizhen@huawei.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, James Morse <james.morse@arm.com>
Subject: Re: [PATCH v2] arm64: add the printing of tpidr_elx in __show_regs()
Date: Thu, 28 Apr 2022 11:21:56 +0100 [thread overview]
Message-ID: <20220428102156.GA14123@willie-the-truck> (raw)
In-Reply-To: <20220316062408.1113-1-thunder.leizhen@huawei.com>
On Wed, Mar 16, 2022 at 02:24:08PM +0800, Zhen Lei wrote:
> Commit 7158627686f0 ("arm64: percpu: implement optimised pcpu access
> using tpidr_el1") and commit 6d99b68933fb ("arm64: alternatives: use
> tpidr_el2 on VHE hosts") use tpidr_elx to cache my_cpu_offset to optimize
> pcpu access. However, when performing reverse execution based on the
> registers and the memory contents in kdump, this information is sometimes
> required if there is a pcpu access.
>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
> arch/arm64/kernel/process.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> v1 --> v2:
> Directly print the tpidr_elx register of the current exception level.
> Avoid coupling with the implementation of 'my_cpu_offset'.
>
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index 5369e649fa79ff8..738932e6fa4e947 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -216,6 +216,17 @@ void __show_regs(struct pt_regs *regs)
> show_regs_print_info(KERN_DEFAULT);
> print_pstate(regs);
>
> + switch (read_sysreg(CurrentEL)) {
This should use is_kernel_in_hyp_mode() to detect if we're running at El2.
> + case CurrentEL_EL1:
> + printk("tpidr_el1 : %016llx\n", read_sysreg(TPIDR_EL1));
> + break;
> + case CurrentEL_EL2:
> + printk("tpidr_el2 : %016llx\n", read_sysreg(TPIDR_EL2));
> + break;
> + default:
> + break;
> + }
I think this path can be triggered directly from usermode, so we really
shouldn't be printing raw kernel virtual addresses here.
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-04-28 10:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 6:24 [PATCH v2] arm64: add the printing of tpidr_elx in __show_regs() Zhen Lei
2022-04-27 18:40 ` Catalin Marinas
2022-04-28 10:23 ` Will Deacon
2022-04-28 10:21 ` Will Deacon [this message]
2022-04-28 11:07 ` Leizhen (ThunderTown)
2022-04-28 12:03 ` Leizhen (ThunderTown)
2022-04-28 12:10 ` Leizhen (ThunderTown)
2022-04-28 13:13 ` Will Deacon
2022-04-29 4:16 ` Leizhen (ThunderTown)
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=20220428102156.GA14123@willie-the-truck \
--to=will@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thunder.leizhen@huawei.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