* [PATCH] RISC-V: Fix usage of memblock_enforce_memory_limit
@ 2020-12-17 7:48 Atish Patra
2020-12-17 8:12 ` Bin Meng
2020-12-17 8:27 ` Mike Rapoport
0 siblings, 2 replies; 6+ messages in thread
From: Atish Patra @ 2020-12-17 7:48 UTC (permalink / raw)
To: linux-kernel
Cc: Albert Ou, Anup Patel, Atish Patra, Palmer Dabbelt, Paul Walmsley,
Andrew Morton, Bin Meng, linux-riscv, Mike Rapoport
memblock_enforce_memory_limit accepts the maximum memory size not the last
address. Fix the function invocation correctly.
Fixes: 1bd14a66ee52 ("RISC-V: Remove any memblock representing unusable memory area")
Signed-off-by: Atish Patra <atish.patra@wdc.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 8e577f14f120..e4133c20744c 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -174,7 +174,7 @@ void __init setup_bootmem(void)
* Make sure that any memory beyond mem_start + (-PAGE_OFFSET) is removed
* as it is unusable by kernel.
*/
- memblock_enforce_memory_limit(mem_start - PAGE_OFFSET);
+ memblock_enforce_memory_limit(-PAGE_OFFSET);
/* Reserve from the start of the kernel to the end of the kernel */
memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
--
2.25.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] RISC-V: Fix usage of memblock_enforce_memory_limit 2020-12-17 7:48 [PATCH] RISC-V: Fix usage of memblock_enforce_memory_limit Atish Patra @ 2020-12-17 8:12 ` Bin Meng 2020-12-17 8:43 ` Atish Patra 2020-12-17 8:27 ` Mike Rapoport 1 sibling, 1 reply; 6+ messages in thread From: Bin Meng @ 2020-12-17 8:12 UTC (permalink / raw) To: Atish Patra Cc: Albert Ou, Anup Patel, linux-kernel, Palmer Dabbelt, Paul Walmsley, Andrew Morton, linux-riscv, Mike Rapoport Hi Atish, On Thu, Dec 17, 2020 at 3:49 PM Atish Patra <atish.patra@wdc.com> wrote: > > memblock_enforce_memory_limit accepts the maximum memory size not the last > address. Fix the function invocation correctly. > > Fixes: 1bd14a66ee52 ("RISC-V: Remove any memblock representing unusable memory area") > > Signed-off-by: Atish Patra <atish.patra@wdc.com> > --- > arch/riscv/mm/init.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Thank you for working on this. Tested with QEMU 5.2.0 on 32-bit 'virt' and 'sifive_u', with fw_jump.bin used as the -bios. 32-bit 'virt' boots, but 32-bit 'sifive_u' still does not boot, which should be another issue because reverting the original 1bd14a66ee52 it still does not help 'sifive_u'. Tested-by: Bin Meng <bin.meng@windriver.com> I believe the following tag should also be added and patch cc'ed to stable-kernel: Reported-by: Bin Meng <bin.meng@windriver.com> Cc: <stable@vger.kernel.org> # 5.10 Regards, Bin _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] RISC-V: Fix usage of memblock_enforce_memory_limit 2020-12-17 8:12 ` Bin Meng @ 2020-12-17 8:43 ` Atish Patra 2020-12-17 8:53 ` Bin Meng 0 siblings, 1 reply; 6+ messages in thread From: Atish Patra @ 2020-12-17 8:43 UTC (permalink / raw) To: Bin Meng Cc: Albert Ou, Anup Patel, linux-kernel, Atish Patra, Palmer Dabbelt, Paul Walmsley, Andrew Morton, linux-riscv, Mike Rapoport On Thu, Dec 17, 2020 at 12:12 AM Bin Meng <bmeng.cn@gmail.com> wrote: > > Hi Atish, > > On Thu, Dec 17, 2020 at 3:49 PM Atish Patra <atish.patra@wdc.com> wrote: > > > > memblock_enforce_memory_limit accepts the maximum memory size not the last > > address. Fix the function invocation correctly. > > > > Fixes: 1bd14a66ee52 ("RISC-V: Remove any memblock representing unusable memory area") > > > > Signed-off-by: Atish Patra <atish.patra@wdc.com> > > --- > > arch/riscv/mm/init.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > Thank you for working on this. > > Tested with QEMU 5.2.0 on 32-bit 'virt' and 'sifive_u', with > fw_jump.bin used as the -bios. fw_dynamic should also work unless you are using more than 1G of memory. Linux kernel can only support 1G of memory for RV32. The current Kconfig is bit misleading and I will send a patch to update the description. However, kernel should be able to ignore any memory beyond what it can address and continue. I will investigate more. > 32-bit 'virt' boots, but 32-bit 'sifive_u' still does not boot, which > should be another issue because reverting the original 1bd14a66ee52 it > still does not help 'sifive_u'. > Are you using more than 1G of memory ? Let me know if the kernel boots if you use 1G. > Tested-by: Bin Meng <bin.meng@windriver.com> > > I believe the following tag should also be added and patch cc'ed to > stable-kernel: > > Reported-by: Bin Meng <bin.meng@windriver.com> > Cc: <stable@vger.kernel.org> # 5.10 > > Regards, > Bin > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv -- Regards, Atish _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] RISC-V: Fix usage of memblock_enforce_memory_limit 2020-12-17 8:43 ` Atish Patra @ 2020-12-17 8:53 ` Bin Meng 2020-12-17 23:44 ` Atish Patra 0 siblings, 1 reply; 6+ messages in thread From: Bin Meng @ 2020-12-17 8:53 UTC (permalink / raw) To: Atish Patra Cc: Albert Ou, Anup Patel, linux-kernel, Atish Patra, Palmer Dabbelt, Paul Walmsley, Andrew Morton, linux-riscv, Mike Rapoport Hi Atish, On Thu, Dec 17, 2020 at 4:43 PM Atish Patra <atishp@atishpatra.org> wrote: > > On Thu, Dec 17, 2020 at 12:12 AM Bin Meng <bmeng.cn@gmail.com> wrote: > > > > Hi Atish, > > > > On Thu, Dec 17, 2020 at 3:49 PM Atish Patra <atish.patra@wdc.com> wrote: > > > > > > memblock_enforce_memory_limit accepts the maximum memory size not the last > > > address. Fix the function invocation correctly. > > > > > > Fixes: 1bd14a66ee52 ("RISC-V: Remove any memblock representing unusable memory area") > > > > > > Signed-off-by: Atish Patra <atish.patra@wdc.com> > > > --- > > > arch/riscv/mm/init.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > Thank you for working on this. > > > > Tested with QEMU 5.2.0 on 32-bit 'virt' and 'sifive_u', with > > fw_jump.bin used as the -bios. > > fw_dynamic should also work unless you are using more than 1G of memory. > Linux kernel can only support 1G of memory for RV32. The current I have always been using -m 2G for testing both 32-bit and 64-bit. 32-bit 'virt' with 2G memory boots the 32-bit kernel fine. $ qemu-system-riscv32 -nographic -M virt -m 2G -smp 4 -kernel arch/riscv/boot/Image -bios fw_jump.bin > Kconfig is bit misleading and > I will send a patch to update the description. > > However, kernel should be able to ignore any memory beyond what it can > address and continue. > I will investigate more. > > > 32-bit 'virt' boots, but 32-bit 'sifive_u' still does not boot, which > > should be another issue because reverting the original 1bd14a66ee52 it > > still does not help 'sifive_u'. > > > > Are you using more than 1G of memory ? Let me know if the kernel boots > if you use 1G. Kernel does not boot with 1G memory on 32-bit 'sifive_u', either with fw_jump.bin or fw_dynamic.bin. $ qemu-system-riscv32 -nographic -M sifive_u -m 1G -smp 5 -kernel arch/riscv/boot/Image -bios fw_jump.bin > > > Tested-by: Bin Meng <bin.meng@windriver.com> > > > > I believe the following tag should also be added and patch cc'ed to > > stable-kernel: > > > > Reported-by: Bin Meng <bin.meng@windriver.com> > > Cc: <stable@vger.kernel.org> # 5.10 Regards, Bin _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] RISC-V: Fix usage of memblock_enforce_memory_limit 2020-12-17 8:53 ` Bin Meng @ 2020-12-17 23:44 ` Atish Patra 0 siblings, 0 replies; 6+ messages in thread From: Atish Patra @ 2020-12-17 23:44 UTC (permalink / raw) To: Bin Meng Cc: Albert Ou, Anup Patel, linux-kernel, Atish Patra, Palmer Dabbelt, Paul Walmsley, Andrew Morton, linux-riscv, Mike Rapoport On Thu, Dec 17, 2020 at 12:53 AM Bin Meng <bmeng.cn@gmail.com> wrote: > > Hi Atish, > > On Thu, Dec 17, 2020 at 4:43 PM Atish Patra <atishp@atishpatra.org> wrote: > > > > On Thu, Dec 17, 2020 at 12:12 AM Bin Meng <bmeng.cn@gmail.com> wrote: > > > > > > Hi Atish, > > > > > > On Thu, Dec 17, 2020 at 3:49 PM Atish Patra <atish.patra@wdc.com> wrote: > > > > > > > > memblock_enforce_memory_limit accepts the maximum memory size not the last > > > > address. Fix the function invocation correctly. > > > > > > > > Fixes: 1bd14a66ee52 ("RISC-V: Remove any memblock representing unusable memory area") > > > > > > > > Signed-off-by: Atish Patra <atish.patra@wdc.com> > > > > --- > > > > arch/riscv/mm/init.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > Thank you for working on this. > > > > > > Tested with QEMU 5.2.0 on 32-bit 'virt' and 'sifive_u', with > > > fw_jump.bin used as the -bios. > > > > fw_dynamic should also work unless you are using more than 1G of memory. > > Linux kernel can only support 1G of memory for RV32. The current > > I have always been using -m 2G for testing both 32-bit and 64-bit. > 32-bit 'virt' with 2G memory boots the 32-bit kernel fine. > 2GB issue with fw_dynamic is fixed with this patch. https://www.mail-archive.com/qemu-devel@nongnu.org/msg768341.html > $ qemu-system-riscv32 -nographic -M virt -m 2G -smp 4 -kernel > arch/riscv/boot/Image -bios fw_jump.bin > > > Kconfig is bit misleading and > > I will send a patch to update the description. > > > > However, kernel should be able to ignore any memory beyond what it can > > address and continue. > > I will investigate more. > > > > > 32-bit 'virt' boots, but 32-bit 'sifive_u' still does not boot, which > > > should be another issue because reverting the original 1bd14a66ee52 it > > > still does not help 'sifive_u'. > > > > > > > Are you using more than 1G of memory ? Let me know if the kernel boots > > if you use 1G. > > Kernel does not boot with 1G memory on 32-bit 'sifive_u', either with > fw_jump.bin or fw_dynamic.bin. > > $ qemu-system-riscv32 -nographic -M sifive_u -m 1G -smp 5 -kernel > arch/riscv/boot/Image -bios fw_jump.bin > This happened because of the incorrect loading address. It is already fixed by Alistair. https://www.mail-archive.com/qemu-devel@nongnu.org/msg768279.html > > > > > Tested-by: Bin Meng <bin.meng@windriver.com> > > > Thanks for testing it. > > > I believe the following tag should also be added and patch cc'ed to > > > stable-kernel: > > > > > > Reported-by: Bin Meng <bin.meng@windriver.com> > > > Cc: <stable@vger.kernel.org> # 5.10 > Sure. I will add that and resend it. > Regards, > Bin -- Regards, Atish _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] RISC-V: Fix usage of memblock_enforce_memory_limit 2020-12-17 7:48 [PATCH] RISC-V: Fix usage of memblock_enforce_memory_limit Atish Patra 2020-12-17 8:12 ` Bin Meng @ 2020-12-17 8:27 ` Mike Rapoport 1 sibling, 0 replies; 6+ messages in thread From: Mike Rapoport @ 2020-12-17 8:27 UTC (permalink / raw) To: Atish Patra Cc: Albert Ou, Anup Patel, linux-kernel, Palmer Dabbelt, Paul Walmsley, Andrew Morton, Bin Meng, linux-riscv On Wed, Dec 16, 2020 at 11:48:55PM -0800, Atish Patra wrote: > memblock_enforce_memory_limit accepts the maximum memory size not the last > address. Fix the function invocation correctly. > > Fixes: 1bd14a66ee52 ("RISC-V: Remove any memblock representing unusable memory area") > > Signed-off-by: Atish Patra <atish.patra@wdc.com> Acked-by: Mike Rapoport <rppt@linux.ibm.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 8e577f14f120..e4133c20744c 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -174,7 +174,7 @@ void __init setup_bootmem(void) > * Make sure that any memory beyond mem_start + (-PAGE_OFFSET) is removed > * as it is unusable by kernel. > */ > - memblock_enforce_memory_limit(mem_start - PAGE_OFFSET); > + memblock_enforce_memory_limit(-PAGE_OFFSET); > > /* Reserve from the start of the kernel to the end of the kernel */ > memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start); > -- > 2.25.1 > -- Sincerely yours, Mike. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-12-17 23:44 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-12-17 7:48 [PATCH] RISC-V: Fix usage of memblock_enforce_memory_limit Atish Patra 2020-12-17 8:12 ` Bin Meng 2020-12-17 8:43 ` Atish Patra 2020-12-17 8:53 ` Bin Meng 2020-12-17 23:44 ` Atish Patra 2020-12-17 8:27 ` Mike Rapoport
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox