Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3903821imw; Mon, 11 Jul 2022 19:20:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sgjGHxrepJxj/pY+SUIYOaxjujjLWYGezyaJrPKKaY2XDTYO2wrpDSC8KZgpRvxeXgNYdP X-Received: by 2002:a17:90a:d714:b0:1ef:b93d:fc4d with SMTP id y20-20020a17090ad71400b001efb93dfc4dmr1572693pju.49.1657592456107; Mon, 11 Jul 2022 19:20:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657592456; cv=none; d=google.com; s=arc-20160816; b=fOFIhSBnLwZohwRpSDz67lVmA4QHF0Zv5fcBy2j3zQ7AHRvXkKihg4U8Xr7Xzu4Mts O6QgzWBpRRdWhoanlr7EjPeL/VryHz+yQJwrZ+Iosm5q2aSeZgBBv6p1CEMwOFuEmhJe vGjC60qLytPj2THlBDmUvTtzvrfb9vdKcKmaZlzebMgSLI29bWmUURzEks4UFoHCM532 1aby1WlGpS1EKWezkWmsoc10uU1lrMYpBR1k++kOuRFyg9WJB/BtuBTZMiDDF5/9c7eC 6spKmEoMh09GFnHHvlJ742021bOwZmwOyFJY+1RVOxCj/K4/4dFH3T4gIbtWmvxHadmz 7qSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=F2xKt7X8xpAhz+yNU/XuZxwnrgNaMYI4a/NooKkXZKo=; b=U95rrUdS+Qjfcsu7Gbc2BxUAABpF+t8T3XmJOlgudj5dkyXKMA90OeKi79PvcqG//D c7PzgDH/PzVi8Zg2REU6bbT8NU21f1kmVdACgAT80Hqdayr+IuMplbXRNLtHoD+1NNlG lKQtMvFlx9B8IOPKTj5xqoSvZL1pWn957qmmWNhurSc+x17UVjGZnxoKY9yKZChJRKz/ tIddz5R73vM9f/9miyEmbIO7MJ0NHsjftHw1c01geYWMX8bPHtE8kw8mbLxMFC+OcGaj NByJXISoiuqg2wgbxXGhSPv8LdZG478xDLpssY8KrwBsaCgGtrZpjsJgljnNlBmKBlKS yRqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 186-20020a6302c3000000b0041603077be7si6007086pgc.612.2022.07.11.19.20.43; Mon, 11 Jul 2022 19:20:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230482AbiGLCSM (ORCPT + 99 others); Mon, 11 Jul 2022 22:18:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229984AbiGLCSA (ORCPT ); Mon, 11 Jul 2022 22:18:00 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 110B72409A; Mon, 11 Jul 2022 19:17:59 -0700 (PDT) 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 Content-Type: text/plain 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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; -- 2.17.1