From patchwork Mon Aug 15 12:47:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 12943515 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 C841FC00140 for ; Mon, 15 Aug 2022 12:49:21 +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=/b592m3vFe0eLfUcMcMeMOKZlGezIt6CAdF2zDqdNDE=; b=vxnXTkarsf9gn+ t/HaRi7rU5axfExv/D3pfrnJANt5PVZkvO1g95CeAu3WJ/UnhiUQAIlYpoz8c0tjhmff7gFL3sVGj BAcZbo1N317h75pzsxpPSNXUtqX0ZaSkP++tpTNff6w7spksccXPofyM2twBd669aYPt8m4QC0oJx jHJr13cYXSu8OJIrFjtsfoX/K1eWqqQ0XSrAYYs4+XvIkJqfrL1TEjb2agEuCe1hi8s9olHmIuzSA pycpl17bDJkny96BL5J/YN9IcO05dwapubFt7JNUzkRDu0XpevbuNhWa38KWYEEa3bQFoJLxPaxOR LFBoGWcLnbfA0Te3HOXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNZVp-00GKaw-Ce; Mon, 15 Aug 2022 12:48:09 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNZVd-00GKMY-5B for linux-arm-kernel@lists.infradead.org; Mon, 15 Aug 2022 12:47:59 +0000 Received: by mail-pl1-x635.google.com with SMTP id jm11so4018237plb.13 for ; Mon, 15 Aug 2022 05:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=lCEAvY10+NuD3nI71zP5xZdZUHWOv7uZzVeE6q+OzUA=; b=zPNKrPGThoSz9nzB7BMJM3FLXCRHMT4l03DnKDthKSIhRGG5sO3ndDWsBeeniTJrEg AFFh9QurWm2n/DsGpGftrkBlsD94ljaY9VIMNoSgLkohJ4kPbphzWc1IjWGwDBeqkB6y Ndt2kWxLMWVb6eyXLl2t5MbqRkvvQ9kFXKQraDTAZh+jTFCjq3vLRiGWloc0WT4CNmEx lyyu1/U3N09i4wsrrHBZIKuC8OV1VvhaMRpfgNRv5cAQkh52kvjooHMKm3B+js7X7Fwf zGkUV3NFx79YGjLwaH3qcTchhdSLUyALvu3/rTRk22DuNLwXyJu2od8XeV5DZtKVcKKQ FbYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=lCEAvY10+NuD3nI71zP5xZdZUHWOv7uZzVeE6q+OzUA=; b=J2kXxT4Hj+v7NQnIAAXSh/kjeZC02lufUVDItQAeCJMRmx+yJI1SYZh9nsw9yAtVgD g1UxfdxVIHNMAkdfc9GWYv3Kbr42YUaGphXbX3WpMKB0J2op90mS63WnMSkCdggMAAvw IPYUgj8sXeWwr0eTREk/iAAZdGWm1Zze16EX6S9x2iHiICFgjYXSXhkJgR2s8pwdxdJo jNtXyR6fLOl53sbkP74IL2T2cV8o/fhyhTSqBRGe0GXvsitjSRp9nkbN20HESMy7j9Vy Dh/sp6TgfEg9kWpDsXCKfNYpm3De1e8dWoVqzs/7YzwghZcybYCNIHT1a27U+iqTvuxR LZ6w== X-Gm-Message-State: ACgBeo3WmQjHg/5uGESNKbARCo+yuOL66QHHUWIzwg4nnEKc3XHu13LL RVlLLtZRyowqwYgv3lhQ9+066g== X-Google-Smtp-Source: AA6agR7596dP9ozLOori/oTF1oBmmRkZ74q2exd52NU8fWNgECFrpZb78p9fsG4PL1fBGlQf46wrfQ== X-Received: by 2002:a17:902:f813:b0:170:8d35:8470 with SMTP id ix19-20020a170902f81300b001708d358470mr16864661plb.156.1660567673784; Mon, 15 Aug 2022 05:47:53 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.228]) by smtp.gmail.com with ESMTPSA id x12-20020a170902ec8c00b0016eecdf8978sm6976713plg.106.2022.08.15.05.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 05:47:53 -0700 (PDT) From: Qi Zheng To: will@kernel.org, arnd@arndb.de, catalin.marinas@arm.com, mark.rutland@arm.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Qi Zheng Subject: [PATCH v3] arm64: run softirqs on the per-CPU IRQ stack Date: Mon, 15 Aug 2022 20:47:39 +0800 Message-Id: <20220815124739.15948-1-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220815_054757_345114_80A1BE7E X-CRM114-Status: GOOD ( 12.56 ) 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 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 --- v2: https://lore.kernel.org/lkml/20220802065325.39740-1-zhengqi.arch@bytedance.com/ v1: https://lore.kernel.org/lkml/20220708094950.41944-1-zhengqi.arch@bytedance.com/ RFC: https://lore.kernel.org/lkml/20220707110511.52129-1-zhengqi.arch@bytedance.com/ Changelog in v2 -> v3: - rebase onto the v6.0-rc1 Changelog in v1 -> v2: - temporarily discard [PATCH v1 2/2] to allow this patch to be merged first - rebase onto the v5.19 - collect Reviewed-by and Acked-by Changelog in RFC -> v1: - fix conflicts with commit f2c5092190f2 ("arch/*: Disable softirq stacks on PREEMPT_RT.") arch/arm64/Kconfig | 1 + arch/arm64/kernel/irq.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 571cc234d0b3..ee92f5887cf6 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..c36ad20a52f3 100644 --- a/arch/arm64/kernel/irq.c +++ b/arch/arm64/kernel/irq.c @@ -22,6 +22,7 @@ #include #include #include +#include /* Only access this in an NMI enter/exit */ DEFINE_PER_CPU(struct nmi_ctx, nmi_contexts); @@ -71,6 +72,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");