linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	Xuefeng Li <lixuefeng@loongson.cn>
Subject: Re: [RFC PATCH] MIPS: Kconfig: Select ARCH_WANT_FRAME_POINTERS
Date: Fri, 20 Nov 2020 22:37:44 +0000 (GMT)	[thread overview]
Message-ID: <alpine.LFD.2.21.2011202202290.656242@eddie.linux-mips.org> (raw)
In-Reply-To: <1605502980-31946-1-git-send-email-yangtiezhu@loongson.cn>

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

  parent reply	other threads:[~2020-11-20 22:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16  5:03 [RFC PATCH] MIPS: Kconfig: Select ARCH_WANT_FRAME_POINTERS Tiezhu Yang
2020-11-16  9:08 ` Sergei Shtylyov
2020-11-16  9:47   ` Tiezhu Yang
2020-11-16 10:09     ` Sergei Shtylyov
2020-11-20 22:37 ` Maciej W. Rozycki [this message]
2020-11-21  1:32   ` Tiezhu Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.21.2011202202290.656242@eddie.linux-mips.org \
    --to=macro@linux-mips.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=tsbogend@alpha.franken.de \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).