linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] memblock debug
@ 2020-12-03  3:19 Tiezhu Yang
  2020-12-03  3:19 ` [PATCH 1/2] MIPS: Move memblock_dump_all() to the end of setup_arch() Tiezhu Yang
  2020-12-03  3:19 ` [PATCH 2/2] MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug Tiezhu Yang
  0 siblings, 2 replies; 7+ messages in thread
From: Tiezhu Yang @ 2020-12-03  3:19 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel, Xuefeng Li

Tiezhu Yang (2):
  MIPS: Move memblock_dump_all() to the end of setup_arch()
  MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug

 arch/mips/Kconfig        | 1 +
 arch/mips/kernel/setup.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] MIPS: Move memblock_dump_all() to the end of setup_arch()
  2020-12-03  3:19 [PATCH 0/2] memblock debug Tiezhu Yang
@ 2020-12-03  3:19 ` Tiezhu Yang
  2020-12-04 12:07   ` Thomas Bogendoerfer
  2020-12-03  3:19 ` [PATCH 2/2] MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug Tiezhu Yang
  1 sibling, 1 reply; 7+ messages in thread
From: Tiezhu Yang @ 2020-12-03  3:19 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel, Xuefeng Li

In order to get more memblock configuration with memblock=debug in the boot
cmdline, move memblock_dump_all() to the end of setup_arch(), this can help
us to get dmi_setup() and resource_init() memblock info, at least for now.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/mips/kernel/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index ca579de..8155e96 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -688,8 +688,6 @@ static void __init arch_mem_init(char **cmdline_p)
 
 	fdt_init_reserved_mem();
 
-	memblock_dump_all();
-
 	early_memtest(PFN_PHYS(ARCH_PFN_OFFSET), PFN_PHYS(max_low_pfn));
 }
 
@@ -787,6 +785,8 @@ void __init setup_arch(char **cmdline_p)
 
 	cpu_cache_init();
 	paging_init();
+
+	memblock_dump_all();
 }
 
 unsigned long kernelsp[NR_CPUS];
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug
  2020-12-03  3:19 [PATCH 0/2] memblock debug Tiezhu Yang
  2020-12-03  3:19 ` [PATCH 1/2] MIPS: Move memblock_dump_all() to the end of setup_arch() Tiezhu Yang
@ 2020-12-03  3:19 ` Tiezhu Yang
  2020-12-03  3:58   ` Jiaxun Yang
  1 sibling, 1 reply; 7+ messages in thread
From: Tiezhu Yang @ 2020-12-03  3:19 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel, Xuefeng Li

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(+)

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug
  2020-12-03  3:19 ` [PATCH 2/2] MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug Tiezhu Yang
@ 2020-12-03  3:58   ` Jiaxun Yang
  2020-12-04 12:08     ` Thomas Bogendoerfer
  0 siblings, 1 reply; 7+ messages in thread
From: Jiaxun Yang @ 2020-12-03  3:58 UTC (permalink / raw)
  To: Tiezhu Yang, Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel, Xuefeng Li



在 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] MIPS: Move memblock_dump_all() to the end of setup_arch()
  2020-12-03  3:19 ` [PATCH 1/2] MIPS: Move memblock_dump_all() to the end of setup_arch() Tiezhu Yang
@ 2020-12-04 12:07   ` Thomas Bogendoerfer
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Bogendoerfer @ 2020-12-04 12:07 UTC (permalink / raw)
  To: Tiezhu Yang; +Cc: linux-mips, linux-kernel, Xuefeng Li

On Thu, Dec 03, 2020 at 11:19:03AM +0800, Tiezhu Yang wrote:
> In order to get more memblock configuration with memblock=debug in the boot
> cmdline, move memblock_dump_all() to the end of setup_arch(), this can help
> us to get dmi_setup() and resource_init() memblock info, at least for now.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  arch/mips/kernel/setup.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

applied to mips-next.

Thomas.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug
  2020-12-03  3:58   ` Jiaxun Yang
@ 2020-12-04 12:08     ` Thomas Bogendoerfer
  2020-12-05  5:05       ` Tiezhu Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Bogendoerfer @ 2020-12-04 12:08 UTC (permalink / raw)
  To: Jiaxun Yang; +Cc: Tiezhu Yang, linux-mips, linux-kernel, Xuefeng Li

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 ]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug
  2020-12-04 12:08     ` Thomas Bogendoerfer
@ 2020-12-05  5:05       ` Tiezhu Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Tiezhu Yang @ 2020-12-05  5:05 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Jiaxun Yang; +Cc: linux-mips, linux-kernel, Xuefeng Li

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-05  5:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03  3:19 [PATCH 0/2] memblock debug Tiezhu Yang
2020-12-03  3:19 ` [PATCH 1/2] MIPS: Move memblock_dump_all() to the end of setup_arch() Tiezhu Yang
2020-12-04 12:07   ` Thomas Bogendoerfer
2020-12-03  3:19 ` [PATCH 2/2] MIPS: Select ARCH_KEEP_MEMBLOCK to enable sysfs memblock debug Tiezhu Yang
2020-12-03  3:58   ` Jiaxun Yang
2020-12-04 12:08     ` Thomas Bogendoerfer
2020-12-05  5:05       ` Tiezhu Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).