All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charlie Jenkins <charlie@rivosinc.com>
To: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Andy Chiu <andy.chiu@sifive.com>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	Samuel Holland <samuel.holland@sifive.com>
Subject: Re: [PATCH -fixes v2] riscv: Re-introduce global icache flush in patch_text_XXX()
Date: Thu, 1 Aug 2024 19:24:32 -0700	[thread overview]
Message-ID: <ZqxDYF1OyIf40ZJA@ghost> (raw)
In-Reply-To: <20240801191404.55181-1-alexghiti@rivosinc.com>

On Thu, Aug 01, 2024 at 09:14:04PM +0200, Alexandre Ghiti wrote:
> commit edf2d546bfd6 ("riscv: patch: Flush the icache right after
> patching to avoid illegal insns") mistakenly removed the global icache
> flush in patch_text_nosync() and patch_text_set_nosync() functions, so
> reintroduce them.
> 
> Fixes: edf2d546bfd6 ("riscv: patch: Flush the icache right after patching to avoid illegal insns")
> Reported-by: Samuel Holland <samuel.holland@sifive.com>
> Closes: https://lore.kernel.org/linux-riscv/a28ddc26-d77a-470a-a33f-88144f717e86@sifive.com/
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>

> ---
>  arch/riscv/kernel/patch.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/riscv/kernel/patch.c b/arch/riscv/kernel/patch.c
> index 69e5796fc51f..34ef522f07a8 100644
> --- a/arch/riscv/kernel/patch.c
> +++ b/arch/riscv/kernel/patch.c
> @@ -205,6 +205,8 @@ int patch_text_set_nosync(void *addr, u8 c, size_t len)
>  	int ret;
>  
>  	ret = patch_insn_set(addr, c, len);
> +	if (!ret)
> +		flush_icache_range((uintptr_t)addr, (uintptr_t)addr + len);
>  
>  	return ret;
>  }
> @@ -239,6 +241,8 @@ int patch_text_nosync(void *addr, const void *insns, size_t len)
>  	int ret;
>  
>  	ret = patch_insn_write(addr, insns, len);
> +	if (!ret)
> +		flush_icache_range((uintptr_t)addr, (uintptr_t)addr + len);
>  
>  	return ret;
>  }
> -- 
> 2.39.2
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
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: Charlie Jenkins <charlie@rivosinc.com>
To: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Andy Chiu <andy.chiu@sifive.com>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	Samuel Holland <samuel.holland@sifive.com>
Subject: Re: [PATCH -fixes v2] riscv: Re-introduce global icache flush in patch_text_XXX()
Date: Thu, 1 Aug 2024 19:24:32 -0700	[thread overview]
Message-ID: <ZqxDYF1OyIf40ZJA@ghost> (raw)
In-Reply-To: <20240801191404.55181-1-alexghiti@rivosinc.com>

On Thu, Aug 01, 2024 at 09:14:04PM +0200, Alexandre Ghiti wrote:
> commit edf2d546bfd6 ("riscv: patch: Flush the icache right after
> patching to avoid illegal insns") mistakenly removed the global icache
> flush in patch_text_nosync() and patch_text_set_nosync() functions, so
> reintroduce them.
> 
> Fixes: edf2d546bfd6 ("riscv: patch: Flush the icache right after patching to avoid illegal insns")
> Reported-by: Samuel Holland <samuel.holland@sifive.com>
> Closes: https://lore.kernel.org/linux-riscv/a28ddc26-d77a-470a-a33f-88144f717e86@sifive.com/
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>

> ---
>  arch/riscv/kernel/patch.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/riscv/kernel/patch.c b/arch/riscv/kernel/patch.c
> index 69e5796fc51f..34ef522f07a8 100644
> --- a/arch/riscv/kernel/patch.c
> +++ b/arch/riscv/kernel/patch.c
> @@ -205,6 +205,8 @@ int patch_text_set_nosync(void *addr, u8 c, size_t len)
>  	int ret;
>  
>  	ret = patch_insn_set(addr, c, len);
> +	if (!ret)
> +		flush_icache_range((uintptr_t)addr, (uintptr_t)addr + len);
>  
>  	return ret;
>  }
> @@ -239,6 +241,8 @@ int patch_text_nosync(void *addr, const void *insns, size_t len)
>  	int ret;
>  
>  	ret = patch_insn_write(addr, insns, len);
> +	if (!ret)
> +		flush_icache_range((uintptr_t)addr, (uintptr_t)addr + len);
>  
>  	return ret;
>  }
> -- 
> 2.39.2
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2024-08-02  2:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 19:14 [PATCH -fixes v2] riscv: Re-introduce global icache flush in patch_text_XXX() Alexandre Ghiti
2024-08-01 19:14 ` Alexandre Ghiti
2024-08-01 19:20 ` Samuel Holland
2024-08-01 19:20   ` Samuel Holland
2024-08-02  2:24 ` Charlie Jenkins [this message]
2024-08-02  2:24   ` Charlie Jenkins
2024-08-06 20:28 ` patchwork-bot+linux-riscv
2024-08-06 20:28   ` patchwork-bot+linux-riscv

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=ZqxDYF1OyIf40ZJA@ghost \
    --to=charlie@rivosinc.com \
    --cc=alexghiti@rivosinc.com \
    --cc=andy.chiu@sifive.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=samuel.holland@sifive.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.