From patchwork Fri Aug 26 09:51:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12955811 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 981BAECAAA3 for ; Fri, 26 Aug 2022 09:57:45 +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:References:In-Reply-To: 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: List-Owner; bh=4R0lLFpyLm5kjaJ5+TFVy8i4BIN6ESwM25FK+U5RFlE=; b=S13i/GlRB4D5Wy jKzvXUh8q3xaW4IVZ3J1sOakDc1E4P+W1Vz4GmNbuHDS+wkxbLRe/XyrpOhFsh8TYxNTEGQzH24Y6 yLVYQNEAz3kVWZGWfydpPAEGKVaWAr3ijbGQFjgD71+FzAypOht2qtdLejqdc3eTLEzphuppMkGa0 tctjFAbmGQDrSNTKt+aNr90ojunt3sfA1NIue3HmWzgcV+r8VCl1HIAU/rCqPQqmz5UtTphqtP5VV DK2Z5vDiYKzxnJXn8qOR1lm+Mehfp5zzeUYb/nFGW7K2sNTE9/HYO7uq6QyVYtf8JvIcKU31XvHKt 5ABccwzx2NG6WyYFkYbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRW52-0014Nj-68; Fri, 26 Aug 2022 09:56:48 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRW4k-00146p-FK for linux-arm-kernel@lists.infradead.org; Fri, 26 Aug 2022 09:56:32 +0000 Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MDZtl11tNzGpZZ; Fri, 26 Aug 2022 17:54:39 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 26 Aug 2022 17:56:21 +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.2375.24; Fri, 26 Aug 2022 17:56:20 +0800 From: Zhen Lei To: Catalin Marinas , Will Deacon , Mark Rutland , Russell King , , , CC: Zhen Lei Subject: [PATCH v2 2/2] ARM: replace this_cpu_* with raw_cpu_* in panic_bad_stack() Date: Fri, 26 Aug 2022 17:51:12 +0800 Message-ID: <20220826095112.289-3-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20220826095112.289-1-thunder.leizhen@huawei.com> References: <20220826095112.289-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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-20220826_025630_717284_AC37861D X-CRM114-Status: GOOD ( 10.31 ) 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 The hardware automatically disable the IRQ interrupt before jumping to the interrupt or exception vector. Therefore, the preempt_disable() operation in this_cpu_read() after macro expansion is unnecessary for exception handler. Use raw_cpu_* instead of this_cpu_* can reduce a few lines of assembly code. To be honest, the fewer unnecessary operations in exception handler, the better. Signed-off-by: Zhen Lei --- KernelVersion: v6.0-rc2 arch/arm/kernel/traps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 1518a1f443ff866..d5903d790cf3b7e 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -927,9 +927,9 @@ asmlinkage void handle_bad_stack(struct pt_regs *regs) { unsigned long tsk_stk = (unsigned long)current->stack; #ifdef CONFIG_IRQSTACKS - unsigned long irq_stk = (unsigned long)this_cpu_read(irq_stack_ptr); + unsigned long irq_stk = (unsigned long)raw_cpu_read(irq_stack_ptr); #endif - unsigned long ovf_stk = (unsigned long)this_cpu_read(overflow_stack_ptr); + unsigned long ovf_stk = (unsigned long)raw_cpu_read(overflow_stack_ptr); console_verbose(); pr_emerg("Insufficient stack space to handle exception!");