Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2355404rwi; Tue, 11 Oct 2022 07:53:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5rQhfeJGYWbZfoipNtSginXJpjzkxP4+Z9L2gurTeXa7MpfXo/n5Zt9RKnITjALcji+OGR X-Received: by 2002:a17:903:120e:b0:179:fe49:a952 with SMTP id l14-20020a170903120e00b00179fe49a952mr24926570plh.21.1665499993958; Tue, 11 Oct 2022 07:53:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665499993; cv=none; d=google.com; s=arc-20160816; b=NC9mTNOiSGg0zRCIw00TPhKdqx8CGUs5i9nmmAMK2asvnbXiBtKOJvNVvs6FTXAerm T/qAWTi+sbhRbmxZLrtTDDIjsTQIHpBMsgvtx+d5i8X5S17s8/WTkSumPXj3MpSRNyLw 4WLlS/xZ0fYylgjrO/VBC1FkkfpgXXID05FSplvaKjWHFYpatar9uBNloWLudh2ylVVC NioiDtVhYZ/htJrcSeycSvSBJAuiYWBPhDnaUkOwmPlY/87DFHKu8SLrziyygeEoSPDR o2zCcvGId54LzlnKLrNNBKtJ9uPhdV6HqUVydr+Cgb2YXT9g4SG4nYJJBCclCxCsnFKj UIoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GqU2NsYKSHkh135jFOkb/DuHTBwfGlFPVHvoaHd+ymI=; b=CVAgmmC379wAVbPg/Q2/ZS4YzSaueevOZMzfgB29xvn5ZpDCRrjDqNgZ7+uvM3sazg MqJoRiwpQiDpCVEkMo9VoasfFaAj8M370+X98CNIUUdubbG6xH4F75J4eRtqcPEENibf +t3azuBDMfSwc77McfA9aEaEHiCLCXXD7lWKSbixuhEuXQw7E3iqQSwrzO3bFktflapr 0npF9AomOIpVVeDBk3D7j2ZDygNlZjD5nykCUI+k9Nq2m+tcCXarW/Om+o0TH/tPHOEn u7WMngc3A4OtRFr9KQ9H6sh9B0EbBcC0qEzzWxhlp5VGkQozGqaoBIas+3wKnPpiNjHw e/uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JxcwnmbK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x15-20020a170902ec8f00b00176955c81eesi19142675plg.247.2022.10.11.07.53.01; Tue, 11 Oct 2022 07:53:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JxcwnmbK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230138AbiJKOvp (ORCPT + 99 others); Tue, 11 Oct 2022 10:51:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbiJKOuy (ORCPT ); Tue, 11 Oct 2022 10:50:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 298CA98360; Tue, 11 Oct 2022 07:50:47 -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 DFD14611B1; Tue, 11 Oct 2022 14:50:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73820C433D7; Tue, 11 Oct 2022 14:50:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665499846; bh=WwZXZfJykxDQbni6IAyyWtlqQ12LDgoTgDtcb4fzzRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JxcwnmbKz2L+v63JCJkPbFwWJ/olgnWpXNAAtYW2LqxdeAPIYmZxoD/Op1IRyTIbv vrV7K6cXZqXyfWVSbfNgzBYTe3tR1DffHwB1KATa6QbVQPHeeMYyfkfJIujjMUmMSF WAc2xCr/ElwLhixTgkXsy1ktpxs/LTrnXoOJOmqptqVrWv6uueMj7yQz9WojyQ7/ac sRggc9c50g/sNKi7bl1t1pFtH7fpt9MNthJTT1dxL8u9nEvP5evLfvpLLbtQIyKf5J aZ49AU0PQJnnVX7DH3QZGUIUNZBhWYYqTlSMFphzdZpstOALEJQ6FEgulbMBOf21HB ikFycG+GwlJtA== 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 6.0 18/46] arm64: run softirqs on the per-CPU IRQ stack Date: Tue, 11 Oct 2022 10:49:46 -0400 Message-Id: <20221011145015.1622882-18-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221011145015.1622882-1-sashal@kernel.org> References: <20221011145015.1622882-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 1ce7685ad5de..68ee7146bdb9 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -230,6 +230,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