Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1626630pxb; Fri, 20 Nov 2020 14:40:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8lwShnfsd4gpYP3M8Ldy0/jl75bsZr+gHKx/F2vKUfkzQuaSMHx19Hl8tRKEpYFPOzfNw X-Received: by 2002:a17:906:268c:: with SMTP id t12mr33373216ejc.377.1605912000789; Fri, 20 Nov 2020 14:40:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605912000; cv=none; d=google.com; s=arc-20160816; b=CD0OzS/qM7jZ9hBwUXc251bkCe6t0U0mMlL2sdHZfsuHUCJxbJ9EKfVNIqpC28kT42 bXAS6wuEAgU/MHjsisYRxm7FGXoBSM/GHawGyYUIAjde92bzb+2YtKpIiDWrka2FLBlj ZK81Vt4yhsKeByPrd5QGM1fM8YAqtH3v7x5mbomLEolsOQF2WByaP4A72unaF5DLm4j2 163nSVYtPOR6k6OCb9YcwikJSnD+RBdDCpGlNPDxN0kDMDLhV+uAzfpT6EU8kJNZ/PuO yfynlHbnRYarMhP4PjduedgTrd3kYh5sNRqNgr0tx0Rocvy37ZAlAJD3hNM+5qbt5rF9 GPGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date; bh=EmlGuIky/Qtzoy4+7HUHNh801J8mmkv12lle4lCGjfY=; b=H0k+9J3fQl5iIVSFU0D4LV4I6FXO77qEsm8EcM8vsEb47XfoFBVxDnOoywO+1uPMjQ OeslK6p3vOWGjvTDIcF6t/Q3HqNb/kWvpAhiRVWp2uqMwhgkK0CTRB3PnnFriTnIfvsf 8BKnxUhUPKbiZc0zo/U3aahMlIfxq+5yi+LghSv1hJ96ZHX+P54D503vmn6NcoZNq4vy I09hkM6vlyhDy9zCvIO8VcBHywLu4U7ZM5X8XoQObUs3IhOK/2Rt4KQMMFzf3MBvdszX ataYJfmrOLC7auUs1B2S3QjEKAF6LwUUpMkiW/tuk/1qFt3/Xn51dvuj7URd34bLMzwR HxAg== 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 j10si2564448edt.142.2020.11.20.14.39.38; Fri, 20 Nov 2020 14:40:00 -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 S1728587AbgKTWhw (ORCPT + 99 others); Fri, 20 Nov 2020 17:37:52 -0500 Received: from [157.25.102.26] ([157.25.102.26]:40570 "EHLO orcam.me.uk" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726255AbgKTWhv (ORCPT ); Fri, 20 Nov 2020 17:37:51 -0500 Received: from bugs.linux-mips.org (eddie.linux-mips.org [IPv6:2a01:4f8:201:92aa::3]) by orcam.me.uk (Postfix) with ESMTPS id 011112BE0EC; Fri, 20 Nov 2020 22:37:47 +0000 (GMT) Date: Fri, 20 Nov 2020 22:37:44 +0000 (GMT) From: "Maciej W. Rozycki" To: Tiezhu Yang cc: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li Subject: Re: [RFC PATCH] MIPS: Kconfig: Select ARCH_WANT_FRAME_POINTERS In-Reply-To: <1605502980-31946-1-git-send-email-yangtiezhu@loongson.cn> Message-ID: References: <1605502980-31946-1-git-send-email-yangtiezhu@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Maciej