From patchwork Tue Jul 12 02:15:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Huafei X-Patchwork-Id: 12914460 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 A30E2C433EF for ; Tue, 12 Jul 2022 02:19:10 +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=GOTPhXMP6+D54P MMamm0fX4tiwPz8xyfHUPeV+SAf2fzYcPNUQ/7gxLz8BhXxxIu6eDY2kRsTQtopU4muSa/mBPLSF8 J1SDPwysPGjNTy1cQBEcEQ2S4m1yMHDkovE6v8Eo4M4DqbmBUV7wMC8c1SJ4Kn8ZAPJjmUAbpxhSQ P5ZVTBRwefTAjCmC/0yn/ilx41OjFgyU2DPQhRm3wqQcS4tD2xVbtILF0dvgZwuTxDc+UjSA9ctnb ytR6/f5WEKx2wyjw5adv/+LsNq5f0/MB9zfrMCgRcw1w/iuHGFNRwCQ0IjamgUVdAKD9kjop29/E2 FtI6cpSiRtHke74SXyZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oB5Tb-006gfc-3t; Tue, 12 Jul 2022 02:18:15 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oB5TP-006gWa-1f for linux-arm-kernel@lists.infradead.org; Tue, 12 Jul 2022 02:18:05 +0000 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Lhkqb40zgzhZD8; Tue, 12 Jul 2022 10:15:23 +0800 (CST) Received: from kwepemm600010.china.huawei.com (7.193.23.86) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 12 Jul 2022 10:17:56 +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; Tue, 12 Jul 2022 10:17:55 +0800 From: Li Huafei To: , , , CC: , , , , , , , , , , , , , , , , , , , , Subject: [PATCH 3/5] ARM: stacktrace: Allow stack trace saving for non-current tasks Date: Tue, 12 Jul 2022 10:15:25 +0800 Message-ID: <20220712021527.109921-4-lihuafei1@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220712021527.109921-1-lihuafei1@huawei.com> References: <20220712021527.109921-1-lihuafei1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.174] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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-20220711_191803_290318_3019C9AC X-CRM114-Status: GOOD ( 13.10 ) 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;