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 A80B6C00144 for ; Mon, 1 Aug 2022 15:34:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233097AbiHAPeq (ORCPT ); Mon, 1 Aug 2022 11:34:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230501AbiHAPeo (ORCPT ); Mon, 1 Aug 2022 11:34:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB88B2CE01 for ; Mon, 1 Aug 2022 08:34:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 88F3FB80EB8 for ; Mon, 1 Aug 2022 15:34:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AA22C43141 for ; Mon, 1 Aug 2022 15:34:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659368080; bh=SopU2Dx9+Fogun8+HI+zMadE4kKBX3Mq9vYrcuV465k=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=b2Cxruv739bbgE7iFITXxWHDVNzUDFsNvBnlGt8iYgq2Ek0u5x+UnoDg09uzpNgE9 H3z7is4LZKFG3DgbrOL3bDYCsTGswqZVegnpUgYfGKs96HspM15wzKgFJkXhRDDzHa VhE23gCvbdV1HCRw1abmnfo9sYmEWG0IDFy1ZyQu0rBOmuYxBxIyVs+oPVGekXx+tZ gExj9O940PgOHX98GtqLbW2ObwwZPtnTDS0QklHBc8b1wydr/5IIKBe9lII/YB0UdU 1OF9O5yXRgZUhZcLLqQVyyw/VlYDIeYN8BP+JBvmES0625aVBdtvRlNcnYjUbKNlf0 MtXb7cCyNcAIg== Received: by mail-vs1-f42.google.com with SMTP id j2so5148442vsp.1 for ; Mon, 01 Aug 2022 08:34:40 -0700 (PDT) X-Gm-Message-State: ACgBeo0ZDh9ufds0p9wBtrwyIGS+3WJf0Nle1ZO6/f9XM4NnILl5cgWu nXD9BLRQMkIgK0tfaoIc+QUqm0TXhB8UFGNbyR0= X-Google-Smtp-Source: AA6agR7Qrsp+h8Ya+oRX+sMvc1vsXjXlxEd9rU8clHuJTbjfM3u9QDVn/4iabqscndTjm5fWadzbymScnQlqIw0+PtE= X-Received: by 2002:a05:6102:390d:b0:387:78b9:bf9c with SMTP id e13-20020a056102390d00b0038778b9bf9cmr352221vsu.43.1659368079127; Mon, 01 Aug 2022 08:34:39 -0700 (PDT) MIME-Version: 1.0 References: <20220801121726.9681-1-zhangqing@loongson.cn> In-Reply-To: <20220801121726.9681-1-zhangqing@loongson.cn> From: Huacai Chen Date: Mon, 1 Aug 2022 23:34:26 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/4] LoongArch: Add unwinder support To: Qing Zhang Cc: WANG Xuerui , loongarch@lists.linux.dev, LKML , Jiaxun Yang , Jinyang He Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Qing, I think we don't need to CC linux-kernel; on the other hand, CC linux-arch and Arnd is worthy. BTW, it seems you are missing V2 in the title. Huacai On Mon, Aug 1, 2022 at 8:17 PM Qing Zhang wrote: > > This series in order to add stacktrace suport, Some upcoming features require > these changes, like trace, divide unwinder into guess unwinder and prologue > unwinder is to add new unwinders in the future, eg:unwind_frame, unwind_orc .etc. > Three stages when we do unwind, > 1) unwind_start(), the prapare of unwinding, fill unwind_state. > 2) unwind_done(), judge whether the unwind process is finished or not. > 3) unwind_next_frame(), unwind the next frame. > > you can test them by: > 1) echo t > /proc/sysrq-trigger > 2) cat /proc/*/stack > 4) ftrace: function graph > 5) uprobe: echo 1 > ./options/userstacktrace > > Changes from v1 to v2: > > - Add the judgment of the offset value of ra in the prologue. > (Suggested by Youling). > - Create an inline function to check the sign bit, which is convenient > for extending other types of immediates. (Suggested by Jinyang). > - Fix sparse warning : > arch/loongarch/include/asm/uaccess.h:232:32: sparse: sparse: incorrect > type in argument 2 (different address spaces) @@ expected void const > *from @@ got void const [noderef] __user *from @@ > - Add USER_STACKTRACE support as a series. > > Qing Zhang (4): > LoongArch: Add guess unwinder support > LoongArch: Add prologue unwinder support > LoongArch: Add stacktrace support > LoongArch: Add USER_STACKTRACE support > > arch/loongarch/Kconfig | 6 + > arch/loongarch/Kconfig.debug | 28 ++++ > arch/loongarch/include/asm/inst.h | 52 +++++++ > arch/loongarch/include/asm/processor.h | 9 ++ > arch/loongarch/include/asm/stacktrace.h | 22 +++ > arch/loongarch/include/asm/switch_to.h | 14 +- > arch/loongarch/include/asm/uaccess.h | 4 +- > arch/loongarch/include/asm/unwind.h | 45 +++++++ > arch/loongarch/kernel/Makefile | 4 + > arch/loongarch/kernel/asm-offsets.c | 2 + > arch/loongarch/kernel/process.c | 64 +++++++++ > arch/loongarch/kernel/stacktrace.c | 79 +++++++++++ > arch/loongarch/kernel/switch.S | 2 + > arch/loongarch/kernel/traps.c | 27 ++-- > arch/loongarch/kernel/unwind_guess.c | 65 +++++++++ > arch/loongarch/kernel/unwind_prologue.c | 172 ++++++++++++++++++++++++ > 16 files changed, 577 insertions(+), 18 deletions(-) > create mode 100644 arch/loongarch/include/asm/unwind.h > create mode 100644 arch/loongarch/kernel/stacktrace.c > create mode 100644 arch/loongarch/kernel/unwind_guess.c > create mode 100644 arch/loongarch/kernel/unwind_prologue.c > > -- > 2.20.1 > >