Re: [PATCH] riscv: Fix text patching when icache flushes use IPIs

2024-02-08 Thread Andrea Parri
> I did not even think of that, and it actually makes sense so I'll go > with what you propose: I'll replace atomic_inc() with > atomic_inc_return_release(). And I'll add the following comment if > that's ok with you: > > "Make sure the patching store is effective *before* we increment the > count

Re: [PATCH] riscv: Fix text patching when icache flushes use IPIs

2024-02-08 Thread Alexandre Ghiti
Hi Andrea, On Thu, Feb 8, 2024 at 12:42 PM Andrea Parri wrote: > > > +static int __ftrace_modify_code(void *data) > > +{ > > + struct ftrace_modify_param *param = data; > > + > > + if (atomic_inc_return(¶m->cpu_count) == num_online_cpus()) { > > + ftrace_modify_all_code(param-

Re: [PATCH] riscv: Fix text patching when icache flushes use IPIs

2024-02-08 Thread Andrea Parri
> +static int __ftrace_modify_code(void *data) > +{ > + struct ftrace_modify_param *param = data; > + > + if (atomic_inc_return(¶m->cpu_count) == num_online_cpus()) { > + ftrace_modify_all_code(param->command); > + atomic_inc(¶m->cpu_count); I stared at ftrace_modif

Re: [PATCH] riscv: Fix text patching when icache flushes use IPIs

2024-02-06 Thread Björn Töpel
Alexandre Ghiti writes: > For now, we use stop_machine() to patch the text and when we use IPIs for > remote icache flushes, the system hangs since the irqs are disabled on all > cpus. > > So instead, make sure every cpu executes the stop_machine() patching > function which emits a local icache f

[PATCH] riscv: Fix text patching when icache flushes use IPIs

2024-02-06 Thread Alexandre Ghiti
For now, we use stop_machine() to patch the text and when we use IPIs for remote icache flushes, the system hangs since the irqs are disabled on all cpus. So instead, make sure every cpu executes the stop_machine() patching function which emits a local icache flush and then avoids the use of IPIs.