From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B272C43217 for ; Tue, 11 Oct 2022 14:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231174AbiJKO4u (ORCPT ); Tue, 11 Oct 2022 10:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230500AbiJKOzt (ORCPT ); Tue, 11 Oct 2022 10:55:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B249F9C7F4; Tue, 11 Oct 2022 07:52:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5BA3A611C3; Tue, 11 Oct 2022 14:52:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB877C433D6; Tue, 11 Oct 2022 14:51:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665499919; bh=41z8DR5540UKHevpWyzwuW1g2GJIwYdiG4YznirPtA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B8zNEXk0kErildTHemxFgajoqmEOvnH+hNTMLX/aZgwZ3DtVguF5jjrXWdOsx+6Xa lRUt+3qaEeSBAcQ0oVcTavJ6n1kDvokWxeiq0n41qlvzu8qWmYOadIcNzGKCer1v8I 4MotvDUcnEYGcRoNCxRUmEUFYHEwpqQHrJw5bChlVXIRLpepFYR42gvvvKPxwV1v8t Wmbj4hF7PIXSDMfZw7YwRehlxJqPVJn2e5/c3YIyE9DaxD/rgECg4E9eDwcvoyhs7d nIKAu8KMDOfH3aL50tK3SG4m+qcfR6tG1JfOQZGDR3sILxq4iv2uDzKWjVWNxQL8Pa Dpn3H2f58TI2A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Qi Zheng , Arnd Bergmann , Will Deacon , Catalin Marinas , Sasha Levin , linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.19 18/40] arm64: run softirqs on the per-CPU IRQ stack Date: Tue, 11 Oct 2022 10:51:07 -0400 Message-Id: <20221011145129.1623487-18-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221011145129.1623487-1-sashal@kernel.org> References: <20221011145129.1623487-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Qi Zheng [ Upstream commit 8eb858c44b98e0326bb32fca34ae671995cd73bb ] Currently arm64 supports per-CPU IRQ stack, but softirqs are still handled in the task context. Since any call to local_bh_enable() at any level in the task's call stack may trigger a softirq processing run, which could potentially cause a task stack overflow if the combined stack footprints exceed the stack's size, let's run these softirqs on the IRQ stack as well. Signed-off-by: Qi Zheng Reviewed-by: Arnd Bergmann Acked-by: Will Deacon Link: https://lore.kernel.org/r/20220815124739.15948-1-zhengqi.arch@bytedance.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- arch/arm64/Kconfig | 1 + arch/arm64/kernel/irq.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index cc1e7bb49d38..07537d34224f 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -227,6 +227,7 @@ config ARM64 select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD select TRACE_IRQFLAGS_SUPPORT select TRACE_IRQFLAGS_NMI_SUPPORT + select HAVE_SOFTIRQ_ON_OWN_STACK help ARM 64-bit (AArch64) Linux support. diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c index bda49430c9ea..38dbd3828f13 100644 --- a/arch/arm64/kernel/irq.c +++ b/arch/arm64/kernel/irq.c @@ -21,7 +21,9 @@ #include #include #include +#include #include +#include /* Only access this in an NMI enter/exit */ DEFINE_PER_CPU(struct nmi_ctx, nmi_contexts); @@ -71,6 +73,18 @@ static void init_irq_stacks(void) } #endif +#ifndef CONFIG_PREEMPT_RT +static void ____do_softirq(struct pt_regs *regs) +{ + __do_softirq(); +} + +void do_softirq_own_stack(void) +{ + call_on_irq_stack(NULL, ____do_softirq); +} +#endif + static void default_handle_irq(struct pt_regs *regs) { panic("IRQ taken without a root IRQ handler\n"); -- 2.35.1