[PATCH riscv/for-next] riscv: cacheflush: Fix warning when compiled without CONFIG_SMP

Charlie Jenkins posted 1 patch 1 week, 6 days ago
arch/riscv/mm/cacheflush.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH riscv/for-next] riscv: cacheflush: Fix warning when compiled without CONFIG_SMP
Posted by Charlie Jenkins 1 week, 6 days ago
GCC tries to compile the static function set_icache_stale_mask() even
when there are no callers. Guard the function with #ifdef CONFIG_SMP.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Fixes: 383289e4b071 ("riscv: Include riscv_set_icache_flush_ctx prctl")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202404180621.qG7A9Tk0-lkp@intel.com/
---
Since this is just in for-next Palmer do you want to squash this onto the
commit that introduced this 383289e4b071?
---
 arch/riscv/mm/cacheflush.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c
index 3b03534e57b4..3ef666c7dfc7 100644
--- a/arch/riscv/mm/cacheflush.c
+++ b/arch/riscv/mm/cacheflush.c
@@ -154,6 +154,7 @@ void __init riscv_init_cbo_blocksizes(void)
 		riscv_cboz_block_size = cboz_block_size;
 }
 
+#ifdef CONFIG_SMP
 static void set_icache_stale_mask(void)
 {
 	cpumask_t *mask;
@@ -171,6 +172,7 @@ static void set_icache_stale_mask(void)
 	cpumask_setall(mask);
 	cpumask_assign_cpu(smp_processor_id(), mask, stale_cpu);
 }
+#endif
 
 /**
  * riscv_set_icache_flush_ctx() - Enable/disable icache flushing instructions in

---
base-commit: a76716f0ec75b9e7ac62d30854d690044c857684
change-id: 20240417-fix_nosmp_icache-0fc36aeafbe5
-- 
- Charlie
Re: [PATCH riscv/for-next] riscv: cacheflush: Fix warning when compiled without CONFIG_SMP
Posted by Conor Dooley 6 days, 23 hours ago
On Wed, Apr 17, 2024 at 04:49:48PM -0700, Charlie Jenkins wrote:
> GCC tries to compile the static function set_icache_stale_mask() even
> when there are no callers. Guard the function with #ifdef CONFIG_SMP.
> 
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> Fixes: 383289e4b071 ("riscv: Include riscv_set_icache_flush_ctx prctl")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202404180621.qG7A9Tk0-lkp@intel.com/
> ---
> Since this is just in for-next Palmer do you want to squash this onto the
> commit that introduced this 383289e4b071?

It's not even in riscv/for-next as far as I can tell, and looks like the
squash into the staging copy has already happened. I'm gonna drop this
from patchwork.

> ---
>  arch/riscv/mm/cacheflush.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c
> index 3b03534e57b4..3ef666c7dfc7 100644
> --- a/arch/riscv/mm/cacheflush.c
> +++ b/arch/riscv/mm/cacheflush.c
> @@ -154,6 +154,7 @@ void __init riscv_init_cbo_blocksizes(void)
>  		riscv_cboz_block_size = cboz_block_size;
>  }
>  
> +#ifdef CONFIG_SMP
>  static void set_icache_stale_mask(void)
>  {
>  	cpumask_t *mask;
> @@ -171,6 +172,7 @@ static void set_icache_stale_mask(void)
>  	cpumask_setall(mask);
>  	cpumask_assign_cpu(smp_processor_id(), mask, stale_cpu);
>  }
> +#endif
>  
>  /**
>   * riscv_set_icache_flush_ctx() - Enable/disable icache flushing instructions in
> 
> ---
> base-commit: a76716f0ec75b9e7ac62d30854d690044c857684
> change-id: 20240417-fix_nosmp_icache-0fc36aeafbe5
> -- 
> - Charlie
> 
>