Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1713827pxb; Fri, 20 Nov 2020 17:34:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzN8SFOUUged2HDLU0WpBneno0jKnKssa8I1EpbG9UiZq5myvOmhO7w9qSkvaJspCNm/b68 X-Received: by 2002:aa7:d514:: with SMTP id y20mr36718675edq.384.1605922464324; Fri, 20 Nov 2020 17:34:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605922464; cv=none; d=google.com; s=arc-20160816; b=STN0MnrPt6sIsyEeNHfet/MxCSJb4wgVPcHtdvoasNjwTvBitdzVTDqcDWC8w4FhJu UftRP8lkIZ+j6IcKs8KrBJyjeR3FRSPRAKh/Uy0ADEhPN4W3ENGMVSMG8LSz8RI8BcI5 wqP+cXwUoYWcXNnPGCncl/D11fITswxZI8aLQNzuxX3N50rYj9eohELB9MYIHKlr2XUQ FjF1+fBv3NBl3ckPe5vLl3PJLwSgUJjpe0TRXVSjuXxE4ECe14a3IiIlz2W28t0yr6o7 rs14Csbs5UvL9h0JI+4sHKVyVbfTxjLXX3P1mL1RcFtzCd90ilYku+8f4FcL81ec4AEd xviQ== 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=15+caFHBdSzd/ve28EbQg8/J/Lcri0aVAzPwRWvSqOU=; b=QBYsonkVWefp+DeMMDHverQpbFUFA1P0ljaWjM4hfjv9B63mrPUh4XpSXeD3hPTf48 Iw/R4NXNwjQKs+oSrPf2Jy0muWkAs+fW3o3k1UAhVNRXyfrTz9b9b/yd45+6KoIQVChu nrK+cS7vAXxh0u3zbSmNynT5NBr279WebTevQtjvF0jKPlFBOovMLSlySHcsB4EEBOA5 y8j3eHSDU9MfG7kxGU0OugTwz9SDdvki7i9DAZL6uRyibn122v29/HUBFMJ2bX4dgqUL yb3N6kZLhSV4BjuJJ+GxAVP+dnJ+jJSONq4uDE5+OvwDvNzU+PBSaWEn8t1MMux9SbIh ssSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x9si2719032ejy.403.2020.11.20.17.34.01; Fri, 20 Nov 2020 17:34:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728942AbgKUBcl (ORCPT + 99 others); Fri, 20 Nov 2020 20:32:41 -0500 Received: from mail.loongson.cn ([114.242.206.163]:60052 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728054AbgKUBcl (ORCPT ); Fri, 20 Nov 2020 20:32:41 -0500 Received: from [10.130.0.80] (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dxr9MwbrhfhyEUAA--.41443S3; Sat, 21 Nov 2020 09:32:32 +0800 (CST) Subject: Re: [RFC PATCH] MIPS: Kconfig: Select ARCH_WANT_FRAME_POINTERS To: "Maciej W. Rozycki" References: <1605502980-31946-1-git-send-email-yangtiezhu@loongson.cn> Cc: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li From: Tiezhu Yang Message-ID: Date: Sat, 21 Nov 2020 09:32:32 +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: AQAAf9Dxr9MwbrhfhyEUAA--.41443S3 X-Coremail-Antispam: 1UD129KBjvJXoWxCF47Ww4xGrWDuw4kXw1DWrg_yoW5tw13pw 4rKws0yr4DJa4xC3WkAw4Ig34fZws5G3yY9anxKryjyw15Wr1FgrWftrW3uas7Wr1kK3Wj v3s0gry0qw4qy3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvq14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r1j6r1xM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r1j 6r4UM28EF7xvwVC2z280aVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4j6r 4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcVAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCYjI0SjxkI62AI1cAE67vI Y487MxkIecxEwVAFwVWkMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI 8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AK xVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI 8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_WFyUJVCq3wCI42IY6I8E 87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0x ZFpf9x0JUdb18UUUUU= X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/21/2020 06:37 AM, Maciej W. Rozycki wrote: > On Mon, 16 Nov 2020, Tiezhu Yang wrote: > >> Select ARCH_WANT_FRAME_POINTERS to fix the following build error under >> CONFIG_DEBUG_ATOMIC_SLEEP: >> >> CC arch/mips/kernel/signal.o >> {standard input}: Assembler messages: >> {standard input}:1775: Error: Unable to parse register name $fp >> scripts/Makefile.build:283: recipe for target 'arch/mips/kernel/signal.o' failed >> make[2]: *** [arch/mips/kernel/signal.o] Error 1 >> scripts/Makefile.build:500: recipe for target 'arch/mips/kernel' failed >> make[1]: *** [arch/mips/kernel] Error 2 >> Makefile:1799: recipe for target 'arch/mips' failed >> make: *** [arch/mips] Error 2 > Your change description does not explain to me what is going on here I am > afraid, and based on it I am unable to determine if it is fit for purpose. > > It seems to me like your change papers over an issue by changing code > generation somehow with the kernel configuration option selected so that > invalid assembly is not produced anymore while invalid assembly should not > happen in the first place regardless of the configuration. > > In particular `$fp' is a standard assembly alias for `$30' aka `$s8' and > it is expected to work where `$30' or indeed any general-purpose register > would: > > #define SYMBOLIC_REGISTER_NAMES \ > [...] > {"$s8", RTYPE_GP | 30}, \ > {"$fp", RTYPE_GP | 30}, \ > {"$ra", RTYPE_GP | 31} > > (from gas/config/tc-mips.c) so please show us what the assembly line GAS > chokes on looks like in your case. > >> Documentation/dev-tools/kgdb.rst >> This option inserts code to into the compiled executable which saves >> the frame information in registers or on the stack at different points >> which allows a debugger such as gdb to more accurately construct stack >> back traces while debugging the kernel. > Hmm, this is what DWARF debug information is for in the context of GDB, > and I certainly used to use GDB to debug standard MIPS/Linux kernels built > without the use of a separate frame pointer register (which there wasn't a > kernel configuration option for back then, though which you obviously > still could try to enforce with the use of `-fno-omit-frame-pointer' via > CFLAGS) using JTAG probes or simulation some 15 years ago. > > And given the variable layout of the MIPS stack frame (unlike with some > psABIs, e.g. Power) the use of `$fp' alone does not let you reconstruct a > backtrace, because you cannot infer from the value of `$fp' where to > retrieve the value of `$ra' from. For that you need debug information. > > So the information you quote seems misleading or missing the context. > > NB hardly any MIPS software uses the frame pointer register and all is > debuggable regardless; the only actual use for $fp is `alloca', VLAs or > similar dynamic frame arrangements. > > So what actual problem are you trying to solve, except for the assembly > error, and what is your use case for `$fp' with MIPS kernel debugging? Hi Maciej, Thank you very much for your reply and detailed explanation. The initial aim of this patch is to fix the build error. I found this build error used with gcc 4.9.4. I try it used with gcc 7.3.1 and it has no problem. We can use new gcc version to avoid this build error. The other commit message about config and kgdb seems no related with the above build error, just give more info to discuss. As I see it now, this RFC patch is meaningless, so please ignore it and thank you again. Thanks, Tiezhu > > Maciej