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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CE66C433EF for ; Thu, 7 Jul 2022 11:06:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235266AbiGGLGA (ORCPT ); Thu, 7 Jul 2022 07:06:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234799AbiGGLF6 (ORCPT ); Thu, 7 Jul 2022 07:05:58 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51F072F00D for ; Thu, 7 Jul 2022 04:05:57 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id j3so6004141pfb.6 for ; Thu, 07 Jul 2022 04:05:57 -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=2zTI0bt2hGXniMSOabFtFhfhTaMs/YC0V+EzqH6eZXw=; b=LXn5sdpPpDgBpxYruZLrgEgmKOMkrd56ZWQge3eXK4T89PrUHE38kacARLZDn3lzTy vgo/a5n4GihYikVq5NHgs5ycps/uX8spRNyTkTdLg4FlTeGrrdhFwo3YldAPmWhfAsVe c8O8dUA4XSXFIVbUFuZIPxwLxhzI2ksf4CNW98jKzIw3QHJ4L/OpnOr0rgQZdIXOfEMn AhBf8DaqGoLRZJ7eZ816sy68TV3di2ZkgQQsQQQtFgrUE7WZIdYsYoh7KWqm38Gh4bmH c0jhNQJqwRMTD79FUtf3PTVuRZ5cXzbmFnrYz321esiWPMrNd4ii/DrrSMuyY4ZSaYSQ C1Sg== 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=2zTI0bt2hGXniMSOabFtFhfhTaMs/YC0V+EzqH6eZXw=; b=2UFa62YnKbnEcuCsIRkR5Out/pvCFPYdNNIIYlsx4TMD5CA+JAz7Y+e8ArHjwGy0y9 2lxUYCCDkixYgFt7LGbjhZYRJGeZ1uyZigeSepoIuGMbR6Z7ELzW22J9sxO/K9oqaISe MLKa+eQOqsGp2jDXnay0FwML67K6ukNevJGrr7tdL0gYGJo+CJ+G9C3TXYrYn15Gntvv 5QzMszThMjRGwb25mxUe1/yUGldRcO77k68VI7nJJY0HE3z41cNsQ9GED+0hrGsTj0GW kKyKxp+tRTK6PEQEXslvthu9uxFOkFYE6eqIIMdeMrQzxBzfuUZej/Z65RCKy6Wwmhub QSxA== X-Gm-Message-State: AJIora+56I8xzvQWajjgmi3FKEhT7W4JAwrOJz9bIqRsFqr0XcJ79V29 Vw5lioEWAbqQ6k2vRQYSRcgCQA== X-Google-Smtp-Source: AGRyM1sxN+aNHJVus9UHXFQyxz8R4+HjMydn9pNnpRw3Va5FthFKH7aoBv9YSdrqItmT7/4E9E8gbw== X-Received: by 2002:a17:902:a388:b0:16b:d52b:a038 with SMTP id x8-20020a170902a38800b0016bd52ba038mr28321674pla.56.1657191956605; Thu, 07 Jul 2022 04:05:56 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.229]) by smtp.gmail.com with ESMTPSA id 72-20020a62174b000000b005289a50e4c2sm1046403pfx.23.2022.07.07.04.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 04:05:56 -0700 (PDT) From: Qi Zheng To: catalin.marinas@arm.com, will@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Qi Zheng Subject: [RFC PATCH 0/2] arm64: run softirqs on the per-CPU IRQ stack Date: Thu, 7 Jul 2022 19:05:09 +0800 Message-Id: <20220707110511.52129-1-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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-20220705. Comments and suggestions are welcome. Thanks, Qi. 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 | 12 ++++++++++++ 5 files changed, 41 insertions(+), 13 deletions(-) -- 2.20.1 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 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 22BD3C433EF for ; Thu, 7 Jul 2022 11:07:18 +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=5oYlfoNnzS7KS0z3oVi/MlFGpSiZsnM7gmF4bZ9G0+s=; b=fA5uEZbNePaCiO /o2O3RKZ6MpJNOmTyMUQ9TQ4kr/pclKPlat2nu7X2abDs4YgQiz4wgUPYG9fOtYwdLTdvhuzhG9Ms 1AZqAeMV7Tw40r7IPszx0yhjj25G+mbn0aZo6hK8ccsRWMlg5fSFnS9AY3B2vL25f8hEXuffHQwj9 NL2utgHIMQUxJ1n6v5oUHFDIQYFh5HwQ2AfQCQzswXJSKQlAhYYq+FDHPL3YsHr+acO0Fo5X+20qf zINIEGM/GtbT4odpDcH8sAeMe3fq2azJ50r4SciBX7SSXEpOYqma9z7waUeU9qetgcdUgqDtGHTO1 FNGQ2E+TNnyK1T7Fex1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o9PKd-00Fjxs-Fx; Thu, 07 Jul 2022 11:06:03 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o9PKZ-00FjvY-C7 for linux-arm-kernel@lists.infradead.org; Thu, 07 Jul 2022 11:06:01 +0000 Received: by mail-pg1-x52b.google.com with SMTP id e132so17841554pgc.5 for ; Thu, 07 Jul 2022 04:05:57 -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=2zTI0bt2hGXniMSOabFtFhfhTaMs/YC0V+EzqH6eZXw=; b=LXn5sdpPpDgBpxYruZLrgEgmKOMkrd56ZWQge3eXK4T89PrUHE38kacARLZDn3lzTy vgo/a5n4GihYikVq5NHgs5ycps/uX8spRNyTkTdLg4FlTeGrrdhFwo3YldAPmWhfAsVe c8O8dUA4XSXFIVbUFuZIPxwLxhzI2ksf4CNW98jKzIw3QHJ4L/OpnOr0rgQZdIXOfEMn AhBf8DaqGoLRZJ7eZ816sy68TV3di2ZkgQQsQQQtFgrUE7WZIdYsYoh7KWqm38Gh4bmH c0jhNQJqwRMTD79FUtf3PTVuRZ5cXzbmFnrYz321esiWPMrNd4ii/DrrSMuyY4ZSaYSQ C1Sg== 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=2zTI0bt2hGXniMSOabFtFhfhTaMs/YC0V+EzqH6eZXw=; b=LQRfAOiKkGL0GovsYpsK1vrAMT9a543fh1UqKXtMHyJa/sZ+cOm8NBq808kwOOgo/6 /iqx3XhoxnBfjSo070dejE38U3yb/moeIbR72o3VaBjbIEm5+dgSyWywy/UggA/MHM2e zQGZ+jodmHgQxrA4tsvKnf7MOa8GtKs2xTJcCJC+0460+/Fvry2MZ1iXiGceN8SuEOu+ lAgsIKwYeOx5k3Izl4kNf04F6HrqtbeBie0xaUC8UM33Cc/JaThchML3XsRXYjSHht3t Z7KfiMtGwOe2WDHQHtVUzTkH1G5qkALojzl/5U4Y0Od9poCSZYTGKl2a98iD/GAuZycZ /DpQ== X-Gm-Message-State: AJIora/aME6kldyGSEfVq29QQC2W4iOsqBKXYDs1THqsITYvTDx1gdvv 20hwzaQVSwEy9UmCCfp9EFKmZQ== X-Google-Smtp-Source: AGRyM1sxN+aNHJVus9UHXFQyxz8R4+HjMydn9pNnpRw3Va5FthFKH7aoBv9YSdrqItmT7/4E9E8gbw== X-Received: by 2002:a17:902:a388:b0:16b:d52b:a038 with SMTP id x8-20020a170902a38800b0016bd52ba038mr28321674pla.56.1657191956605; Thu, 07 Jul 2022 04:05:56 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.229]) by smtp.gmail.com with ESMTPSA id 72-20020a62174b000000b005289a50e4c2sm1046403pfx.23.2022.07.07.04.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 04:05:56 -0700 (PDT) From: Qi Zheng To: catalin.marinas@arm.com, will@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Qi Zheng Subject: [RFC PATCH 0/2] arm64: run softirqs on the per-CPU IRQ stack Date: Thu, 7 Jul 2022 19:05:09 +0800 Message-Id: <20220707110511.52129-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-20220707_040559_670845_D1B00659 X-CRM114-Status: UNSURE ( 9.54 ) 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: , 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 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-20220705. Comments and suggestions are welcome. Thanks, Qi. 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 | 12 ++++++++++++ 5 files changed, 41 insertions(+), 13 deletions(-) -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel