Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2277948imn; Mon, 1 Aug 2022 18:41:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Y4QE3X0TTuhmwrkkwytH1pcrmOOljCTcdGi0fZJu9CSgugdO/G4SEIWh1Cxp0HQUBXBco X-Received: by 2002:a17:906:cc56:b0:730:a2f0:7466 with SMTP id mm22-20020a170906cc5600b00730a2f07466mr64320ejb.211.1659404500918; Mon, 01 Aug 2022 18:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659404500; cv=none; d=google.com; s=arc-20160816; b=uYWSG13o3Rjt8B7iRorOeE3gxtpbYGbo7lIyENMPR8hdyppjRrZ2+Wunzeiwdy2Qem XEfGkweLPfPGcsMR7rXpuHebpmeiJ3zUeQBTCmpkp9MXqwwGg10aq5JWMDQhsb2oGczO f2IeaXuOPdBkDUnI6nBGiLZLFszyWCQT/5y6uJpyE6f+YkNVXl4Q/eTw1v+5QWRswxv8 ADh4QCjPvxYLPxMydHgbYCBnrOUWKxpa/XWFM6+6Spd5jbWwHZBM3m7N5qhC+3GMoeEg AqHOTF5xPLQqRUds36iXzqGCqjBHaitFe08rMdpI117XhyM/Iot7H+PJD6F0n1g2XJZM bShA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=mR6RCaidaEShMUcCCQrhgs7w0xztHQNJDCQp1busRdk=; b=C6r4K+DiYxCpOEeSZiaNEVPse6yR7XeKP1EA7u42YcsRWmkJ+61+9JDx9gbFPA+316 wITNYg83qsWEhsMKXPH+enNUvkA9fAhs3axmxSjmvqfIDgVuca7clF6E5hGd6MQ8Cwbb reWROcmYNZDd0yq+wI4iHjkJyjZ76QwhcynRNRumOg444ah3VOnZunLgsO9cN9+ZRczt 5XKEd3wkgo3eicTyNJ0WC5kxTDN7Mx8iMxo65IJBa6lLNq+NKvK6odD7hMxf1JLqLlo/ 4UX6lYkWIIsTKw4iNrb4sw/X0t1HldoK0KYL3iBp8P/7y/gCi+x3DQp+ZubV6NEQ2Xxs RMeQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i2-20020a05640242c200b0043c30f0f4a6si13456853edc.107.2022.08.01.18.41.16; Mon, 01 Aug 2022 18:41:40 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231986AbiHBBaK (ORCPT + 99 others); Mon, 1 Aug 2022 21:30:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231180AbiHBBaJ (ORCPT ); Mon, 1 Aug 2022 21:30:09 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 134C1F58E for ; Mon, 1 Aug 2022 18:30:07 -0700 (PDT) Received: from [10.130.0.193] (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9BxoM8YfuhiruMAAA--.5066S3; Tue, 02 Aug 2022 09:30:01 +0800 (CST) Subject: Re: [PATCH 2/4] LoongArch: Add prologue unwinder support To: Huacai Chen , Qing Zhang References: <20220801121726.9681-1-zhangqing@loongson.cn> <20220801121726.9681-3-zhangqing@loongson.cn> Cc: WANG Xuerui , loongarch@lists.linux.dev, LKML , Jiaxun Yang , Jinyang He From: Youling Tang Message-ID: <6e6a7219-8666-bd9e-770a-e60e4b329832@loongson.cn> Date: Tue, 2 Aug 2022 09:30:00 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: AQAAf9BxoM8YfuhiruMAAA--.5066S3 X-Coremail-Antispam: 1UD129KBjvdXoW7Xr1DCry5Ww45Zr4fJF1fJFb_yoWkXwcE93 4Ik3ykCwn5XFs3Jr1DWwn3W3WDJws3XFn7A3WF9r4Iqas8AFW8J39xX34xZ34UKw48AFs5 Ca97ta4fCw1jvjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbskFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1l84ACjcxK6I8E87Iv67AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJV WxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc7I2V7IY0VAS07AlzVAY IcxG8wCY02Avz4vE14v_KwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8Jw C20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAF wI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjx v20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2 z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73Uj IFyTuYvjfUoPEfUUUUU X-CM-SenderInfo: 5wdqw5prxox03j6o00pqjv00gofq/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_PASS,SPF_PASS 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 On 08/01/2022 11:26 PM, Huacai Chen wrote: >> diff --git a/arch/loongarch/include/asm/unwind.h b/arch/loongarch/include/asm/unwind.h >> index 243330b39d0d..f9f73a26504e 100644 >> --- a/arch/loongarch/include/asm/unwind.h >> +++ b/arch/loongarch/include/asm/unwind.h >> @@ -14,6 +14,14 @@ >> struct unwind_state { >> struct stack_info stack_info; >> struct task_struct *task; >> +#if defined(CONFIG_UNWINDER_PROLOGUE) >> + unsigned long ra; >> + bool enable; >> + /* >> + * Enable is the prologue analysis method >> + * otherwise is the way to guess. >> + */ >> +#endif >> unsigned long sp, pc; >> bool first; >> bool error; > This data struct makes me very uncomfortable, especially "enable" and > the #ifdef, maybe we can rework it like this? > > #define UNWINDER_GUESS 0 > #define UNWINDER_PROLOGURE 1 Maybe it's better to define with enum type? enum unwind_type { UNWINDER_GUESS, UNWINDER_PROLOGURE, }; Youling > struct unwind_state { > char type; /* UNWINDER_xxx */ > bool first, error; > unsigned long sp, pc, ra; > struct task_struct *task; > struct stack_info stack_info; > }; > > Huacai