From patchwork Wed Mar 16 06:24:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12782308 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3E571C433F5 for ; Wed, 16 Mar 2022 06:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=5pu0Iy+c5CB8+tw94HAkxKlwlBLSJnZ8hUTRxJybJzc=; b=RyMphQHjFotLai jsB9SenJIjkq5vQ71RDNVe4pqRcVwBV3skbHR4OdamjOuh+zURAt2C0u83zrZoCsSXUMO4MV+u31L 6v2zDAa311wB+vhX29+gTUfuhJRFOyMixOVkeh1Vi9KJ6XZQ5PjsHpZu2jhb5BwcTe0Lm2fV/K3S4 CJXD2U5n45BEUfhv2bRePLPHztQ8t2tWewTvt3BGR02B0ftshLiIVi7o6Ec5oEBis53onaLgMXS2U eBODoaTGGfcOJHuoqwStVP47e6OvlXEJb7HQVXTot8nSIO6mc+uw/8nwzW+DMwmiYBx0yWx10Nf1y S5fhOweiGvLGx0M2CYuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUN5Y-00BhLZ-Ft; Wed, 16 Mar 2022 06:24:52 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUN5U-00BhL1-N0 for linux-arm-kernel@lists.infradead.org; Wed, 16 Mar 2022 06:24:50 +0000 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KJKw55HSKzfYv8; Wed, 16 Mar 2022 14:23:17 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 16 Mar 2022 14:24:45 +0800 Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 16 Mar 2022 14:24:45 +0800 From: Zhen Lei To: Catalin Marinas , Will Deacon , , CC: Zhen Lei , James Morse Subject: [PATCH v2] arm64: add the printing of tpidr_elx in __show_regs() Date: Wed, 16 Mar 2022 14:24:08 +0800 Message-ID: <20220316062408.1113-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220315_232448_961646_EB803D2D X-CRM114-Status: UNSURE ( 7.87 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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)) { + 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; + } + if (!user_mode(regs)) { printk("pc : %pS\n", (void *)regs->pc); printk("lr : %pS\n", (void *)ptrauth_strip_insn_pac(lr));