linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] riscv: fix patching with IPI
@ 2024-02-29 12:10 Alexandre Ghiti
  2024-02-29 12:10 ` [PATCH v3 1/2] riscv: Remove superfluous smp_mb() Alexandre Ghiti
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Alexandre Ghiti @ 2024-02-29 12:10 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Andrea Parri,
	Samuel Holland, Anup Patel, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, linux-riscv, linux-kernel, linux-trace-kernel
  Cc: Alexandre Ghiti

patch 1 removes a useless memory barrier and patch 2 actually fixes the
issue with IPI in the patching code.

Changes in v3:
- Remove wrong cleanup as noted by Samuel
- Enhance comment about usage of release semantics as suggested by
  Andrea
- Add RBs from Andrea

Changes in v2:
- Add patch 1 and then remove the memory barrier from patch 2 as
  suggested by Andrea
- Convert atomic_inc into an atomic_inc with release semantics as
  suggested by Andrea

Alexandre Ghiti (2):
  riscv: Remove superfluous smp_mb()
  riscv: Fix text patching when IPI are used

 arch/riscv/include/asm/patch.h |  1 +
 arch/riscv/kernel/ftrace.c     | 44 ++++++++++++++++++++++++++++++----
 arch/riscv/kernel/patch.c      | 17 +++++++++----
 3 files changed, 53 insertions(+), 9 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v3 1/2] riscv: Remove superfluous smp_mb()
  2024-02-29 12:10 [PATCH v3 0/2] riscv: fix patching with IPI Alexandre Ghiti
@ 2024-02-29 12:10 ` Alexandre Ghiti
  2024-03-04 19:25   ` Conor Dooley
  2024-02-29 12:10 ` [PATCH v3 2/2] riscv: Fix text patching when IPI are used Alexandre Ghiti
  2024-04-28 22:00 ` [PATCH v3 0/2] riscv: fix patching with IPI patchwork-bot+linux-riscv
  2 siblings, 1 reply; 11+ messages in thread
From: Alexandre Ghiti @ 2024-02-29 12:10 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Andrea Parri,
	Samuel Holland, Anup Patel, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, linux-riscv, linux-kernel, linux-trace-kernel
  Cc: Alexandre Ghiti, Andrea Parri

This memory barrier is not needed and not documented so simply remove
it.

Suggested-by: Andrea Parri <andrea@rivosinc.com>
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Andrea Parri <parri.andrea@gmail.com>
---
 arch/riscv/kernel/patch.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/riscv/kernel/patch.c b/arch/riscv/kernel/patch.c
index 37e87fdcf6a0..0b5c16dfe3f4 100644
--- a/arch/riscv/kernel/patch.c
+++ b/arch/riscv/kernel/patch.c
@@ -239,7 +239,6 @@ static int patch_text_cb(void *data)
 	} else {
 		while (atomic_read(&patch->cpu_count) <= num_online_cpus())
 			cpu_relax();
-		smp_mb();
 	}
 
 	return ret;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 2/2] riscv: Fix text patching when IPI are used
  2024-02-29 12:10 [PATCH v3 0/2] riscv: fix patching with IPI Alexandre Ghiti
  2024-02-29 12:10 ` [PATCH v3 1/2] riscv: Remove superfluous smp_mb() Alexandre Ghiti
@ 2024-02-29 12:10 ` Alexandre Ghiti
  2024-03-04 19:27   ` Conor Dooley
  2024-04-28 22:00 ` [PATCH v3 0/2] riscv: fix patching with IPI patchwork-bot+linux-riscv
  2 siblings, 1 reply; 11+ messages in thread
From: Alexandre Ghiti @ 2024-02-29 12:10 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Andrea Parri,
	Samuel Holland, Anup Patel, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, linux-riscv, linux-kernel, linux-trace-kernel
  Cc: Alexandre Ghiti, Björn Töpel, Andrea Parri

For now, we use stop_machine() to patch the text and when we use IPIs for
remote icache flushes (which is emitted in patch_text_nosync()), the system
hangs.

So instead, make sure every CPU executes the stop_machine() patching
function and emit a local icache flush there.

Co-developed-by: Björn Töpel <bjorn@rivosinc.com>
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Andrea Parri <parri.andrea@gmail.com>
---
 arch/riscv/include/asm/patch.h |  1 +
 arch/riscv/kernel/ftrace.c     | 44 ++++++++++++++++++++++++++++++----
 arch/riscv/kernel/patch.c      | 16 +++++++++----
 3 files changed, 53 insertions(+), 8 deletions(-)

diff --git a/arch/riscv/include/asm/patch.h b/arch/riscv/include/asm/patch.h
index e88b52d39eac..9f5d6e14c405 100644
--- a/arch/riscv/include/asm/patch.h
+++ b/arch/riscv/include/asm/patch.h
@@ -6,6 +6,7 @@
 #ifndef _ASM_RISCV_PATCH_H
 #define _ASM_RISCV_PATCH_H
 
+int patch_insn_write(void *addr, const void *insn, size_t len);
 int patch_text_nosync(void *addr, const void *insns, size_t len);
 int patch_text_set_nosync(void *addr, u8 c, size_t len);
 int patch_text(void *addr, u32 *insns, int ninsns);
diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c
index f5aa24d9e1c1..4f4987a6d83d 100644
--- a/arch/riscv/kernel/ftrace.c
+++ b/arch/riscv/kernel/ftrace.c
@@ -8,6 +8,7 @@
 #include <linux/ftrace.h>
 #include <linux/uaccess.h>
 #include <linux/memory.h>
+#include <linux/stop_machine.h>
 #include <asm/cacheflush.h>
 #include <asm/patch.h>
 
@@ -75,8 +76,7 @@ static int __ftrace_modify_call(unsigned long hook_pos, unsigned long target,
 		make_call_t0(hook_pos, target, call);
 
 	/* Replace the auipc-jalr pair at once. Return -EPERM on write error. */
-	if (patch_text_nosync
-	    ((void *)hook_pos, enable ? call : nops, MCOUNT_INSN_SIZE))
+	if (patch_insn_write((void *)hook_pos, enable ? call : nops, MCOUNT_INSN_SIZE))
 		return -EPERM;
 
 	return 0;
@@ -88,7 +88,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
 
 	make_call_t0(rec->ip, addr, call);
 
-	if (patch_text_nosync((void *)rec->ip, call, MCOUNT_INSN_SIZE))
+	if (patch_insn_write((void *)rec->ip, call, MCOUNT_INSN_SIZE))
 		return -EPERM;
 
 	return 0;
@@ -99,7 +99,7 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,
 {
 	unsigned int nops[2] = {NOP4, NOP4};
 
-	if (patch_text_nosync((void *)rec->ip, nops, MCOUNT_INSN_SIZE))
+	if (patch_insn_write((void *)rec->ip, nops, MCOUNT_INSN_SIZE))
 		return -EPERM;
 
 	return 0;
@@ -134,6 +134,42 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
 
 	return ret;
 }
+
+struct ftrace_modify_param {
+	int command;
+	atomic_t cpu_count;
+};
+
+static int __ftrace_modify_code(void *data)
+{
+	struct ftrace_modify_param *param = data;
+
+	if (atomic_inc_return(&param->cpu_count) == num_online_cpus()) {
+		ftrace_modify_all_code(param->command);
+		/*
+		 * Make sure the patching store is effective *before* we
+		 * increment the counter which releases all waiting CPUs
+		 * by using the release variant of atomic increment. The
+		 * release pairs with the call to local_flush_icache_all()
+		 * on the waiting CPU.
+		 */
+		atomic_inc_return_release(&param->cpu_count);
+	} else {
+		while (atomic_read(&param->cpu_count) <= num_online_cpus())
+			cpu_relax();
+	}
+
+	local_flush_icache_all();
+
+	return 0;
+}
+
+void arch_ftrace_update_code(int command)
+{
+	struct ftrace_modify_param param = { command, ATOMIC_INIT(0) };
+
+	stop_machine(__ftrace_modify_code, &param, cpu_online_mask);
+}
 #endif
 
 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
diff --git a/arch/riscv/kernel/patch.c b/arch/riscv/kernel/patch.c
index 0b5c16dfe3f4..9a1bce1adf5a 100644
--- a/arch/riscv/kernel/patch.c
+++ b/arch/riscv/kernel/patch.c
@@ -188,7 +188,7 @@ int patch_text_set_nosync(void *addr, u8 c, size_t len)
 }
 NOKPROBE_SYMBOL(patch_text_set_nosync);
 
-static int patch_insn_write(void *addr, const void *insn, size_t len)
+int patch_insn_write(void *addr, const void *insn, size_t len)
 {
 	size_t patched = 0;
 	size_t size;
@@ -232,15 +232,23 @@ static int patch_text_cb(void *data)
 	if (atomic_inc_return(&patch->cpu_count) == num_online_cpus()) {
 		for (i = 0; ret == 0 && i < patch->ninsns; i++) {
 			len = GET_INSN_LENGTH(patch->insns[i]);
-			ret = patch_text_nosync(patch->addr + i * len,
-						&patch->insns[i], len);
+			ret = patch_insn_write(patch->addr + i * len, &patch->insns[i], len);
 		}
-		atomic_inc(&patch->cpu_count);
+		/*
+		 * Make sure the patching store is effective *before* we
+		 * increment the counter which releases all waiting CPUs
+		 * by using the release variant of atomic increment. The
+		 * release pairs with the call to local_flush_icache_all()
+		 * on the waiting CPU.
+		 */
+		atomic_inc_return_release(&patch->cpu_count);
 	} else {
 		while (atomic_read(&patch->cpu_count) <= num_online_cpus())
 			cpu_relax();
 	}
 
+	local_flush_icache_all();
+
 	return ret;
 }
 NOKPROBE_SYMBOL(patch_text_cb);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 1/2] riscv: Remove superfluous smp_mb()
  2024-02-29 12:10 ` [PATCH v3 1/2] riscv: Remove superfluous smp_mb() Alexandre Ghiti
@ 2024-03-04 19:25   ` Conor Dooley
  2024-04-17  1:29     ` Palmer Dabbelt
  0 siblings, 1 reply; 11+ messages in thread
From: Conor Dooley @ 2024-03-04 19:25 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Andrea Parri,
	Samuel Holland, Anup Patel, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, linux-riscv, linux-kernel, linux-trace-kernel,
	Andrea Parri

[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]

On Thu, Feb 29, 2024 at 01:10:55PM +0100, Alexandre Ghiti wrote:
> This memory barrier is not needed and not documented so simply remove
> it.

This looks like it should be patch 2 in the series, not patch 1, as it
is cleanup rather than a fix that needs backporting.

> 
> Suggested-by: Andrea Parri <andrea@rivosinc.com>
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> Reviewed-by: Andrea Parri <parri.andrea@gmail.com>
> ---
>  arch/riscv/kernel/patch.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/riscv/kernel/patch.c b/arch/riscv/kernel/patch.c
> index 37e87fdcf6a0..0b5c16dfe3f4 100644
> --- a/arch/riscv/kernel/patch.c
> +++ b/arch/riscv/kernel/patch.c
> @@ -239,7 +239,6 @@ static int patch_text_cb(void *data)
>  	} else {
>  		while (atomic_read(&patch->cpu_count) <= num_online_cpus())
>  			cpu_relax();
> -		smp_mb();
>  	}
>  
>  	return ret;
> -- 
> 2.39.2
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 2/2] riscv: Fix text patching when IPI are used
  2024-02-29 12:10 ` [PATCH v3 2/2] riscv: Fix text patching when IPI are used Alexandre Ghiti
@ 2024-03-04 19:27   ` Conor Dooley
  2024-03-04 20:24     ` Björn Töpel
  0 siblings, 1 reply; 11+ messages in thread
From: Conor Dooley @ 2024-03-04 19:27 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Andrea Parri,
	Samuel Holland, Anup Patel, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, linux-riscv, linux-kernel, linux-trace-kernel,
	Björn Töpel, Andrea Parri

[-- Attachment #1: Type: text/plain, Size: 610 bytes --]

On Thu, Feb 29, 2024 at 01:10:56PM +0100, Alexandre Ghiti wrote:
> For now, we use stop_machine() to patch the text and when we use IPIs for
> remote icache flushes (which is emitted in patch_text_nosync()), the system
> hangs.
> 
> So instead, make sure every CPU executes the stop_machine() patching
> function and emit a local icache flush there.
> 
> Co-developed-by: Björn Töpel <bjorn@rivosinc.com>
> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> Reviewed-by: Andrea Parri <parri.andrea@gmail.com>

What commit does this fix?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 2/2] riscv: Fix text patching when IPI are used
  2024-03-04 19:27   ` Conor Dooley
@ 2024-03-04 20:24     ` Björn Töpel
  2024-03-05  3:03       ` Anup Patel
  0 siblings, 1 reply; 11+ messages in thread
From: Björn Töpel @ 2024-03-04 20:24 UTC (permalink / raw)
  To: Conor Dooley, Alexandre Ghiti, Anup Patel
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Andrea Parri,
	Samuel Holland, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	linux-riscv, linux-kernel, linux-trace-kernel,
	Björn Töpel, Andrea Parri

Conor Dooley <conor@kernel.org> writes:

> On Thu, Feb 29, 2024 at 01:10:56PM +0100, Alexandre Ghiti wrote:
>> For now, we use stop_machine() to patch the text and when we use IPIs for
>> remote icache flushes (which is emitted in patch_text_nosync()), the system
>> hangs.
>> 
>> So instead, make sure every CPU executes the stop_machine() patching
>> function and emit a local icache flush there.
>> 
>> Co-developed-by: Björn Töpel <bjorn@rivosinc.com>
>> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
>> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
>> Reviewed-by: Andrea Parri <parri.andrea@gmail.com>
>
> What commit does this fix?

Hmm. The bug is exposed when the AIA IPI are introduced, and used
(instead of the firmware-based).

I'm not sure this is something we'd like backported, but rather a
prerequisite to AIA.

@Anup @Alex WDYT?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 2/2] riscv: Fix text patching when IPI are used
  2024-03-04 20:24     ` Björn Töpel
@ 2024-03-05  3:03       ` Anup Patel
  2024-03-05  7:59         ` Conor Dooley
  0 siblings, 1 reply; 11+ messages in thread
From: Anup Patel @ 2024-03-05  3:03 UTC (permalink / raw)
  To: Björn Töpel
  Cc: Conor Dooley, Alexandre Ghiti, Anup Patel, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Andrea Parri, Samuel Holland,
	Steven Rostedt, Masami Hiramatsu, Mark Rutland, linux-riscv,
	linux-kernel, linux-trace-kernel, Björn Töpel,
	Andrea Parri

On Tue, Mar 5, 2024 at 1:54 AM Björn Töpel <bjorn@kernel.org> wrote:
>
> Conor Dooley <conor@kernel.org> writes:
>
> > On Thu, Feb 29, 2024 at 01:10:56PM +0100, Alexandre Ghiti wrote:
> >> For now, we use stop_machine() to patch the text and when we use IPIs for
> >> remote icache flushes (which is emitted in patch_text_nosync()), the system
> >> hangs.
> >>
> >> So instead, make sure every CPU executes the stop_machine() patching
> >> function and emit a local icache flush there.
> >>
> >> Co-developed-by: Björn Töpel <bjorn@rivosinc.com>
> >> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
> >> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> >> Reviewed-by: Andrea Parri <parri.andrea@gmail.com>
> >
> > What commit does this fix?
>
> Hmm. The bug is exposed when the AIA IPI are introduced, and used
> (instead of the firmware-based).
>
> I'm not sure this is something we'd like backported, but rather a
> prerequisite to AIA.
>
> @Anup @Alex WDYT?
>

The current text patching never considered IPIs being injected
directly in S-mode from hart to another so we are seeing this
issue now with AIA IPIs.

We certainly don't need to backport this fix since it's more
of a preparatory fix for AIA IPIs.

Regards,
Anup

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 2/2] riscv: Fix text patching when IPI are used
  2024-03-05  3:03       ` Anup Patel
@ 2024-03-05  7:59         ` Conor Dooley
  2024-03-05  8:21           ` Björn Töpel
  0 siblings, 1 reply; 11+ messages in thread
From: Conor Dooley @ 2024-03-05  7:59 UTC (permalink / raw)
  To: Anup Patel
  Cc: Björn Töpel, Conor Dooley, Alexandre Ghiti, Anup Patel,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Andrea Parri,
	Samuel Holland, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	linux-riscv, linux-kernel, linux-trace-kernel,
	Björn Töpel, Andrea Parri

[-- Attachment #1: Type: text/plain, Size: 1558 bytes --]

On Tue, Mar 05, 2024 at 08:33:30AM +0530, Anup Patel wrote:
> On Tue, Mar 5, 2024 at 1:54 AM Björn Töpel <bjorn@kernel.org> wrote:
> >
> > Conor Dooley <conor@kernel.org> writes:
> >
> > > On Thu, Feb 29, 2024 at 01:10:56PM +0100, Alexandre Ghiti wrote:
> > >> For now, we use stop_machine() to patch the text and when we use IPIs for
> > >> remote icache flushes (which is emitted in patch_text_nosync()), the system
> > >> hangs.
> > >>
> > >> So instead, make sure every CPU executes the stop_machine() patching
> > >> function and emit a local icache flush there.
> > >>
> > >> Co-developed-by: Björn Töpel <bjorn@rivosinc.com>
> > >> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
> > >> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> > >> Reviewed-by: Andrea Parri <parri.andrea@gmail.com>
> > >
> > > What commit does this fix?
> >
> > Hmm. The bug is exposed when the AIA IPI are introduced, and used
> > (instead of the firmware-based).
> >
> > I'm not sure this is something we'd like backported, but rather a
> > prerequisite to AIA.
> >
> > @Anup @Alex WDYT?
> >
> 
> The current text patching never considered IPIs being injected
> directly in S-mode from hart to another so we are seeing this
> issue now with AIA IPIs.
> 
> We certainly don't need to backport this fix since it's more
> of a preparatory fix for AIA IPIs.

Whether or not this is backportable, if it fixes a bug, it should get
a Fixes: tag for the commit that it fixes. Fixes: isn't "the backport"
tag, cc: stable is.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 2/2] riscv: Fix text patching when IPI are used
  2024-03-05  7:59         ` Conor Dooley
@ 2024-03-05  8:21           ` Björn Töpel
  0 siblings, 0 replies; 11+ messages in thread
From: Björn Töpel @ 2024-03-05  8:21 UTC (permalink / raw)
  To: Conor Dooley, Anup Patel
  Cc: Conor Dooley, Alexandre Ghiti, Anup Patel, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Andrea Parri, Samuel Holland,
	Steven Rostedt, Masami Hiramatsu, Mark Rutland, linux-riscv,
	linux-kernel, linux-trace-kernel, Björn Töpel,
	Andrea Parri

Conor Dooley <conor.dooley@microchip.com> writes:

> On Tue, Mar 05, 2024 at 08:33:30AM +0530, Anup Patel wrote:
>> On Tue, Mar 5, 2024 at 1:54 AM Björn Töpel <bjorn@kernel.org> wrote:
>> >
>> > Conor Dooley <conor@kernel.org> writes:
>> >
>> > > On Thu, Feb 29, 2024 at 01:10:56PM +0100, Alexandre Ghiti wrote:
>> > >> For now, we use stop_machine() to patch the text and when we use IPIs for
>> > >> remote icache flushes (which is emitted in patch_text_nosync()), the system
>> > >> hangs.
>> > >>
>> > >> So instead, make sure every CPU executes the stop_machine() patching
>> > >> function and emit a local icache flush there.
>> > >>
>> > >> Co-developed-by: Björn Töpel <bjorn@rivosinc.com>
>> > >> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
>> > >> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
>> > >> Reviewed-by: Andrea Parri <parri.andrea@gmail.com>
>> > >
>> > > What commit does this fix?
>> >
>> > Hmm. The bug is exposed when the AIA IPI are introduced, and used
>> > (instead of the firmware-based).
>> >
>> > I'm not sure this is something we'd like backported, but rather a
>> > prerequisite to AIA.
>> >
>> > @Anup @Alex WDYT?
>> >
>> 
>> The current text patching never considered IPIs being injected
>> directly in S-mode from hart to another so we are seeing this
>> issue now with AIA IPIs.
>> 
>> We certainly don't need to backport this fix since it's more
>> of a preparatory fix for AIA IPIs.
>
> Whether or not this is backportable, if it fixes a bug, it should get
> a Fixes: tag for the commit that it fixes. Fixes: isn't "the backport"
> tag, cc: stable is.

I guess the question is if this *is* a fix, or rather a change required
for AIA (not a fix).

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 1/2] riscv: Remove superfluous smp_mb()
  2024-03-04 19:25   ` Conor Dooley
@ 2024-04-17  1:29     ` Palmer Dabbelt
  0 siblings, 0 replies; 11+ messages in thread
From: Palmer Dabbelt @ 2024-04-17  1:29 UTC (permalink / raw)
  To: Conor Dooley
  Cc: alexghiti, Paul Walmsley, aou, Andrea Parri, samuel.holland, anup,
	rostedt, mhiramat, Mark Rutland, linux-riscv, linux-kernel,
	linux-trace-kernel, parri.andrea

On Mon, 04 Mar 2024 11:25:33 PST (-0800), Conor Dooley wrote:
> On Thu, Feb 29, 2024 at 01:10:55PM +0100, Alexandre Ghiti wrote:
>> This memory barrier is not needed and not documented so simply remove
>> it.
>
> This looks like it should be patch 2 in the series, not patch 1, as it
> is cleanup rather than a fix that needs backporting.

IIUC neither is actually a fix, as the other is only exposed by the 
IOMMU driver and that's not upstream yet.  So I'm just going to pick 
these up on for-next.

>
>> 
>> Suggested-by: Andrea Parri <andrea@rivosinc.com>
>> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
>> Reviewed-by: Andrea Parri <parri.andrea@gmail.com>
>> ---
>>  arch/riscv/kernel/patch.c | 1 -
>>  1 file changed, 1 deletion(-)
>> 
>> diff --git a/arch/riscv/kernel/patch.c b/arch/riscv/kernel/patch.c
>> index 37e87fdcf6a0..0b5c16dfe3f4 100644
>> --- a/arch/riscv/kernel/patch.c
>> +++ b/arch/riscv/kernel/patch.c
>> @@ -239,7 +239,6 @@ static int patch_text_cb(void *data)
>>  	} else {
>>  		while (atomic_read(&patch->cpu_count) <= num_online_cpus())
>>  			cpu_relax();
>> -		smp_mb();
>>  	}
>>  
>>  	return ret;
>> -- 
>> 2.39.2
>> 
>> 
>> _______________________________________________
>> linux-riscv mailing list
>> linux-riscv@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 0/2] riscv: fix patching with IPI
  2024-02-29 12:10 [PATCH v3 0/2] riscv: fix patching with IPI Alexandre Ghiti
  2024-02-29 12:10 ` [PATCH v3 1/2] riscv: Remove superfluous smp_mb() Alexandre Ghiti
  2024-02-29 12:10 ` [PATCH v3 2/2] riscv: Fix text patching when IPI are used Alexandre Ghiti
@ 2024-04-28 22:00 ` patchwork-bot+linux-riscv
  2 siblings, 0 replies; 11+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-04-28 22:00 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: linux-riscv, paul.walmsley, palmer, aou, andrea, samuel.holland,
	anup, rostedt, mhiramat, mark.rutland, linux-kernel,
	linux-trace-kernel

Hello:

This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Thu, 29 Feb 2024 13:10:54 +0100 you wrote:
> patch 1 removes a useless memory barrier and patch 2 actually fixes the
> issue with IPI in the patching code.
> 
> Changes in v3:
> - Remove wrong cleanup as noted by Samuel
> - Enhance comment about usage of release semantics as suggested by
>   Andrea
> - Add RBs from Andrea
> 
> [...]

Here is the summary with links:
  - [v3,1/2] riscv: Remove superfluous smp_mb()
    https://git.kernel.org/riscv/c/29cee75fb66e
  - [v3,2/2] riscv: Fix text patching when IPI are used
    https://git.kernel.org/riscv/c/c97bf629963e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-04-28 22:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-29 12:10 [PATCH v3 0/2] riscv: fix patching with IPI Alexandre Ghiti
2024-02-29 12:10 ` [PATCH v3 1/2] riscv: Remove superfluous smp_mb() Alexandre Ghiti
2024-03-04 19:25   ` Conor Dooley
2024-04-17  1:29     ` Palmer Dabbelt
2024-02-29 12:10 ` [PATCH v3 2/2] riscv: Fix text patching when IPI are used Alexandre Ghiti
2024-03-04 19:27   ` Conor Dooley
2024-03-04 20:24     ` Björn Töpel
2024-03-05  3:03       ` Anup Patel
2024-03-05  7:59         ` Conor Dooley
2024-03-05  8:21           ` Björn Töpel
2024-04-28 22:00 ` [PATCH v3 0/2] riscv: fix patching with IPI patchwork-bot+linux-riscv

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).