From patchwork Fri Jul 8 09:49:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 12910836 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 86879C43334 for ; Fri, 8 Jul 2022 09:51:33 +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=SnFy7eYku0SIkIsFBkTSBz2WVKeNfxRC6PCyluFAuik=; b=yiEL4ngQZzAzGO oDy5W41bmO5anvPsP70ls1xs3ay7HSgdL2ds37jBXN1MBehujexWpa8iNBGCcwAhbhB7IX1GUSMJI ymDWrBS6y05ApntEjRCELY6QuCKyQTZe4pfCyLOO5CekApSZAO4Vd5xeePFisf9DbNwZ3WBB6CGhF 7IPR3+iboFMLYIiwpa+Oo4lbdoLFjGkq5hc/sGmeqUM2dajZmd+dHMZrtCb5uyjy1dV6ixid04XPK r0QJbifJgrDmKaBwWHaXmX52oQdCA6HmID1FIO7fL26s7OyXgGNFze9r0VbklQg0toakqJIQtCqX+ nBFHbwPOq2czTGq+AIKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o9kcy-0031Qx-3u; Fri, 08 Jul 2022 09:50:24 +0000 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o9kcs-0031MQ-IN for linux-arm-kernel@lists.infradead.org; Fri, 08 Jul 2022 09:50:21 +0000 Received: by mail-pg1-x52a.google.com with SMTP id r22so15027677pgr.2 for ; Fri, 08 Jul 2022 02:50:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Vdi/B2mPTnCMyO8HGcEgE0ipigaIaniIRr1AKwKskEA=; b=BWLI9FKAbTKydGoq1piX23lQ9ZpccEkEkE2A6rJmGmxGtChFUxhjRdQNw/rKHxLDK1 TrM9pd+l9h9AzZCgUC3hR2gg9gEXPP/RzbR0gfg5o3zdA7EzXHbLYos+sjX0nItakXd/ 2OUR0tx93irPrRZt69XIPqj2ewMDkftngms5vLJ05fmNTb7WfKx68hnnNT+nBOhPcE7M TMkEBrMAjz9GAJTHEFr3rf0S7pPL1cY68qOgMngdLsYZOMibOO4kenk0kzyPa0ZcKV9/ QdHLP8ZF+QGqLJBccYGVEoUInwLTXcOiHKt/ZOtvDsCBWml2TEn7UyMF097VN5VZrdu9 dmjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Vdi/B2mPTnCMyO8HGcEgE0ipigaIaniIRr1AKwKskEA=; b=pdQ64Sf6IBGYIWhG9x19rjvQFJZuoJ7zqXnz5o8MWdCPEeipAp8WOXlCL7vQUbHGnD mhH5fr/ZNptLOVEE5VPIpyd02KLC/k3rQcOHo9GDEd28nkohrzRfor1icie9PE/6Vq7l GX+UlxcejvONWTH4Ww7yP5brZ1jb4SYzJNDRGwkXckx6k0f5r24rhbLHIetlbkETsFbD Inr7IuKjNISzg6aMzbpnV703718hAVnm+bVg0SWhvBzPHTPejEN8GaHdSUGNuKxckjDQ qKk5kcdyDzTooIhefRVwQwd2gLEMEA2Yt2p/zEEJSas8OyviA2N3NN0Q/fRzAkJEIdQ6 oaTg== X-Gm-Message-State: AJIora/e3N1QmEEGUy+sbsqXZ3YZZO8+ztudVTowERTwdFmTYXzY3isx 3V0Tu6FBpydzqBBoVtgKpxeIMQ== X-Google-Smtp-Source: AGRyM1vF+zH4lZrtoJ7jB7vsYOWYxkq1zWz7B1qlwvoC3q+R6Fujt0ziY4BVzrI6ISDr2dbYcCdlpQ== X-Received: by 2002:aa7:9985:0:b0:528:d798:1de2 with SMTP id k5-20020aa79985000000b00528d7981de2mr2877131pfh.84.1657273813593; Fri, 08 Jul 2022 02:50:13 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.235]) by smtp.gmail.com with ESMTPSA id c18-20020a621c12000000b0051bbd79fc9csm28551035pfc.57.2022.07.08.02.50.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jul 2022 02:50:12 -0700 (PDT) From: Qi Zheng To: arnd@arndb.de, catalin.marinas@arm.com, will@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Qi Zheng Subject: [PATCH v1 0/2] arm64: run softirqs on the per-CPU IRQ stack Date: Fri, 8 Jul 2022 17:49:48 +0800 Message-Id: <20220708094950.41944-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-20220708_025018_660637_39F44682 X-CRM114-Status: UNSURE ( 9.70 ) X-CRM114-Notice: Please train this message. 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 Hi all, 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. And we did encounter this situation in the real environment: Call trace: dump_backtrace+0x0/0x1cc, show_stack+0x14/0x1c, dump_stack+0xc4/0xfc, panic+0x150/0x2c8, panic+0x0/0x2c8, handle_bad_stack+0x11c/0x130, __bad_stack+0x88/0x8c, vsnprintf+0x2c/0x524, vscnprintf+0x38/0x7c, scnprintf+0x6c/0x90, /* ... */ __do_softirq+0x1e0/0x370, do_softirq+0x40/0x50, __local_bh_enable_ip+0x8c/0x90, _raw_spin_unlock_bh+0x1c/0x24, /* ... */ process_one_work+0x1dc/0x3e4, worker_thread+0x260/0x360, kthread+0x118/0x128, ret_from_fork+0x10/0x18, So let's run these softirqs on the IRQ stack as well. This series is based on next-20220707. Comments and suggestions are welcome. Thanks, Qi RFC: https://lore.kernel.org/lkml/20220707110511.52129-1-zhengqi.arch@bytedance.com/ Changelog in RFC -> v1: - fix conflicts with commit f2c5092190f2 ("arch/*: Disable softirq stacks on PREEMPT_RT.") Qi Zheng (2): arm64: run softirqs on the per-CPU IRQ stack arm64: support HAVE_IRQ_EXIT_ON_IRQ_STACK arch/arm64/Kconfig | 2 ++ arch/arm64/include/asm/exception.h | 4 +++- arch/arm64/kernel/entry-common.c | 30 ++++++++++++++++++++---------- arch/arm64/kernel/entry.S | 6 ++++-- arch/arm64/kernel/irq.c | 14 ++++++++++++++ 5 files changed, 43 insertions(+), 13 deletions(-)