Message ID | 20220529143315.3678563-5-andy.chiu@sifive.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Enable ftrace with kernel preemption for RISC-V | expand |
On Sun, 29 May 2022 22:33:15 +0800 Andy Chiu <andy.chiu@sifive.com> wrote: > Now it is safe to remove dependency from stop_machine() to patch code in > ftrace. > I wasn't able to test it, and I don't know the intrinsic details of risc-v, but from the change logs and looking at the code from what I could understand, it all seems reasonable to me. For the entire patch set: Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org> -- Steve > Signed-off-by: Andy Chiu <andy.chiu@sifive.com> > Reviewed-by: Greentime Hu <greentime.hu@sifive.com> > Reviewed-by: Zong Li <zong.li@sifive.com> > --- > arch/riscv/kernel/ftrace.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c > index d4bf0e5255f6..e7b8bf0a699b 100644 > --- a/arch/riscv/kernel/ftrace.c > +++ b/arch/riscv/kernel/ftrace.c > @@ -12,6 +12,11 @@ > #include <asm/patch.h> > > #ifdef CONFIG_DYNAMIC_FTRACE > +void arch_ftrace_update_code(int command) > +{ > + ftrace_modify_all_code(command); > +} > + > int ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex) > { > mutex_lock(&text_mutex);
On Sun, 29 May 2022 07:33:15 PDT (-0700), andy.chiu@sifive.com wrote: > Now it is safe to remove dependency from stop_machine() to patch code in > ftrace. > > Signed-off-by: Andy Chiu <andy.chiu@sifive.com> > Reviewed-by: Greentime Hu <greentime.hu@sifive.com> > Reviewed-by: Zong Li <zong.li@sifive.com> > --- > arch/riscv/kernel/ftrace.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c > index d4bf0e5255f6..e7b8bf0a699b 100644 > --- a/arch/riscv/kernel/ftrace.c > +++ b/arch/riscv/kernel/ftrace.c > @@ -12,6 +12,11 @@ > #include <asm/patch.h> > > #ifdef CONFIG_DYNAMIC_FTRACE > +void arch_ftrace_update_code(int command) > +{ > + ftrace_modify_all_code(command); > +} > + > int ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex) > { > mutex_lock(&text_mutex); Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com> Assuming we sort out the issues in #3. IIUC we don't need to ensure the command is fully visible before returning, as the concurrent modification scheme doesn't flush the remote icaches and thus may skip instrumentation.
diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c index d4bf0e5255f6..e7b8bf0a699b 100644 --- a/arch/riscv/kernel/ftrace.c +++ b/arch/riscv/kernel/ftrace.c @@ -12,6 +12,11 @@ #include <asm/patch.h> #ifdef CONFIG_DYNAMIC_FTRACE +void arch_ftrace_update_code(int command) +{ + ftrace_modify_all_code(command); +} + int ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex) { mutex_lock(&text_mutex);