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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81B6EC433F5 for ; Sun, 17 Oct 2021 13:22: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 39F1E611C1 for ; Sun, 17 Oct 2021 13:22:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 39F1E611C1 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=11Bm9sEnO0V2NGs3CTz4cqRYy2w65yFaagX8O+BM1vk=; b=SIGr1aObgCr3JM ZIULpKThNB12QkRaEdWvx0gvV0w4+KCIKAwR99mcoRdsK+xFDxfrxlPZx5lyEh0wGabR95KiqqvbA IxVAc/aSUoNKoXtnGdSzdClS/xUcnQKwKTto8a4Yt6CeOiAux95dk/S6bpYn/4Tin0MvaOsnHBYay TX6fXXrZ26VfmN9PdlkDlH10hfeya2HyiXjiatGGxuBBxdYufXG3jCk5cJ7jHDIafISYPtseNV4fb McYAefNLh6Yc8XPgd+eopT1LWcC7wXkG5igqmdpSLnYgrNum0BuiO6BuLNDBjmGd4KdnbEuvRry6m 4Y/HmWLYnU7TNNO6/YBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mc65q-00Cc2H-6M; Sun, 17 Oct 2021 13:20:50 +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 1mc634-00CafN-84 for linux-arm-kernel@lists.infradead.org; Sun, 17 Oct 2021 13:17:59 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id B82E861038; Sun, 17 Oct 2021 13:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634476677; bh=WEnM3Q+1Lfdtyu6dum6ZekjVRce8rDM9sREPoIw6q6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TBUTo8xSW+Gjr25B4dqk59Q2NkrfRaunQiL2cBSUVqDl1Kb7SEmTEF/K0fdFfLPj9 zIXKX3Q4zfcqsnoqBEolt1zIU5g5rAAt83NBRjGvMZR5CMcW8hqek8N5ALhW+wGx+T 10Zi0ajEwSrQbefNwN7as497L12BovpyScpoohn+OVTJ6N7tqRJdaxcmquOYkS0gO7 75XgoF/s6FuCtGrFKwZtWMpdAxUu4hQx1X75wK/CYPnU7UW672MxJDG2q5S546Jy1r 4unsb8mCOWI/HSXs3/yvjEgV5BOBJ+MFLbfsuRbuA2R6BNeOqlHHWbw0GzFpQ5uf1Z UxI1Z1FqiQ6GQ== 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 v3 10/10] ARM: run softirqs on the per-CPU IRQ stack Date: Sun, 17 Oct 2021 15:17:23 +0200 Message-Id: <20211017131723.4034662-11-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211017131723.4034662-1-ardb@kernel.org> References: <20211017131723.4034662-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2217; h=from:subject; bh=WEnM3Q+1Lfdtyu6dum6ZekjVRce8rDM9sREPoIw6q6I=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBhbCJivX1+um/2Ygzc/jqLyD0JTv6B3bpJYf8MMmQv ulantUKJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYWwiYgAKCRDDTyI5ktmPJDfmC/ 9IGcTZxST7PvWSqZQQ/n53zxC7k72AqhR9yMsrL6UrHbSD3pb0D0PSWZ5vJzhckcLapY9zugsd/FI3 SvKogfpMlZtUN6vTELf8hMrJBxQnT2UNBhanJKB/txJesDgjeVF9mlKgb4pDonYZlx6t19GbjhEC+x gu+Y9uJVvWHzICNsbkWESjAgOtPCtmSc3JjNt8ysZGoioT8AjhtAD6CEdDz8y8dZKwkDwviKsd6WJV soeIHM3IDAs85r3XkqY7aezVE6ggVv67yCtZ8wJVONNNCSq7dv7bS4Zl0C1P63rmOEdtbJD5RwySym z2IJH/sCiKT3oWeDsymT/TkPrUoD/HLXYA8CQKryIzA4quQ9aaECZhF1zbBeB9Vzidpb0bwKoHcsko sLRwwE/wx7IZIaGhaTqF88HhCJ6uhfEJV8rBxzhZRAI5mV9KIhCNgqDI6wQqc4YMenJRAUT5bZPb+O j4uWgx2WUbs5JN8ELqF5WORwplTRsApZhVNopUJOQ0VLs= 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-20211017_061758_376090_A1BC1CA7 X-CRM114-Status: GOOD ( 13.41 ) 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 a8c1db0736f3..d46b243e1b26 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1166,6 +1166,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 58af2adb1583..bab3159b9074 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