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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8459CC433EF for ; Mon, 15 Nov 2021 08:52:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5252361A88 for ; Mon, 15 Nov 2021 08:52:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5252361A88 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=1vWJHmHga5NTQDqbTFpur1OzsSbLnDPvd1Z6NzBe5pU=; b=JyMPmkFBUKdLi6 QVXfP1t1lnCjzGLT5thcVPCVSAXbHj+6a7TC9zN0NU6GiEB8wbno3Vv8DrP4U9UcKeXSdHdEqFM9Z Tgrwa9oVgKPLrs7Wk7XLiAQ94F+41ySiFWTAKM/qeAfFpRHiIAPqQICemipm4F1IPJzbpT9+GAGqj 1cqizMjoPGHW9vkv49T4Id+m3ULwC6YRlyjALFwillvh+YKU/EGoWVdDwPkFHIw94v8YryXpd1nX1 CcEq4u4mm4nyOlWJsQ0xe34vpDOlG9qMYdlwurz3AadIrHg0TEj8v18AyzQU5KgTrgA19MurMDev7 soUMpjBwOrDRh+HynumA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmXhW-00EkXV-SF; Mon, 15 Nov 2021 08:50:55 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmXej-00EjAL-Qu for linux-arm-kernel@lists.infradead.org; Mon, 15 Nov 2021 08:48:03 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9322F63219; Mon, 15 Nov 2021 08:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636966081; bh=LQezva8UlVV7fH6u22k41aehWjFCxVBwDbn07FbvMN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=naMRyROKg8qeOKNtyjC7KLyeDa72NnZmRne7X8eJDGgG0bBu4Gh4WdopO5WSPZbgA ZHwu9kpHdtHZnuk4C7tqRXvP9waPb5nSb+diq0wUb1nru33G9Vu7XQDU3KdL4VT2+S 3lfRU1i/zRNsQ4XC5cSpnAxxbtuh2QQRSawwvxOSXyZ6FQSBCRiSgS5YtXIM+Mp9HG SYNLinAtEaB8RSj1iHgB+IZK9Tn4mWGBkM08gVUn5z2fohMyMgHx1mSRUPGinyzjEI MG3U03auSc8RFzZ4g1MPxCLMYZ0xzgAGnRp7K33gkQX52WFphlzvR2U5dzlazgXa3q mgRM9m6Y0/ojA== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Russell King , Arnd Bergmann , Kees Cook , Keith Packard , Linus Walleij , Nick Desaulniers , Nicolas Pitre Subject: [PATCH v4 9/9] ARM: run softirqs on the per-CPU IRQ stack Date: Mon, 15 Nov 2021 09:47:32 +0100 Message-Id: <20211115084732.3704393-10-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211115084732.3704393-1-ardb@kernel.org> References: <20211115084732.3704393-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2217; h=from:subject; bh=LQezva8UlVV7fH6u22k41aehWjFCxVBwDbn07FbvMN0=; b=owEB7AET/pANAwAKAcNPIjmS2Y8kAcsmYgBhkh6jOSNkeO/TPy7DKvkhOuI1XFBT+rLDDnM4HS24 kiJqtjqJAbIEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYZIeowAKCRDDTyI5ktmPJOTNC/ jEeHRcq4YtlsW8TDz9rhTJFtk3HqOGhHQ19ZcKjvGa3ngOOCcinHw9hGHEutMnADtK2fvurp2U8BFG c1OApP2puXS1BRn9OmKyTapnSwXyMYlqr4MB7OLdmnqFOmRiWZmAKjnkO1z4jNOqggDZ5tOk2NtbfR wf5NJlTyMSIOE4RjB79sXeXTPJsUQheH3a1pbTmPLYFxsocfNFtB3ddtGk0K6nFnXKvgMYeVAR8Ao3 TF78MhTHSBJ5oKqVnUkg3Y8BgaUJhcY7Hp+JOFx+pukFOj39hJwDSLrvGSYcbbydDbCY19yGLtI+RY qZc/nT+m1s/qcL4GQ71np6g/Zfiu70of9YayrsEl2w0yfhNhbkXXYfNQDMNfkIpFsnyY/3PbVsrPYs iDQ+gt5s3uN/9i6rw4iLBsAUdGRMo+Ju0/fNIUSeAKfPhqVFrDUsoDSE7lraSS4C1Xiw8kbf4FhFyn aVAtTJYuF9FKeMZa0oeNouLiflKjx7VZrOQGDtvlt/MA== X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211115_004801_931321_E53A8013 X-CRM114-Status: GOOD ( 14.11 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that we have enabled IRQ stacks, any softIRQs that are handled over the back of a hard IRQ will run from the IRQ stack as well. However, any synchronous softirq processing that happens when re-enabling softIRQs from task context will still execute on that task's stack. 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 synchronous invocations of do_softirq() on the IRQ stack as well. Signed-off-by: Ard Biesheuvel Reviewed-by: Arnd Bergmann Acked-by: Linus Walleij Tested-by: Keith Packard --- arch/arm/Kconfig | 2 ++ arch/arm/kernel/irq.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index aa421f29910b..b1eba1b4168c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1169,6 +1169,8 @@ config CURRENT_POINTER_IN_TPIDRURO config IRQSTACKS def_bool y depends on GENERIC_IRQ_MULTI_HANDLER && THREAD_INFO_IN_TASK + select HAVE_IRQ_EXIT_ON_IRQ_STACK + select HAVE_SOFTIRQ_ON_OWN_STACK config ARM_CPU_TOPOLOGY bool "Support cpu topology definition" diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index abb0aa679bba..e05219bca218 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c @@ -36,11 +36,14 @@ #include #include #include +#include #include #include #include #include +#include "reboot.h" + unsigned long irq_err_count; #ifdef CONFIG_IRQSTACKS @@ -60,6 +63,17 @@ static void __init init_irq_stacks(void) } } +static void ____do_softirq(void *arg) +{ + __do_softirq(); +} + +void do_softirq_own_stack(void) +{ + call_with_stack(____do_softirq, NULL, + __this_cpu_read(irq_stack_ptr)); +} + #endif int arch_show_interrupts(struct seq_file *p, int prec) -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel