From patchwork Tue Aug 2 06:53:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 12934261 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 22ED2C00140 for ; Tue, 2 Aug 2022 06:55:36 +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=XNE90bURofcVZeoSUj3B5NJsqUQ6RrV4DFc/k++JOc4=; b=hmhTjs6hTuDpYn NRw9ZcCkWQAjZ4hoMhA/R2laDLe+fiHStZhkBjzNNUTnQkbw0fYGzywgZEqIeL0sWQXEpkHHvSGcj /XlHjedPUaYtGfTAonUdwp10apnVH9caMu+QbL9IsL6nGTg4QWfvFyvobaXv1rmviLrcPp/Izyg+W bwkIM3bdSo0JAx53DXLQ/CTz8Uv3gutLnIs7KwYZDIFDVo3zMPYkcobKuBUeP7XKAN2eJtCGnn6kM m6BycPwx2Mp0api6jsZ9QX9AHXrZiaGY7KhpQXOSFIhu+n3iukzxdt/xQCorLLKBFlJb2/vcqmmWj e0YHes6ZupfmiwQJrfSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oIlmg-00B6AF-HL; Tue, 02 Aug 2022 06:53:42 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oIlmc-00B65x-ND for linux-arm-kernel@lists.infradead.org; Tue, 02 Aug 2022 06:53:40 +0000 Received: by mail-pj1-x1032.google.com with SMTP id f11-20020a17090a4a8b00b001f2f7e32d03so1001313pjh.0 for ; Mon, 01 Aug 2022 23:53:35 -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=uVFoLxQ6dMayohS3JHhDfe5iy+WrdfwvAxJQ06r4ODg=; b=xgH/Pm2Vq7i1xxAqCs0FiuBWEln7VQz8Mthw8a5mgC/b96Dpl/iGsVG5qf/IlnjGCx 3E8gpHm7laW2IZ2DSrKNi008izQaxPCz6pFvauX5MR5Hh5rgtgIUVQHhgooSpUjRLOIt NN0H9OwLhzBkSgFArjxFA5YKPVzTBVJXIep6q4+xmrm0HgXJgWuE6xFgqpfwhE5qBNzX rZrSbru+D8Ho2GNPHfscScz2RwhgIa0gbF5C+M3J/PT7tgpRdNhfK+9NYgvT/nGVXgxS 5z4ajg+2CDUDDrnQ/3U43uY+hN2UtNFdn0DkqF7YFj+VLGyfbYIcYnKC4Ice89pa1GE7 nWZA== 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=uVFoLxQ6dMayohS3JHhDfe5iy+WrdfwvAxJQ06r4ODg=; b=w4+8Q1jmOuPxwCmVX0EyyxU3zGEVBlxFAVfjIlRCEuH0x9iDWS2dzk3iWU6bwM/hrG cOW6TTJyFqlfD4xCox1gCQVt9JSoK/mle6N1/mzJwyueEWKRQE+ocbGs+v1698+oqvxL Ah/VMqIqy/vdj+e2LP4JJ62lT+/C9DXFVjo0eZ/ERiDj1XP1LYzroU+iUPQFEYcXiQv0 9/ku/WsNqf9KhDTCnAMgcp4WTHXJ5HM7lPuaP1UJipOl2Cg5YLLByveSC/hJzCzGIvam 26gg77hFLZnf+OIoSW4m4rJOfjmOQYkJeTK7qyWeQmxLu/uK4O5rV3POb9SZzemWT428 6w3g== X-Gm-Message-State: ACgBeo1taJiwOOVDMdVV7r45+VuKG+f1wbP7Qaw5YyQglaWZHJixdCol 31PHTyq49j5I7s3k7B3K4RwMZWffgWPUPA== X-Google-Smtp-Source: AA6agR49NL9qaHjMgzqU4n2JYSNt1BQhiTLN5q0K/x8eg2GJigMZYgcN0OEqv/0rRIO0OMkhEyZuMg== X-Received: by 2002:a17:903:248:b0:168:cf03:eefe with SMTP id j8-20020a170903024800b00168cf03eefemr19889308plh.124.1659423214750; Mon, 01 Aug 2022 23:53:34 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.245]) by smtp.gmail.com with ESMTPSA id 18-20020a621912000000b0052ac5e304d0sm10198168pfz.179.2022.08.01.23.53.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Aug 2022 23:53:34 -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 v2] arm64: run softirqs on the per-CPU IRQ stack Date: Tue, 2 Aug 2022 14:53:25 +0800 Message-Id: <20220802065325.39740-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-20220801_235338_817373_57F27E71 X-CRM114-Status: GOOD ( 12.88 ) 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 Reported-by: kernel test robot Reported-by: kernel test robot --- 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 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 1652a9800ebe..90f1ab403724 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -226,6 +226,7 @@ config ARM64 select THREAD_INFO_IN_TASK select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD select TRACE_IRQFLAGS_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");