linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] riscv: move flush_icache_range/user_range() after flush_icache_all()
  2019-09-26  2:29 [PATCH] riscv: move flush_icache_range/user_range() after flush_icache_all() Kefeng Wang
@ 2019-09-26  2:23 ` Kefeng Wang
  2019-09-26  6:52 ` Andreas Schwab
  1 sibling, 0 replies; 4+ messages in thread
From: Kefeng Wang @ 2019-09-26  2:23 UTC (permalink / raw)
  To: linux-riscv, linux-kernel, Palmer Dabbelt; +Cc: Albert Ou, Paul Walmsley

Please ignore this version.

On 2019/9/26 10:29, Kefeng Wang wrote:
> When build lkdtm module, which used flush_icache_range(), error occurred,
>
> ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!
>
> Fix it.
>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@sifive.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  arch/riscv/include/asm/cacheflush.h | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/riscv/include/asm/cacheflush.h b/arch/riscv/include/asm/cacheflush.h
> index 555b20b11dc3..f6ec26589620 100644
> --- a/arch/riscv/include/asm/cacheflush.h
> +++ b/arch/riscv/include/asm/cacheflush.h
> @@ -80,13 +80,6 @@ static inline void flush_dcache_page(struct page *page)
>  		clear_bit(PG_dcache_clean, &page->flags);
>  }
>  
> -/*
> - * RISC-V doesn't have an instruction to flush parts of the instruction cache,
> - * so instead we just flush the whole thing.
> - */
> -#define flush_icache_range(start, end) flush_icache_all()
> -#define flush_icache_user_range(vma, pg, addr, len) flush_icache_all()
> -
>  #ifndef CONFIG_SMP
>  
>  #define flush_icache_all() local_flush_icache_all()
> @@ -99,6 +92,13 @@ void flush_icache_mm(struct mm_struct *mm, bool local);
>  
>  #endif /* CONFIG_SMP */
>  
> +/*
> + * RISC-V doesn't have an instruction to flush parts of the instruction cache,
> + * so instead we just flush the whole thing.
> + */
> +#define flush_icache_range(start, end) flush_icache_all()
> +#define flush_icache_user_range(vma, pg, addr, len) flush_icache_all()
> +
>  /*
>   * Bits in sys_riscv_flush_icache()'s flags argument.
>   */


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] riscv: move flush_icache_range/user_range() after flush_icache_all()
@ 2019-09-26  2:29 Kefeng Wang
  2019-09-26  2:23 ` Kefeng Wang
  2019-09-26  6:52 ` Andreas Schwab
  0 siblings, 2 replies; 4+ messages in thread
From: Kefeng Wang @ 2019-09-26  2:29 UTC (permalink / raw)
  To: linux-riscv, linux-kernel, Palmer Dabbelt
  Cc: Kefeng Wang, Albert Ou, Paul Walmsley

When build lkdtm module, which used flush_icache_range(), error occurred,

ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!

Fix it.

Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@sifive.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/riscv/include/asm/cacheflush.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/riscv/include/asm/cacheflush.h b/arch/riscv/include/asm/cacheflush.h
index 555b20b11dc3..f6ec26589620 100644
--- a/arch/riscv/include/asm/cacheflush.h
+++ b/arch/riscv/include/asm/cacheflush.h
@@ -80,13 +80,6 @@ static inline void flush_dcache_page(struct page *page)
 		clear_bit(PG_dcache_clean, &page->flags);
 }
 
-/*
- * RISC-V doesn't have an instruction to flush parts of the instruction cache,
- * so instead we just flush the whole thing.
- */
-#define flush_icache_range(start, end) flush_icache_all()
-#define flush_icache_user_range(vma, pg, addr, len) flush_icache_all()
-
 #ifndef CONFIG_SMP
 
 #define flush_icache_all() local_flush_icache_all()
@@ -99,6 +92,13 @@ void flush_icache_mm(struct mm_struct *mm, bool local);
 
 #endif /* CONFIG_SMP */
 
+/*
+ * RISC-V doesn't have an instruction to flush parts of the instruction cache,
+ * so instead we just flush the whole thing.
+ */
+#define flush_icache_range(start, end) flush_icache_all()
+#define flush_icache_user_range(vma, pg, addr, len) flush_icache_all()
+
 /*
  * Bits in sys_riscv_flush_icache()'s flags argument.
  */
-- 
2.20.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] riscv: move flush_icache_range/user_range() after flush_icache_all()
  2019-09-26  2:29 [PATCH] riscv: move flush_icache_range/user_range() after flush_icache_all() Kefeng Wang
  2019-09-26  2:23 ` Kefeng Wang
@ 2019-09-26  6:52 ` Andreas Schwab
  2019-09-26  7:06   ` Kefeng Wang
  1 sibling, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2019-09-26  6:52 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: linux-riscv, Palmer Dabbelt, linux-kernel, Albert Ou, Paul Walmsley

https://lore.kernel.org/linux-riscv/mvm7e9spggv.fsf@suse.de/

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] riscv: move flush_icache_range/user_range() after flush_icache_all()
  2019-09-26  6:52 ` Andreas Schwab
@ 2019-09-26  7:06   ` Kefeng Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Kefeng Wang @ 2019-09-26  7:06 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Albert Ou, Kees Cook, Palmer Dabbelt, linux-kernel,
	Paul Walmsley, linux-riscv



On 2019/9/26 14:52, Andreas Schwab wrote:
> https://lore.kernel.org/linux-riscv/mvm7e9spggv.fsf@suse.de/
> 
> Andreas.
> 
Hi Andreas, my change is wrong.

For no SMP,  lkdtm built ok because flush_icache_all() is defined as local_flush_icache_all() macro,
but for SMP, the reason of build error is that flush_icache_all() implementation is not exported as
you mentioned in your patch,  and this does make allmodconfig broken.

LKDTM is used to test the different dumping mechanisms by inducing system failures at predefined
crash points, riscv will enable kernel dump in the future, this module is useful to test this mechanism.

so, it's necessary to fix it, right, any comment, thanks.


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-26  7:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26  2:29 [PATCH] riscv: move flush_icache_range/user_range() after flush_icache_all() Kefeng Wang
2019-09-26  2:23 ` Kefeng Wang
2019-09-26  6:52 ` Andreas Schwab
2019-09-26  7:06   ` Kefeng Wang

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).