Skip to contentSkip to conversation

riscv: export flush_icache_all to modules

PATCH In review Olof Johansson 3 participants 6 messages Dec 17, 2019 – Dec 28, 2019 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: export flush_icache_all to modules

This is needed by LKDTM (crash dump test module), it calls flush_icache_range(), which on RISC-V turns into flush_icache_all(). On other architectures, the actual implementation is exported, so follow that precedence and export it here too.

Fixes build of CONFIG_LKDTM that fails with:
ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!

---
 arch/riscv/mm/cacheflush.c | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/mm/cacheflush.c +1 -0
index 8f19006866405..8930ab7278e6d 100644
@@ -22,6 +22,7 @@ void flush_icache_all(void)
 	else
 		on_each_cpu(ipi_remote_fence_i, NULL, 1);
 }
+EXPORT_SYMBOL(flush_icache_all);
 
 /*
  * Performs an icache flush for the given MM context.  RISC-V has no direct
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Olof Johansson

This is needed by LKDTM (crash dump test module), it calls flush_icache_range(), which on RISC-V turns into flush_icache_all(). On other architectures, the actual implementation is exported, so follow that precedence and export it here too.

Fixes build of CONFIG_LKDTM that fails with:
ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!

---
 arch/riscv/mm/cacheflush.c | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/mm/cacheflush.c +1 -1
index 8f19006866405..8930ab7278e6d 100644
@@ -22,6 +22,7 @@ void flush_icache_all(void)
        else
                on_each_cpu(ipi_remote_fence_i, NULL, 1);
 }
+EXPORT_SYMBOL(flush_icache_all);
 
 /*
  * Performs an icache flush for the given MM context.  RISC-V has no direct
--
Quoted 2 lines

2.11.0

LGTM.

Regards,
Anup

#2 lore raw
In reply to Olof Johansson
Quoted 7 lines · Olof Johansson

This is needed by LKDTM (crash dump test module), it calls flush_icache_range(), which on RISC-V turns into flush_icache_all(). On other architectures, the actual implementation is exported, so follow that precedence and export it here too.

Fixes build of CONFIG_LKDTM that fails with:
ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!

In the past we've resisted doing this; see

https://lore.kernel.org/linux-riscv/[email protected]/

under the principle that we don't want modules to be able to flush the I$ directly via this interface. But maybe, like moving the L2 related code out of arch/riscv, we should just do it.

- Paul

#3 lore raw
Quoted 11 lines · Paul Walmsley
Quoted 7 lines · Olof Johansson

This is needed by LKDTM (crash dump test module), it calls flush_icache_range(), which on RISC-V turns into flush_icache_all(). On other architectures, the actual implementation is exported, so follow that precedence and export it here too.

Fixes build of CONFIG_LKDTM that fails with:
ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!

Quoted 7 lines

In the past we've resisted doing this; see

https://lore.kernel.org/linux-riscv/[email protected]/

under the principle that we don't want modules to be able to flush the I$ directly via this interface. But maybe, like moving the L2 related code out of arch/riscv, we should just do it.

So you are aware that all other architectures that don't have coherent icache already exports this, right?

Being more puritan on RISC-V buys nothing w.r.t. keeping modules from doing anything, you'll just end up having to mark a bunch of them broken on your architecture. :(

-Olof

#4 lore raw
Quoted 20 lines · Olof Johansson
Quoted 11 lines · Paul Walmsley
Quoted 7 lines · Olof Johansson

This is needed by LKDTM (crash dump test module), it calls flush_icache_range(), which on RISC-V turns into flush_icache_all(). On other architectures, the actual implementation is exported, so follow that precedence and export it here too.

Fixes build of CONFIG_LKDTM that fails with:
ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!

Quoted 7 lines

In the past we've resisted doing this; see

https://lore.kernel.org/linux-riscv/[email protected]/

under the principle that we don't want modules to be able to flush the I$ directly via this interface. But maybe, like moving the L2 related code out of arch/riscv, we should just do it.

Quoted 6 lines

So you are aware that all other architectures that don't have coherent icache already exports this, right?

Being more puritan on RISC-V buys nothing w.r.t. keeping modules from doing anything, you'll just end up having to mark a bunch of them broken on your architecture. :(

Yep, we'll pick it up.

- Paul

#5 lore raw
In reply to Olof Johansson
Quoted 9 lines · Olof Johansson

This is needed by LKDTM (crash dump test module), it calls flush_icache_range(), which on RISC-V turns into flush_icache_all(). On other architectures, the actual implementation is exported, so follow that precedence and export it here too.

Fixes build of CONFIG_LKDTM that fails with:
ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!

Thanks Olof, queued for v5.5-rc.

- Paul