Skip to contentSkip to conversation

parisc: Avoid calling SMP cache flush functions on cache-less machines

PATCH Superseded Helge Deller 2 participants 2 messages Mar 12, 2022 – Mar 14, 2022 PA-RISC architecture

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Helge Deller

author maintainer
#0 lore raw

PATCH 1/1 parisc: Avoid calling SMP cache flush functions on cache-less machines

At least the qemu virtual machine does not provide D- and I-caches, so skip triggering SMP irqs to flush caches on such machines.

---
 arch/parisc/kernel/cache.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
arch/parisc/kernel/cache.c +6 -3
index 81f36d6407f0..29839550146b 100644
@@ -62,12 +62,14 @@ static struct pdc_btlb_info btlb_info __ro_after_init;
 void
 flush_data_cache(void)
 {
-	on_each_cpu(flush_data_cache_local, NULL, 1);
+	if (cache_info.dc_size)
+		on_each_cpu(flush_data_cache_local, NULL, 1);
 }
 void
 flush_instruction_cache(void)
 {
-	on_each_cpu(flush_instruction_cache_local, NULL, 1);
+	if (cache_info.ic_size)
+		on_each_cpu(flush_instruction_cache_local, NULL, 1);
 }
 #endif
 
@@ -524,7 +526,8 @@ static void cacheflush_h_tmp_function(void *dummy)
 
 void flush_cache_all(void)
 {
-	on_each_cpu(cacheflush_h_tmp_function, NULL, 1);
+	if (cache_info.dc_size | cache_info.ic_size)
+		on_each_cpu(cacheflush_h_tmp_function, NULL, 1);
 }
 
 static inline unsigned long mm_total_size(struct mm_struct *mm)

--
2.34.1

#1 lore raw

Hi Helge,

Quoted 4 lines · Helge Deller

At least the qemu virtual machine does not provide D- and I-caches, so skip triggering SMP irqs to flush caches on such machines.

Not sure about the real performance benefit on hppa, but maybe use static branches?