* [PATCH] RISC-V: Do not issue remote fences until smp is available @ 2022-10-28 23:19 Atish Patra 2022-10-31 19:11 ` Conor Dooley 0 siblings, 1 reply; 5+ messages in thread From: Atish Patra @ 2022-10-28 23:19 UTC (permalink / raw) To: linux-kernel Cc: Atish Patra, Albert Ou, Atish Patra, Anup Patel, Damien Le Moal, devicetree, Jisheng Zhang, Krzysztof Kozlowski, linux-riscv, Palmer Dabbelt, Paul Walmsley, Rob Herring It is useless to issue remote fences if there is a single core available. It becomes a bottleneck for sbi based rfences where we will be making those ECALLs for no reason. Early code patching because of static calls end up in this path. Signed-off-by: Atish Patra <atishp@rivosinc.com> --- arch/riscv/mm/cacheflush.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c index f10cb47eac3a..7fafc8c26505 100644 --- a/arch/riscv/mm/cacheflush.c +++ b/arch/riscv/mm/cacheflush.c @@ -19,6 +19,10 @@ void flush_icache_all(void) { local_flush_icache_all(); + /* No need to issue remote fence if only 1 cpu is online */ + if (num_online_cpus() == 1) + return; + if (IS_ENABLED(CONFIG_RISCV_SBI) && !riscv_use_ipi_for_rfence()) sbi_remote_fence_i(NULL); else -- 2.34.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] RISC-V: Do not issue remote fences until smp is available 2022-10-28 23:19 [PATCH] RISC-V: Do not issue remote fences until smp is available Atish Patra @ 2022-10-31 19:11 ` Conor Dooley 2022-10-31 19:26 ` Atish Patra 0 siblings, 1 reply; 5+ messages in thread From: Conor Dooley @ 2022-10-31 19:11 UTC (permalink / raw) To: Atish Patra Cc: linux-kernel, Albert Ou, Atish Patra, Anup Patel, Damien Le Moal, devicetree, Jisheng Zhang, Krzysztof Kozlowski, linux-riscv, Palmer Dabbelt, Paul Walmsley, Rob Herring On Fri, Oct 28, 2022 at 04:19:29PM -0700, Atish Patra wrote: > It is useless to issue remote fences if there is a single core > available. It becomes a bottleneck for sbi based rfences where > we will be making those ECALLs for no reason. Early code patching > because of static calls end up in this path. > > Signed-off-by: Atish Patra <atishp@rivosinc.com> Hey Atish, This doesn't apply for me to either fixes or for-next. What branch does it apply to? Thanks, Conor. > --- > arch/riscv/mm/cacheflush.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c > index f10cb47eac3a..7fafc8c26505 100644 > --- a/arch/riscv/mm/cacheflush.c > +++ b/arch/riscv/mm/cacheflush.c > @@ -19,6 +19,10 @@ void flush_icache_all(void) > { > local_flush_icache_all(); > > + /* No need to issue remote fence if only 1 cpu is online */ > + if (num_online_cpus() == 1) > + return; > + > if (IS_ENABLED(CONFIG_RISCV_SBI) && !riscv_use_ipi_for_rfence()) > sbi_remote_fence_i(NULL); > else > -- > 2.34.1 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] RISC-V: Do not issue remote fences until smp is available 2022-10-31 19:11 ` Conor Dooley @ 2022-10-31 19:26 ` Atish Patra 2022-11-10 21:42 ` Palmer Dabbelt 0 siblings, 1 reply; 5+ messages in thread From: Atish Patra @ 2022-10-31 19:26 UTC (permalink / raw) To: Conor Dooley Cc: Atish Patra, linux-kernel, Albert Ou, Anup Patel, Damien Le Moal, devicetree, Jisheng Zhang, Krzysztof Kozlowski, linux-riscv, Palmer Dabbelt, Paul Walmsley, Rob Herring On Mon, Oct 31, 2022 at 12:12 PM Conor Dooley <conor@kernel.org> wrote: > > On Fri, Oct 28, 2022 at 04:19:29PM -0700, Atish Patra wrote: > > It is useless to issue remote fences if there is a single core > > available. It becomes a bottleneck for sbi based rfences where > > we will be making those ECALLs for no reason. Early code patching > > because of static calls end up in this path. > > > > Signed-off-by: Atish Patra <atishp@rivosinc.com> > > Hey Atish, > This doesn't apply for me to either fixes or for-next. What branch does > it apply to? > Thanks, > Conor. > > > --- > > arch/riscv/mm/cacheflush.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c > > index f10cb47eac3a..7fafc8c26505 100644 > > --- a/arch/riscv/mm/cacheflush.c > > +++ b/arch/riscv/mm/cacheflush.c > > @@ -19,6 +19,10 @@ void flush_icache_all(void) > > { > > local_flush_icache_all(); > > > > + /* No need to issue remote fence if only 1 cpu is online */ > > + if (num_online_cpus() == 1) > > + return; > > + > > if (IS_ENABLED(CONFIG_RISCV_SBI) && !riscv_use_ipi_for_rfence()) > > sbi_remote_fence_i(NULL); > > else > > -- > > 2.34.1 > > Sorry I forgot to specify the dependencies for this patch. This patch is based on Anup's IPI series [1] as I assumed the IPI series would go first. I can rebase on top of the master if required. However, the issue will manifest only after Jisheng's patch[2] which moved the sbi_init to earlier and introduced the static key in the paging_init path. [1] https://patchwork.kernel.org/project/linux-riscv/patch/20220820065446.389788-8-apatel@ventanamicro.com/ [2] https://lore.kernel.org/lkml/20220716115059.3509-1-jszhang@kernel.org/ -- Regards, Atish ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] RISC-V: Do not issue remote fences until smp is available 2022-10-31 19:26 ` Atish Patra @ 2022-11-10 21:42 ` Palmer Dabbelt 2022-11-12 7:46 ` Atish Patra 0 siblings, 1 reply; 5+ messages in thread From: Palmer Dabbelt @ 2022-11-10 21:42 UTC (permalink / raw) To: atishp Cc: Conor Dooley, Atish Patra, linux-kernel, aou, anup, damien.lemoal, devicetree, jszhang, krzysztof.kozlowski, linux-riscv, Paul Walmsley, robh+dt On Mon, 31 Oct 2022 12:26:05 PDT (-0700), atishp@atishpatra.org wrote: > On Mon, Oct 31, 2022 at 12:12 PM Conor Dooley <conor@kernel.org> wrote: >> >> On Fri, Oct 28, 2022 at 04:19:29PM -0700, Atish Patra wrote: >> > It is useless to issue remote fences if there is a single core >> > available. It becomes a bottleneck for sbi based rfences where >> > we will be making those ECALLs for no reason. Early code patching >> > because of static calls end up in this path. >> > >> > Signed-off-by: Atish Patra <atishp@rivosinc.com> >> >> Hey Atish, >> This doesn't apply for me to either fixes or for-next. What branch does >> it apply to? >> Thanks, >> Conor. >> >> > --- >> > arch/riscv/mm/cacheflush.c | 4 ++++ >> > 1 file changed, 4 insertions(+) >> > >> > diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c >> > index f10cb47eac3a..7fafc8c26505 100644 >> > --- a/arch/riscv/mm/cacheflush.c >> > +++ b/arch/riscv/mm/cacheflush.c >> > @@ -19,6 +19,10 @@ void flush_icache_all(void) >> > { >> > local_flush_icache_all(); >> > >> > + /* No need to issue remote fence if only 1 cpu is online */ >> > + if (num_online_cpus() == 1) >> > + return; >> > + >> > if (IS_ENABLED(CONFIG_RISCV_SBI) && !riscv_use_ipi_for_rfence()) >> > sbi_remote_fence_i(NULL); >> > else >> > -- >> > 2.34.1 >> > > > Sorry I forgot to specify the dependencies for this patch. This patch > is based on Anup's IPI series [1] as > I assumed the IPI series would go first. I can rebase on top of the > master if required. > However, the issue will manifest only after Jisheng's patch[2] which > moved the sbi_init to earlier and introduced the > static key in the paging_init path. > > [1] https://patchwork.kernel.org/project/linux-riscv/patch/20220820065446.389788-8-apatel@ventanamicro.com/ > [2] https://lore.kernel.org/lkml/20220716115059.3509-1-jszhang@kernel.org/ IMO we should just stop issuing the SBI remote fences at all, with the code to do IPI-based fences we're just adding complexity for the slow case. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] RISC-V: Do not issue remote fences until smp is available 2022-11-10 21:42 ` Palmer Dabbelt @ 2022-11-12 7:46 ` Atish Patra 0 siblings, 0 replies; 5+ messages in thread From: Atish Patra @ 2022-11-12 7:46 UTC (permalink / raw) To: Palmer Dabbelt Cc: Conor Dooley, Atish Patra, linux-kernel, aou, anup, damien.lemoal, devicetree, jszhang, linux-riscv, Paul Walmsley, robh+dt On Thu, Nov 10, 2022 at 1:42 PM Palmer Dabbelt <palmer@dabbelt.com> wrote: > > On Mon, 31 Oct 2022 12:26:05 PDT (-0700), atishp@atishpatra.org wrote: > > On Mon, Oct 31, 2022 at 12:12 PM Conor Dooley <conor@kernel.org> wrote: > >> > >> On Fri, Oct 28, 2022 at 04:19:29PM -0700, Atish Patra wrote: > >> > It is useless to issue remote fences if there is a single core > >> > available. It becomes a bottleneck for sbi based rfences where > >> > we will be making those ECALLs for no reason. Early code patching > >> > because of static calls end up in this path. > >> > > >> > Signed-off-by: Atish Patra <atishp@rivosinc.com> > >> > >> Hey Atish, > >> This doesn't apply for me to either fixes or for-next. What branch does > >> it apply to? > >> Thanks, > >> Conor. > >> > >> > --- > >> > arch/riscv/mm/cacheflush.c | 4 ++++ > >> > 1 file changed, 4 insertions(+) > >> > > >> > diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c > >> > index f10cb47eac3a..7fafc8c26505 100644 > >> > --- a/arch/riscv/mm/cacheflush.c > >> > +++ b/arch/riscv/mm/cacheflush.c > >> > @@ -19,6 +19,10 @@ void flush_icache_all(void) > >> > { > >> > local_flush_icache_all(); > >> > > >> > + /* No need to issue remote fence if only 1 cpu is online */ > >> > + if (num_online_cpus() == 1) > >> > + return; > >> > + > >> > if (IS_ENABLED(CONFIG_RISCV_SBI) && !riscv_use_ipi_for_rfence()) > >> > sbi_remote_fence_i(NULL); > >> > else > >> > -- > >> > 2.34.1 > >> > > > > > Sorry I forgot to specify the dependencies for this patch. This patch > > is based on Anup's IPI series [1] as > > I assumed the IPI series would go first. I can rebase on top of the > > master if required. > > However, the issue will manifest only after Jisheng's patch[2] which > > moved the sbi_init to earlier and introduced the > > static key in the paging_init path. > > > > [1] https://patchwork.kernel.org/project/linux-riscv/patch/20220820065446.389788-8-apatel@ventanamicro.com/ > > [2] https://lore.kernel.org/lkml/20220716115059.3509-1-jszhang@kernel.org/ > > IMO we should just stop issuing the SBI remote fences at all, with the > code to do IPI-based fences we're just adding complexity for the slow > case. Sure. We can do that too. However, that will have some performance impact for any platform(existing and future ones) without imsic. Is that acceptable ? Maybe it will encourage every vendor to implement AIA instead of PLIC ;) -- Regards, Atish ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-12 7:46 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-10-28 23:19 [PATCH] RISC-V: Do not issue remote fences until smp is available Atish Patra 2022-10-31 19:11 ` Conor Dooley 2022-10-31 19:26 ` Atish Patra 2022-11-10 21:42 ` Palmer Dabbelt 2022-11-12 7:46 ` Atish Patra
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).