2020-12-03 03:21:30

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH 2/2] MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug

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 <[email protected]>
---
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
--
2.1.0


2020-12-03 04:04:50

by Jiaxun Yang

[permalink] [raw]
Subject: Re: [PATCH 2/2] MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug



?? 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 <[email protected]>
> ---
> 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

2020-12-04 12:14:15

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH 2/2] MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug

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.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]

2020-12-05 05:10:27

by Tiezhu Yang

[permalink] [raw]
Subject: Re: [PATCH 2/2] MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug

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.
>