* [PATCH] riscv: add a warning when physical memory address overflows @ 2024-08-14 6:26 Yunhui Cui 2024-08-15 11:01 ` Alexandre Ghiti 2025-01-30 14:10 ` patchwork-bot+linux-riscv 0 siblings, 2 replies; 6+ messages in thread From: Yunhui Cui @ 2024-08-14 6:26 UTC (permalink / raw) To: punit.agrawal, paul.walmsley, palmer, aou, alexghiti, cuiyunhui, chenjiahao16, guoren, vishal.moola, stuart.menefy, linux-riscv, linux-kernel The part of physical memory that exceeds the size of the linear mapping will be discarded. When the system starts up normally, a warning message will be printed to prevent confusion caused by the mismatch between the system memory and the actual physical memory. Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com> --- arch/riscv/mm/init.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 52290c9bd04bd..c93164dc51658 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -236,8 +236,12 @@ static void __init setup_bootmem(void) */ if (IS_ENABLED(CONFIG_64BIT)) { max_mapped_addr = __pa(PAGE_OFFSET) + KERN_VIRT_SIZE; - memblock_cap_memory_range(phys_ram_base, - max_mapped_addr - phys_ram_base); + if (memblock_end_of_DRAM() > max_mapped_addr) { + memblock_cap_memory_range(phys_ram_base, + max_mapped_addr - phys_ram_base); + pr_warn("Physical memory overflows the linear mapping size: region above 0x%llx removed", + max_mapped_addr); + } } -- 2.39.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] riscv: add a warning when physical memory address overflows 2024-08-14 6:26 [PATCH] riscv: add a warning when physical memory address overflows Yunhui Cui @ 2024-08-15 11:01 ` Alexandre Ghiti 2024-09-18 3:49 ` [External] " yunhui cui 2025-01-30 14:10 ` patchwork-bot+linux-riscv 1 sibling, 1 reply; 6+ messages in thread From: Alexandre Ghiti @ 2024-08-15 11:01 UTC (permalink / raw) To: Yunhui Cui, punit.agrawal, paul.walmsley, palmer, aou, alexghiti, chenjiahao16, guoren, vishal.moola, stuart.menefy, linux-riscv, linux-kernel Hi Yunhui, On 14/08/2024 08:26, Yunhui Cui wrote: > The part of physical memory that exceeds the size of the linear mapping > will be discarded. When the system starts up normally, a warning message > will be printed to prevent confusion caused by the mismatch between the > system memory and the actual physical memory. > > Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com> > --- > arch/riscv/mm/init.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index 52290c9bd04bd..c93164dc51658 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -236,8 +236,12 @@ static void __init setup_bootmem(void) > */ > if (IS_ENABLED(CONFIG_64BIT)) { > max_mapped_addr = __pa(PAGE_OFFSET) + KERN_VIRT_SIZE; > - memblock_cap_memory_range(phys_ram_base, > - max_mapped_addr - phys_ram_base); > + if (memblock_end_of_DRAM() > max_mapped_addr) { > + memblock_cap_memory_range(phys_ram_base, > + max_mapped_addr - phys_ram_base); > + pr_warn("Physical memory overflows the linear mapping size: region above 0x%llx removed", > + max_mapped_addr); > + } > } > > A bit weird to review and test my own patch, but here it is anyway :) Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com> Thanks, Alex ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [External] Re: [PATCH] riscv: add a warning when physical memory address overflows 2024-08-15 11:01 ` Alexandre Ghiti @ 2024-09-18 3:49 ` yunhui cui 2024-10-23 14:25 ` Punit Agrawal 0 siblings, 1 reply; 6+ messages in thread From: yunhui cui @ 2024-09-18 3:49 UTC (permalink / raw) To: Alexandre Ghiti Cc: punit.agrawal, paul.walmsley, palmer, aou, alexghiti, chenjiahao16, guoren, vishal.moola, stuart.menefy, linux-riscv, linux-kernel Hi Palmer, A gentle ping for this patch. On Thu, Aug 15, 2024 at 7:01 PM Alexandre Ghiti <alex@ghiti.fr> wrote: > > Hi Yunhui, > > On 14/08/2024 08:26, Yunhui Cui wrote: > > The part of physical memory that exceeds the size of the linear mapping > > will be discarded. When the system starts up normally, a warning message > > will be printed to prevent confusion caused by the mismatch between the > > system memory and the actual physical memory. > > > > Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com> > > --- > > arch/riscv/mm/init.c | 8 ++++++-- > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > > index 52290c9bd04bd..c93164dc51658 100644 > > --- a/arch/riscv/mm/init.c > > +++ b/arch/riscv/mm/init.c > > @@ -236,8 +236,12 @@ static void __init setup_bootmem(void) > > */ > > if (IS_ENABLED(CONFIG_64BIT)) { > > max_mapped_addr = __pa(PAGE_OFFSET) + KERN_VIRT_SIZE; > > - memblock_cap_memory_range(phys_ram_base, > > - max_mapped_addr - phys_ram_base); > > + if (memblock_end_of_DRAM() > max_mapped_addr) { > > + memblock_cap_memory_range(phys_ram_base, > > + max_mapped_addr - phys_ram_base); > > + pr_warn("Physical memory overflows the linear mapping size: region above 0x%llx removed", > > + max_mapped_addr); > > + } > > } > > > > > > > A bit weird to review and test my own patch, but here it is anyway :) > > Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> > > Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com> > > Thanks, > > Alex > Thanks, Yunhui ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [External] Re: [PATCH] riscv: add a warning when physical memory address overflows 2024-09-18 3:49 ` [External] " yunhui cui @ 2024-10-23 14:25 ` Punit Agrawal 2025-02-03 15:59 ` Palmer Dabbelt 0 siblings, 1 reply; 6+ messages in thread From: Punit Agrawal @ 2024-10-23 14:25 UTC (permalink / raw) To: palmer Cc: Alexandre Ghiti, punit.agrawal, paul.walmsley, aou, alexghiti, chenjiahao16, guoren, vishal.moola, stuart.menefy, linux-riscv, linux-kernel, yunhui cui Hi Palmer, [...] >> On 14/08/2024 08:26, Yunhui Cui wrote: >> > The part of physical memory that exceeds the size of the linear mapping >> > will be discarded. When the system starts up normally, a warning message >> > will be printed to prevent confusion caused by the mismatch between the >> > system memory and the actual physical memory. >> > >> > Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com> >> > --- >> > arch/riscv/mm/init.c | 8 ++++++-- >> > 1 file changed, 6 insertions(+), 2 deletions(-) >> > >> > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c >> > index 52290c9bd04bd..c93164dc51658 100644 >> > --- a/arch/riscv/mm/init.c >> > +++ b/arch/riscv/mm/init.c >> > @@ -236,8 +236,12 @@ static void __init setup_bootmem(void) >> > */ >> > if (IS_ENABLED(CONFIG_64BIT)) { >> > max_mapped_addr = __pa(PAGE_OFFSET) + KERN_VIRT_SIZE; >> > - memblock_cap_memory_range(phys_ram_base, >> > - max_mapped_addr - phys_ram_base); >> > + if (memblock_end_of_DRAM() > max_mapped_addr) { >> > + memblock_cap_memory_range(phys_ram_base, >> > + max_mapped_addr - phys_ram_base); >> > + pr_warn("Physical memory overflows the linear mapping size: region above 0x%llx removed", >> > + max_mapped_addr); >> > + } >> > } >> > >> > >> >> >> A bit weird to review and test my own patch, but here it is anyway :) >> >> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> >> >> Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com> Looks like the patch has been ready for a while now. If there are no further problems, can it be merged please? [...] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [External] Re: [PATCH] riscv: add a warning when physical memory address overflows 2024-10-23 14:25 ` Punit Agrawal @ 2025-02-03 15:59 ` Palmer Dabbelt 0 siblings, 0 replies; 6+ messages in thread From: Palmer Dabbelt @ 2025-02-03 15:59 UTC (permalink / raw) To: punit.agrawal Cc: alex, punit.agrawal, Paul Walmsley, aou, alexghiti, chenjiahao16, guoren, vishal.moola, stuart.menefy, linux-riscv, linux-kernel, cuiyunhui On Wed, 23 Oct 2024 07:25:22 PDT (-0700), punit.agrawal@bytedance.com wrote: > Hi Palmer, > > [...] > >>> On 14/08/2024 08:26, Yunhui Cui wrote: >>> > The part of physical memory that exceeds the size of the linear mapping >>> > will be discarded. When the system starts up normally, a warning message >>> > will be printed to prevent confusion caused by the mismatch between the >>> > system memory and the actual physical memory. >>> > >>> > Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com> >>> > --- >>> > arch/riscv/mm/init.c | 8 ++++++-- >>> > 1 file changed, 6 insertions(+), 2 deletions(-) >>> > >>> > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c >>> > index 52290c9bd04bd..c93164dc51658 100644 >>> > --- a/arch/riscv/mm/init.c >>> > +++ b/arch/riscv/mm/init.c >>> > @@ -236,8 +236,12 @@ static void __init setup_bootmem(void) >>> > */ >>> > if (IS_ENABLED(CONFIG_64BIT)) { >>> > max_mapped_addr = __pa(PAGE_OFFSET) + KERN_VIRT_SIZE; >>> > - memblock_cap_memory_range(phys_ram_base, >>> > - max_mapped_addr - phys_ram_base); >>> > + if (memblock_end_of_DRAM() > max_mapped_addr) { >>> > + memblock_cap_memory_range(phys_ram_base, >>> > + max_mapped_addr - phys_ram_base); >>> > + pr_warn("Physical memory overflows the linear mapping size: region above 0x%llx removed", >>> > + max_mapped_addr); >>> > + } >>> > } >>> > >>> > >>> >>> >>> A bit weird to review and test my own patch, but here it is anyway :) >>> >>> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> >>> >>> Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com> > > Looks like the patch has been ready for a while now. If there are no > further problems, can it be merged please? It didn't build, I squashed in a diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 8f8b76aaf99a..9641e4ad387f 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -259,8 +259,8 @@ static void __init setup_bootmem(void) if (memblock_end_of_DRAM() > max_mapped_addr) { memblock_cap_memory_range(phys_ram_base, max_mapped_addr - phys_ram_base); - pr_warn("Physical memory overflows the linear mapping size: region above 0x%llx removed", - max_mapped_addr); + pr_warn("Physical memory overflows the linear mapping size: region above %pa removed", + &max_mapped_addr); } } to fix it. > > [...] ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] riscv: add a warning when physical memory address overflows 2024-08-14 6:26 [PATCH] riscv: add a warning when physical memory address overflows Yunhui Cui 2024-08-15 11:01 ` Alexandre Ghiti @ 2025-01-30 14:10 ` patchwork-bot+linux-riscv 1 sibling, 0 replies; 6+ messages in thread From: patchwork-bot+linux-riscv @ 2025-01-30 14:10 UTC (permalink / raw) To: yunhui cui Cc: linux-riscv, punit.agrawal, paul.walmsley, palmer, aou, alexghiti, chenjiahao16, guoren, vishal.moola, stuart.menefy, linux-kernel Hello: This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <palmer@rivosinc.com>: On Wed, 14 Aug 2024 14:26:25 +0800 you wrote: > The part of physical memory that exceeds the size of the linear mapping > will be discarded. When the system starts up normally, a warning message > will be printed to prevent confusion caused by the mismatch between the > system memory and the actual physical memory. > > Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com> > > [...] Here is the summary with links: - riscv: add a warning when physical memory address overflows https://git.kernel.org/riscv/c/101971298be2 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-02-03 15:59 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-08-14 6:26 [PATCH] riscv: add a warning when physical memory address overflows Yunhui Cui 2024-08-15 11:01 ` Alexandre Ghiti 2024-09-18 3:49 ` [External] " yunhui cui 2024-10-23 14:25 ` Punit Agrawal 2025-02-03 15:59 ` Palmer Dabbelt 2025-01-30 14:10 ` 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