linux-toolchains.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Indu Bhagat <indu.bhagat@oracle.com>
To: linux-toolchains@vger.kernel.org, rostedt@goodmis.org,
	peterz@infradead.org
Cc: Indu Bhagat <indu.bhagat@oracle.com>
Subject: [POC,V2 1/5] Kconfig: x86: Add new config options for userspace unwinder
Date: Thu, 25 May 2023 22:32:11 -0700	[thread overview]
Message-ID: <20230526053215.3617580-2-indu.bhagat@oracle.com> (raw)
In-Reply-To: <20230526053215.3617580-1-indu.bhagat@oracle.com>

[Changes in V2]
  - No changes.
[End of changes in V2]

Add two config options for userspace unwinding:
  - config USER_UNWINDER_SFRAME to enable the SFrame userspace unwinder,
  - config USER_UNWINDER_FRAME_POINTER to enable the Frame Pointer
    userspace unwinder.

As users may still compile their applications without SFrame sections,
the userspace stack tracer falls back on the frame-pointer based
approach (if SFrame section is not present for the user program).  If an
SFrame section is absent for a subset of the running program (e.g. a
DSO), a best-effort SFrame section based stack trace is returned.

TODO - may be rename the existing CONFIG_UNWINDER_FRAME_POINTER etc. for
the kernel space unwinder to CONFIG_KERNEL_UNWINDER_FRAME_POINTER? WDYT?

Signed-off-by: Indu Bhagat <indu.bhagat@oracle.com>
---
 arch/x86/Kconfig.debug | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index c5d614d28a75..e7f928dc8d9f 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -275,3 +275,34 @@ endchoice
 config FRAME_POINTER
 	depends on !UNWINDER_ORC && !UNWINDER_GUESS
 	bool
+
+choice
+	prompt "Choose userspace unwinder"
+	default USER_UNWINDER_SFRAME if X86_64
+	default USER_UNWINDER_FRAME_POINTER if !X86_64
+	help
+	  This determines which method will be used for unwinding user stack
+	  traces.
+
+config USER_UNWINDER_SFRAME
+	bool "SFrame userspace unwinder"
+	depends on X86_64
+	help
+	  This option enables the SFrame unwinder for unwinding user stack
+	  traces.
+
+	  User programs must be built with SFrame support. If not, no SFrame
+	  section will be present in the user program binary; in such a case,
+	  the userspace unwinder defaults to frame pointer unwinding.
+
+
+config USER_UNWINDER_FRAME_POINTER
+	bool "Frame pointer userspace unwinder"
+	help
+	  This option enables the frame pointer unwinder for unwinding user
+	  stack traces.
+
+	  On some architectures, user programs must be built with
+	  -fno-omit-frame-pointer to ensure useful stack traces.
+
+endchoice
-- 
2.39.2


  reply	other threads:[~2023-05-26  5:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26  5:32 [POC,V2 0/5] SFrame based stack tracer for user space in the kernel Indu Bhagat
2023-05-26  5:32 ` Indu Bhagat [this message]
2023-05-26  5:32 ` [POC,V2 2/5] task_struct : add additional member for sframe state Indu Bhagat
2023-05-26  5:32 ` [POC,V2 3/5] sframe: add new SFrame library Indu Bhagat
2023-05-26  5:32 ` [POC,V2 4/5] sframe: add an SFrame format stack tracer Indu Bhagat
2023-05-26  5:32 ` [POC,V2 5/5] x86_64: invoke SFrame based stack tracer for user space Indu Bhagat
2023-05-26  7:56 ` [POC,V2 0/5] SFrame based stack tracer for user space in the kernel Steven Rostedt

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=20230526053215.3617580-2-indu.bhagat@oracle.com \
    --to=indu.bhagat@oracle.com \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    /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).