From: Mark Rutland <mark.rutland@arm.com>
To: Guo Ren <guoren@kernel.org>
Cc: anup@brainfault.org, paul.walmsley@sifive.com,
palmer@dabbelt.com, conor.dooley@microchip.com, heiko@sntech.de,
rostedt@goodmis.org, mhiramat@kernel.org, jolsa@redhat.com,
bp@suse.de, jpoimboe@kernel.org, suagrfillet@gmail.com,
andy.chiu@sifive.com, e.shatokhin@yadro.com,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next V6 1/7] riscv: ftrace: Fixup panic by disabling preemption
Date: Mon, 30 Jan 2023 11:17:13 +0000 [thread overview]
Message-ID: <Y9enOQUDsMbY1Y/f@FVFF77S0Q05N> (raw)
In-Reply-To: <CAJF2gTQXRt-mmuA=kKKdQojgLG-eQm6PqTuwf0ccw4cdYdbYfQ@mail.gmail.com>
On Sat, Jan 28, 2023 at 06:00:20PM +0800, Guo Ren wrote:
> On Thu, Jan 12, 2023 at 8:05 PM Mark Rutland <mark.rutland@arm.com> wrote:
> > Ignoring things which require HW changes, you could consider doing something
> > like what I'm doing for arm64 with DYNAMIC_FTRACE_WITH_CALL_OPS:
> >
> > https://lore.kernel.org/lkml/20230109135828.879136-1-mark.rutland@arm.com/
> The idea of DYNAMIC_FTRACE_WITH_CALL_OPS (Using data load/store +
> indirect jump instead of auipc+jalr) is similar to Andy's solution
> (See youtube link, last page of ppt).
Sure; I was present in that room and I spoke with Andy at the time.
The solutions are similar, but the important detail with
DYNAMIC_FTRACE_WITH_CALL_OPS is that the load and indirect branch is moved into
a common trampoline so that each call-site can be smaller. The ops pointer is
placed *before* the function entry point and doesn't need to be skipped with a
direct branch (which Andy's approach could also do if he aligned functions
similarly).
> But the key problem is you also expand the size of the prologue of the
> function. 64BIT is already expensive, and we can't afford more of it. I would
> change to seek a new atomic auipc+jalr ISA extension to solve this problem.
Sure, and that's nice for *new* hardware, but I'm talking about a solution
which works on *current* hardware.
> DYNAMIC_FTRACE_WITH_CALL_OPS would speed up ftrace_(regs)_caller (Mostly for
> kernel debug), but it won't help DYNAMIC_FTRACE_WITH_DIRECT_CALLS. So I do
> not so care about the ftrace_(regs)_caller performance gain.
Actually, the plan is that it *will* help DYNAMIC_FTRACE_WITH_DIRECT_CALLS; we
just didn't make all the necessary changes in one go.
Florent Revest is looking at implementing that by placing the direct call
pointer into the ops, so the common trampoline can load that directly.
He has an older draft available at:
https://github.com/FlorentRevest/linux/commits/indirect-direct-calls-3
... and since then, having spoken to Steven, we came up with a plan to make all
direct calls require an ops (which is the case for DIRECT_CALLS_MULTI), and
place a trampoline pointer in the ops.
That way, the common trampoline can do something like (in arm64 asm):
| LDR <tmp>, [<ops>, #OPS_TRAMP_PTR]
| CBNZ <tmp>, __call_tramp_directly
|
| // ... regular regs trampoline logic here
|
| __call_tramp_directly:
|
| // ... shuffle registers here
|
| BR <tmp>
... and I believe the same should work for riscv.
Thanks,
Mark.
next prev parent reply other threads:[~2023-01-30 11:18 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-07 13:35 [PATCH -next V6 0/7] riscv: Optimize function trace guoren
2023-01-07 13:35 ` [PATCH -next V6 1/7] riscv: ftrace: Fixup panic by disabling preemption guoren
2023-01-09 17:19 ` Mark Rutland
2023-01-11 13:22 ` Guo Ren
2023-01-12 12:05 ` Mark Rutland
2023-01-28 10:00 ` Guo Ren
2023-01-29 5:36 ` Guo Ren
2023-01-30 11:17 ` Mark Rutland [this message]
2023-02-07 2:31 ` Guo Ren
2023-01-07 13:35 ` [PATCH -next V6 2/7] riscv: ftrace: Remove wasted nops for !RISCV_ISA_C guoren
2023-01-07 13:35 ` [PATCH -next V6 3/7] riscv: ftrace: Reduce the detour code size to half guoren
2023-01-10 17:13 ` Evgenii Shatokhin
2023-01-11 9:58 ` Guo Ren
2023-01-07 13:35 ` [PATCH -next V6 4/7] riscv: ftrace: Add ftrace_graph_func guoren
2023-01-07 13:35 ` [PATCH -next V6 5/7] riscv: ftrace: Make ftrace_caller call ftrace_graph_func guoren
2023-01-10 17:16 ` Evgenii Shatokhin
2023-01-11 8:23 ` Guo Ren
2023-01-11 8:41 ` Guo Ren
2023-01-07 13:35 ` [PATCH -next V6 6/7] riscv: ftrace: Add DYNAMIC_FTRACE_WITH_DIRECT_CALLS support guoren
2023-01-07 13:35 ` [PATCH -next V6 7/7] samples: ftrace: Add riscv support for SAMPLE_FTRACE_DIRECT[_MULTI] guoren
2023-01-10 13:08 ` Evgenii Shatokhin
2023-01-10 13:50 ` Evgenii Shatokhin
2023-01-11 9:50 ` Song Shuai
2023-01-11 9:59 ` Guo Ren
2023-01-13 10:48 ` Song Shuai
2023-01-17 3:20 ` Guo Ren
2023-01-11 10:11 ` [PATCH -next V6 0/7] riscv: Optimize function trace Song Shuai
2023-01-11 14:03 ` Guo Ren
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=Y9enOQUDsMbY1Y/f@FVFF77S0Q05N \
--to=mark.rutland@arm.com \
--cc=andy.chiu@sifive.com \
--cc=anup@brainfault.org \
--cc=bp@suse.de \
--cc=conor.dooley@microchip.com \
--cc=e.shatokhin@yadro.com \
--cc=guoren@kernel.org \
--cc=heiko@sntech.de \
--cc=jolsa@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mhiramat@kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=rostedt@goodmis.org \
--cc=suagrfillet@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®