[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221028231929.347918-1-atishp@rivosinc.com>
Date: Fri, 28 Oct 2022 16:19:29 -0700
From: Atish Patra <atishp@...osinc.com>
To: linux-kernel@...r.kernel.org
Cc: Atish Patra <atishp@...osinc.com>,
Albert Ou <aou@...s.berkeley.edu>,
Atish Patra <atishp@...shpatra.org>,
Anup Patel <anup@...infault.org>,
Damien Le Moal <damien.lemoal@....com>,
devicetree@...r.kernel.org, Jisheng Zhang <jszhang@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
linux-riscv@...ts.infradead.org,
Palmer Dabbelt <palmer@...belt.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Rob Herring <robh+dt@...nel.org>
Subject: [PATCH] RISC-V: Do not issue remote fences until smp is available
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@...osinc.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
Powered by blists - more mailing lists