diff mbox series

[2/2] MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug

Message ID 1606965544-22611-3-git-send-email-yangtiezhu@loongson.cn (mailing list archive)
State Superseded
Headers show
Series memblock debug | expand

Commit Message

Tiezhu Yang Dec. 3, 2020, 3:19 a.m. UTC
In the current code, CONFIG_ARCH_KEEP_MEMBLOCK is not set for MIPS arch,
memblock_discard() will discard memory and reserved arrays if they were
allocated, select ARCH_KEEP_MEMBLOCK to give a chance to track "memory"
and "reserved" memblocks after early boot, with this patch, we can see
the following two sysfs interfaces under DEBUG_FS.

/sys/kernel/debug/memblock/memory
/sys/kernel/debug/memblock/reserved

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/mips/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Jiaxun Yang Dec. 3, 2020, 3:58 a.m. UTC | #1
在 2020/12/3 上午11:19, Tiezhu Yang 写道:
> In the current code, CONFIG_ARCH_KEEP_MEMBLOCK is not set for MIPS arch,
> memblock_discard() will discard memory and reserved arrays if they were
> allocated, select ARCH_KEEP_MEMBLOCK to give a chance to track "memory"
> and "reserved" memblocks after early boot, with this patch, we can see
> the following two sysfs interfaces under DEBUG_FS.
>
> /sys/kernel/debug/memblock/memory
> /sys/kernel/debug/memblock/reserved

Is this really necessary?
memblock data is not really necessary after boot for non-debug purpose.

Given that MIPS is widely used in embedded systems which doesn't have much
memory, keeping unused data after boot is kinda unconvincing.

If you intend to debug that please do it locally.

Thanks.

- Jiaxun


>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>   arch/mips/Kconfig | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 44a47ad..f65da197 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -9,6 +9,7 @@ config MIPS
>   	select ARCH_HAS_PTE_SPECIAL if !(32BIT && CPU_HAS_RIXI)
>   	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
>   	select ARCH_HAS_UBSAN_SANITIZE_ALL
> +	select ARCH_KEEP_MEMBLOCK
>   	select ARCH_SUPPORTS_UPROBES
>   	select ARCH_USE_BUILTIN_BSWAP
>   	select ARCH_USE_CMPXCHG_LOCKREF if 64BIT
Thomas Bogendoerfer Dec. 4, 2020, 12:08 p.m. UTC | #2
On Thu, Dec 03, 2020 at 11:58:51AM +0800, Jiaxun Yang wrote:
> 
> 
> 在 2020/12/3 上午11:19, Tiezhu Yang 写道:
> > In the current code, CONFIG_ARCH_KEEP_MEMBLOCK is not set for MIPS arch,
> > memblock_discard() will discard memory and reserved arrays if they were
> > allocated, select ARCH_KEEP_MEMBLOCK to give a chance to track "memory"
> > and "reserved" memblocks after early boot, with this patch, we can see
> > the following two sysfs interfaces under DEBUG_FS.
> > 
> > /sys/kernel/debug/memblock/memory
> > /sys/kernel/debug/memblock/reserved
> 
> Is this really necessary?
> memblock data is not really necessary after boot for non-debug purpose.
> 
> Given that MIPS is widely used in embedded systems which doesn't have much
> memory, keeping unused data after boot is kinda unconvincing.

about how much memory are talking here ?

> 
> If you intend to debug that please do it locally.

maybe we can add a

if DEBUG_KERNEL 

since enabling DEBUG_KERNEL will cost already some memory...

Thomas.
Tiezhu Yang Dec. 5, 2020, 5:05 a.m. UTC | #3
On 12/04/2020 08:08 PM, Thomas Bogendoerfer wrote:
> On Thu, Dec 03, 2020 at 11:58:51AM +0800, Jiaxun Yang wrote:
>>
>> 在 2020/12/3 上午11:19, Tiezhu Yang 写道:
>>> In the current code, CONFIG_ARCH_KEEP_MEMBLOCK is not set for MIPS arch,
>>> memblock_discard() will discard memory and reserved arrays if they were
>>> allocated, select ARCH_KEEP_MEMBLOCK to give a chance to track "memory"
>>> and "reserved" memblocks after early boot, with this patch, we can see
>>> the following two sysfs interfaces under DEBUG_FS.
>>>
>>> /sys/kernel/debug/memblock/memory
>>> /sys/kernel/debug/memblock/reserved
>> Is this really necessary?
>> memblock data is not really necessary after boot for non-debug purpose.
>>
>> Given that MIPS is widely used in embedded systems which doesn't have much
>> memory, keeping unused data after boot is kinda unconvincing.
> about how much memory are talking here ?
>
>> If you intend to debug that please do it locally.
> maybe we can add a
>
> if DEBUG_KERNEL
>
> since enabling DEBUG_KERNEL will cost already some memory...

Yes, that makes sense.

If nobody has any objections, I will send v2 in the next week.

Thanks,
Tiezhu

>
> Thomas.
>
diff mbox series

Patch

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 44a47ad..f65da197 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -9,6 +9,7 @@  config MIPS
 	select ARCH_HAS_PTE_SPECIAL if !(32BIT && CPU_HAS_RIXI)
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAS_UBSAN_SANITIZE_ALL
+	select ARCH_KEEP_MEMBLOCK
 	select ARCH_SUPPORTS_UPROBES
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF if 64BIT