* [PATCH] riscv: mm: fix truncates issue on RV32
@ 2023-07-09 17:10 Jisheng Zhang
2023-07-12 15:52 ` Palmer Dabbelt
2023-07-12 16:00 ` patchwork-bot+linux-riscv
0 siblings, 2 replies; 3+ messages in thread
From: Jisheng Zhang @ 2023-07-09 17:10 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou
Cc: linux-riscv, linux-kernel, Randy Dunlap, kernel test robot
lkp reports below sparse warning when building for RV32:
arch/riscv/mm/init.c:1204:48: sparse: warning: cast truncates bits from
constant value (100000000 becomes 0)
IMO, the reason we didn't see this truncates bug in real world is "0"
means MEMBLOCK_ALLOC_ACCESSIBLE in memblock and there's no RV32 HW
with more than 4GB memory.
Fix it anyway to make sparse happy.
Fixes: decf89f86ecd ("riscv: try to allocate crashkern region from 32bit addressible memory")
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202306080034.SLiCiOMn-lkp@intel.com/
---
arch/riscv/mm/init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 70fb31960b63..9ce504737d18 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -1346,7 +1346,7 @@ static void __init reserve_crashkernel(void)
*/
crash_base = memblock_phys_alloc_range(crash_size, PMD_SIZE,
search_start,
- min(search_end, (unsigned long) SZ_4G));
+ min(search_end, (unsigned long)(SZ_4G - 1)));
if (crash_base == 0) {
/* Try again without restricting region to 32bit addressible memory */
crash_base = memblock_phys_alloc_range(crash_size, PMD_SIZE,
--
2.40.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] riscv: mm: fix truncates issue on RV32
2023-07-09 17:10 [PATCH] riscv: mm: fix truncates issue on RV32 Jisheng Zhang
@ 2023-07-12 15:52 ` Palmer Dabbelt
2023-07-12 16:00 ` patchwork-bot+linux-riscv
1 sibling, 0 replies; 3+ messages in thread
From: Palmer Dabbelt @ 2023-07-12 15:52 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Jisheng Zhang
Cc: linux-riscv, linux-kernel, Randy Dunlap, kernel test robot
On Mon, 10 Jul 2023 01:10:36 +0800, Jisheng Zhang wrote:
> lkp reports below sparse warning when building for RV32:
> arch/riscv/mm/init.c:1204:48: sparse: warning: cast truncates bits from
> constant value (100000000 becomes 0)
>
> IMO, the reason we didn't see this truncates bug in real world is "0"
> means MEMBLOCK_ALLOC_ACCESSIBLE in memblock and there's no RV32 HW
> with more than 4GB memory.
>
> [...]
Applied, thanks!
[1/1] riscv: mm: fix truncates issue on RV32
https://git.kernel.org/palmer/c/b690e266dae2
Best regards,
--
Palmer Dabbelt <palmer@rivosinc.com>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] riscv: mm: fix truncates issue on RV32
2023-07-09 17:10 [PATCH] riscv: mm: fix truncates issue on RV32 Jisheng Zhang
2023-07-12 15:52 ` Palmer Dabbelt
@ 2023-07-12 16:00 ` patchwork-bot+linux-riscv
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-07-12 16:00 UTC (permalink / raw)
To: Jisheng Zhang
Cc: linux-riscv, paul.walmsley, palmer, aou, linux-kernel, rdunlap,
lkp
Hello:
This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:
On Mon, 10 Jul 2023 01:10:36 +0800 you wrote:
> lkp reports below sparse warning when building for RV32:
> arch/riscv/mm/init.c:1204:48: sparse: warning: cast truncates bits from
> constant value (100000000 becomes 0)
>
> IMO, the reason we didn't see this truncates bug in real world is "0"
> means MEMBLOCK_ALLOC_ACCESSIBLE in memblock and there's no RV32 HW
> with more than 4GB memory.
>
> [...]
Here is the summary with links:
- riscv: mm: fix truncates issue on RV32
https://git.kernel.org/riscv/c/b690e266dae2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-12 16:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-09 17:10 [PATCH] riscv: mm: fix truncates issue on RV32 Jisheng Zhang
2023-07-12 15:52 ` Palmer Dabbelt
2023-07-12 16:00 ` patchwork-bot+linux-riscv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox