From patchwork Wed Jul 13 11:00:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Huafei X-Patchwork-Id: 12916556 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 D2BD0C43334 for ; Wed, 13 Jul 2022 11:05:26 +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: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=24N5XzLvz5SwYLtXCIoxl+08mQnoEuqggQlJYl3hNCY=; b=xDwXzZ6R3Gy6Y2 xWYUBC951p9z2qxs/Fj2egNZwVckEwFwVGHpN8s0D83Dx0VMYj2jRbBYz0PRcvT3ilhViNARSq+0s YRZqBlVDOT/jb5Gztm1ViGKPdDbi/0v7BjiDl9OvECrjQAXjB5O8YCfblLYS7H/7/AVdqjHWL0LP5 xoge10N4gsS/m24C/EWsNCUKC3BY5KCaY7YA6XXLvKco0jFJOTkHVtOIZ522AjUjyJtVO6I35hgeD v/PMegUa9s9Nk/KEwFL0ECqkUjqxm07WckIfp1snL8zDXEJsRAjX8oLedKF9XQH21GVeZ+79W3Gx/ Fn0WAK+KTd9Cyu5dOQNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBaAH-002v4T-Vu; Wed, 13 Jul 2022 11:04:22 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBa8v-002uJd-3i for linux-arm-kernel@lists.infradead.org; Wed, 13 Jul 2022 11:03:00 +0000 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LjZQn1Yy1z1L8Ts; Wed, 13 Jul 2022 19:00:17 +0800 (CST) Received: from kwepemm600010.china.huawei.com (7.193.23.86) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 13 Jul 2022 19:02:51 +0800 Received: from ubuntu1804.huawei.com (10.67.174.174) by kwepemm600010.china.huawei.com (7.193.23.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 13 Jul 2022 19:02:50 +0800 From: Li Huafei To: , , , , CC: , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 3/5] ARM: stacktrace: Allow stack trace saving for non-current tasks Date: Wed, 13 Jul 2022 19:00:18 +0800 Message-ID: <20220713110020.85511-4-lihuafei1@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220713110020.85511-1-lihuafei1@huawei.com> References: <20220713110020.85511-1-lihuafei1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.174] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600010.china.huawei.com (7.193.23.86) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220713_040257_362322_57B6FC4E X-CRM114-Status: GOOD ( 12.12 ) 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 The current ARM implementation of save_stack_trace_tsk() does not allow saving stack trace for non-current tasks, which may limit the scenarios in which stack_trace_save_tsk() can be used. Like other architectures, or like ARM's unwind_backtrace(), we can leave it up to the caller to ensure that the task that needs to be unwound is not running. Signed-off-by: Li Huafei --- arch/arm/kernel/stacktrace.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c index 3acf51ee46bb..836420c00938 100644 --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c @@ -171,19 +171,11 @@ static noinline void __save_stack_trace(struct task_struct *tsk, data.no_sched_functions = nosched; if (tsk != current) { -#ifdef CONFIG_SMP - /* - * What guarantees do we have here that 'tsk' is not - * running on another CPU? For now, ignore it as we - * can't guarantee we won't explode. - */ - return; -#else + /* task blocked in __switch_to */ frame.fp = thread_saved_fp(tsk); frame.sp = thread_saved_sp(tsk); frame.lr = 0; /* recovered from the stack */ frame.pc = thread_saved_pc(tsk); -#endif } else { /* We don't want this function nor the caller */ data.skip += 2;