From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Donglin Peng <pengdonglin@sangfor.com.cn>
Cc: mhiramat@kernel.org, rostedt@goodmis.org, mark.rutland@arm.com,
will@kernel.org, catalin.marinas@arm.com, palmer@dabbelt.com,
paul.walmsley@sifive.com, tglx@linutronix.de,
dave.hansen@linux.intel.com, x86@kernel.org, mingo@redhat.com,
xiehuan09@gmail.com, dinghui@sangfor.com.cn,
huangcun@sangfor.com.cn, dolinux.peng@gmail.com,
linux-trace-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/2] function_graph: Support recording and printing the return value of function
Date: Thu, 16 Mar 2023 23:21:07 +0000 [thread overview]
Message-ID: <ZBOkY8FkqgoBfzQ2@shell.armlinux.org.uk> (raw)
In-Reply-To: <20230315133911.958741-2-pengdonglin@sangfor.com.cn>
On Wed, Mar 15, 2023 at 06:39:10AM -0700, Donglin Peng wrote:
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index e24a9820e12f..ad03fc868f34 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -99,6 +99,7 @@ config ARM
> select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
> select HAVE_FUNCTION_ERROR_INJECTION
> select HAVE_FUNCTION_GRAPH_TRACER
> + select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER
> select HAVE_FUNCTION_TRACER if !XIP_KERNEL
> select HAVE_GCC_PLUGINS
> select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
> diff --git a/arch/arm/kernel/entry-ftrace.S b/arch/arm/kernel/entry-ftrace.S
> index 3e7bcaca5e07..0151d2ce9958 100644
> --- a/arch/arm/kernel/entry-ftrace.S
> +++ b/arch/arm/kernel/entry-ftrace.S
> @@ -258,6 +258,10 @@ ENDPROC(ftrace_graph_regs_caller)
> #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> ENTRY(return_to_handler)
> stmdb sp!, {r0-r3}
> +#ifdef CONFIG_FUNCTION_GRAPH_RETVAL
> + /* Pass the function return value to ftrace_return_to_handler */
> + mov r1, r0
In a similar vein to Peter's comment, do we care about 64-bit return
values here, because the above only covers 32-bit values.
If we do care about 64-bit values, then we get into EABI/OABI
stickyness, because on EABI the 64-bit value would have to be passed
in r2,r3, and OABI would need r1,r2.
it would be better to have the 64-bit argument as the first argument
to ftrace_return_to_handler() which would eliminate that variability,
but I don't know what effect that would have for other architectures.
Things get more icky if we want 128-bit values. For EABI, we've
conveniently just stacked that. For OABI, that would need to be in
r1-r3 and the final high bits on the stack.
With a 128-bit argument as the first, that would be r0-r3 with the
existing stack pointer argument stored... on the stack.
So, really it depends what size of return value we want to report.
Also, please bear in mind that where a function returns a 32-bit
value, that will be in r0, and r1 will be whatever happened to be
in it at function exit - there's no defined value for r1.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Donglin Peng <pengdonglin@sangfor.com.cn>
Cc: mhiramat@kernel.org, rostedt@goodmis.org, mark.rutland@arm.com,
will@kernel.org, catalin.marinas@arm.com, palmer@dabbelt.com,
paul.walmsley@sifive.com, tglx@linutronix.de,
dave.hansen@linux.intel.com, x86@kernel.org, mingo@redhat.com,
xiehuan09@gmail.com, dinghui@sangfor.com.cn,
huangcun@sangfor.com.cn, dolinux.peng@gmail.com,
linux-trace-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/2] function_graph: Support recording and printing the return value of function
Date: Thu, 16 Mar 2023 23:21:07 +0000 [thread overview]
Message-ID: <ZBOkY8FkqgoBfzQ2@shell.armlinux.org.uk> (raw)
In-Reply-To: <20230315133911.958741-2-pengdonglin@sangfor.com.cn>
On Wed, Mar 15, 2023 at 06:39:10AM -0700, Donglin Peng wrote:
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index e24a9820e12f..ad03fc868f34 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -99,6 +99,7 @@ config ARM
> select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
> select HAVE_FUNCTION_ERROR_INJECTION
> select HAVE_FUNCTION_GRAPH_TRACER
> + select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER
> select HAVE_FUNCTION_TRACER if !XIP_KERNEL
> select HAVE_GCC_PLUGINS
> select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
> diff --git a/arch/arm/kernel/entry-ftrace.S b/arch/arm/kernel/entry-ftrace.S
> index 3e7bcaca5e07..0151d2ce9958 100644
> --- a/arch/arm/kernel/entry-ftrace.S
> +++ b/arch/arm/kernel/entry-ftrace.S
> @@ -258,6 +258,10 @@ ENDPROC(ftrace_graph_regs_caller)
> #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> ENTRY(return_to_handler)
> stmdb sp!, {r0-r3}
> +#ifdef CONFIG_FUNCTION_GRAPH_RETVAL
> + /* Pass the function return value to ftrace_return_to_handler */
> + mov r1, r0
In a similar vein to Peter's comment, do we care about 64-bit return
values here, because the above only covers 32-bit values.
If we do care about 64-bit values, then we get into EABI/OABI
stickyness, because on EABI the 64-bit value would have to be passed
in r2,r3, and OABI would need r1,r2.
it would be better to have the 64-bit argument as the first argument
to ftrace_return_to_handler() which would eliminate that variability,
but I don't know what effect that would have for other architectures.
Things get more icky if we want 128-bit values. For EABI, we've
conveniently just stacked that. For OABI, that would need to be in
r1-r3 and the final high bits on the stack.
With a 128-bit argument as the first, that would be r0-r3 with the
existing stack pointer argument stored... on the stack.
So, really it depends what size of return value we want to report.
Also, please bear in mind that where a function returns a 32-bit
value, that will be in r0, and r1 will be whatever happened to be
in it at function exit - there's no defined value for r1.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Donglin Peng <pengdonglin@sangfor.com.cn>
Cc: mhiramat@kernel.org, rostedt@goodmis.org, mark.rutland@arm.com,
will@kernel.org, catalin.marinas@arm.com, palmer@dabbelt.com,
paul.walmsley@sifive.com, tglx@linutronix.de,
dave.hansen@linux.intel.com, x86@kernel.org, mingo@redhat.com,
xiehuan09@gmail.com, dinghui@sangfor.com.cn,
huangcun@sangfor.com.cn, dolinux.peng@gmail.com,
linux-trace-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/2] function_graph: Support recording and printing the return value of function
Date: Thu, 16 Mar 2023 23:21:07 +0000 [thread overview]
Message-ID: <ZBOkY8FkqgoBfzQ2@shell.armlinux.org.uk> (raw)
In-Reply-To: <20230315133911.958741-2-pengdonglin@sangfor.com.cn>
On Wed, Mar 15, 2023 at 06:39:10AM -0700, Donglin Peng wrote:
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index e24a9820e12f..ad03fc868f34 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -99,6 +99,7 @@ config ARM
> select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
> select HAVE_FUNCTION_ERROR_INJECTION
> select HAVE_FUNCTION_GRAPH_TRACER
> + select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER
> select HAVE_FUNCTION_TRACER if !XIP_KERNEL
> select HAVE_GCC_PLUGINS
> select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
> diff --git a/arch/arm/kernel/entry-ftrace.S b/arch/arm/kernel/entry-ftrace.S
> index 3e7bcaca5e07..0151d2ce9958 100644
> --- a/arch/arm/kernel/entry-ftrace.S
> +++ b/arch/arm/kernel/entry-ftrace.S
> @@ -258,6 +258,10 @@ ENDPROC(ftrace_graph_regs_caller)
> #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> ENTRY(return_to_handler)
> stmdb sp!, {r0-r3}
> +#ifdef CONFIG_FUNCTION_GRAPH_RETVAL
> + /* Pass the function return value to ftrace_return_to_handler */
> + mov r1, r0
In a similar vein to Peter's comment, do we care about 64-bit return
values here, because the above only covers 32-bit values.
If we do care about 64-bit values, then we get into EABI/OABI
stickyness, because on EABI the 64-bit value would have to be passed
in r2,r3, and OABI would need r1,r2.
it would be better to have the 64-bit argument as the first argument
to ftrace_return_to_handler() which would eliminate that variability,
but I don't know what effect that would have for other architectures.
Things get more icky if we want 128-bit values. For EABI, we've
conveniently just stacked that. For OABI, that would need to be in
r1-r3 and the final high bits on the stack.
With a 128-bit argument as the first, that would be r0-r3 with the
existing stack pointer argument stored... on the stack.
So, really it depends what size of return value we want to report.
Also, please bear in mind that where a function returns a 32-bit
value, that will be in r0, and r1 will be whatever happened to be
in it at function exit - there's no defined value for r1.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-03-16 23:21 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-15 13:39 [PATCH v4 0/2] function_graph: Support recording and printing the return value of function Donglin Peng
2023-03-15 13:39 ` Donglin Peng
2023-03-15 13:39 ` Donglin Peng
2023-03-15 13:39 ` [PATCH v4 1/2] " Donglin Peng
2023-03-15 13:39 ` Donglin Peng
2023-03-15 13:39 ` Donglin Peng
2023-03-15 13:49 ` Peter Zijlstra
2023-03-15 13:49 ` Peter Zijlstra
2023-03-15 13:49 ` Peter Zijlstra
2023-03-15 14:13 ` Steven Rostedt
2023-03-15 14:13 ` Steven Rostedt
2023-03-15 14:13 ` Steven Rostedt
2023-03-15 14:57 ` Peter Zijlstra
2023-03-15 14:57 ` Peter Zijlstra
2023-03-15 14:57 ` Peter Zijlstra
2023-03-16 3:18 ` Donglin Peng
2023-03-16 3:18 ` Donglin Peng
2023-03-16 3:18 ` Donglin Peng
2023-03-16 12:39 ` Masami Hiramatsu
2023-03-16 12:39 ` Masami Hiramatsu
2023-03-16 12:39 ` Masami Hiramatsu
2023-03-16 13:13 ` Donglin Peng
2023-03-16 13:13 ` Donglin Peng
2023-03-16 13:13 ` Donglin Peng
2023-03-16 23:21 ` Russell King (Oracle) [this message]
2023-03-16 23:21 ` Russell King (Oracle)
2023-03-16 23:21 ` Russell King (Oracle)
2023-03-17 2:49 ` Donglin Peng
2023-03-17 2:49 ` Donglin Peng
2023-03-17 2:49 ` Donglin Peng
2023-03-18 16:40 ` Steven Rostedt
2023-03-18 16:40 ` Steven Rostedt
2023-03-18 16:40 ` Steven Rostedt
2023-03-19 4:14 ` Donglin Peng
2023-03-19 4:14 ` Donglin Peng
2023-03-19 4:14 ` Donglin Peng
2023-03-15 13:39 ` [PATCH v4 2/2] tracing: Add documentation for funcgraph-retval and graph_retval_hex Donglin Peng
2023-03-15 13:39 ` Donglin Peng
2023-03-15 13:39 ` Donglin Peng
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=ZBOkY8FkqgoBfzQ2@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=catalin.marinas@arm.com \
--cc=dave.hansen@linux.intel.com \
--cc=dinghui@sangfor.com.cn \
--cc=dolinux.peng@gmail.com \
--cc=huangcun@sangfor.com.cn \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=pengdonglin@sangfor.com.cn \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--cc=x86@kernel.org \
--cc=xiehuan09@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.