spl: add debug print for early malloc usage
PATCH 1/1 spl: add debug print for early malloc usage
To find out how big the early malloc heap must be in SPL, add a debug print statement that dumps its usage before switching to relocated heap in spl_relocate_stack_gd() via CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN.
---
common/spl/spl.c | 2 ++ 1 file changed, 2 insertions(+)
common/spl/spl.c +2 -0
@@ -728,6 +728,8 @@ ulong spl_relocate_stack_gd(void)#if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE ) &&CONFIG_VAL (SYS_MALLOC_F_LEN )if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ) { +debug ("SPL malloc() before relocation used 0x%lx bytes (%ld KB)\n" , + gd->malloc_ptr, gd->malloc_ptr /1024 ); ptr -=CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ; gd->malloc_base = ptr; gd->malloc_limit =CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ;
Signature · 1 line
2.17.1
Quoted 5 lines · Simon Goldschmidt
To find out how big the early malloc heap must be in SPL, add a debug print statement that dumps its usage before switching to relocated heap in
spl_relocate_stack_gd()viaCONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN.Signed-off-by Simon Goldschmidt <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190228/3cb99d12/attachment.sig>
PATCH 1/1 spl: add debug print for early malloc usage
In reply to Simon GoldschmidtQuoted 15 lines · Simon Goldschmidt
To find out how big the early malloc heap must be in SPL, add a debug print statement that dumps its usage before switching to relocated heap in
spl_relocate_stack_gd()viaCONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN.Signed-off-by Simon Goldschmidt <[email protected]>---
common/spl/spl.c | 2 ++ 1 file changed, 2 insertions(+)common/spl/spl.c +0
-0
common/spl/spl.c ulong spl_relocate_stack_gd(void) · line 732
Quoted 5 lines
common/spl/spl.c +2
-0@@ -728,6 +728,8 @@ ulong spl_relocate_stack_gd(void)#if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE ) &&CONFIG_VAL (SYS_MALLOC_F_LEN )if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ) { +debug ("SPL malloc() before relocation used 0x%lx bytes (%ld KB)\n" , + gd->malloc_ptr, gd->malloc_ptr /1024 );
Shouldn't this use %p ?
Quoted 4 lines
common/spl/spl.c +0
-0ptr -=CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ; gd->malloc_base = ptr; gd->malloc_limit =CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ;
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 spl: add debug print for early malloc usage
Quoted 18 lines · Marek Vasut
Quoted 16 lines · Simon Goldschmidt
To find out how big the early malloc heap must be in SPL, add a debug print statement that dumps its usage before switching to relocated heap in
spl_relocate_stack_gd()viaCONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN.Signed-off-by Simon Goldschmidt <[email protected]>---
common/spl/spl.c | 2 ++ 1 file changed, 2 insertions(+)common/spl/spl.c +0
-0@@ -728,6 +728,8 @@ ulong spl_relocate_stack_gd(void)
Quoted 6 lines
common/spl/spl.c ulong spl_relocate_stack_gd(void) · line 732
Quoted 4 lines
common/spl/spl.c +2
-0#if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE ) &&CONFIG_VAL (SYS_MALLOC_F_LEN )if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ) { +debug ("SPL malloc() before relocation used 0x%lx bytes (%ld KB)\n" , + gd->malloc_ptr, gd->malloc_ptr /1024 );Shouldn't this use %p ?
Despite its name, 'gd->malloc_ptr' is of type 'unsigned long', so I think this is
correct. After all, I only copied the code from other places where the heap usage is dumped, too.
Regards,
Simon
Quoted 10 lines
common/spl/spl.c ulong spl_relocate_stack_gd(void) · line 735
Quoted 5 lines
common/spl/spl.c +0
-0ptr -=CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ; gd->malloc_base = ptr; gd->malloc_limit =CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ;--
Best regards,
Marek Vasut
PATCH 1/1 spl: add debug print for early malloc usage
Quoted 26 lines · Simon Goldschmidt
Quoted 18 lines · Marek Vasut
Quoted 16 lines · Simon Goldschmidt
To find out how big the early malloc heap must be in SPL, add a debug print statement that dumps its usage before switching to relocated heap in
spl_relocate_stack_gd()viaCONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN.Signed-off-by Simon Goldschmidt <[email protected]>---
common/spl/spl.c | 2 ++ 1 file changed, 2 insertions(+)common/spl/spl.c +0
-0@@ -728,6 +728,8 @@ ulong spl_relocate_stack_gd(void)Quoted 6 lines
common/spl/spl.c ulong spl_relocate_stack_gd(void) · line 732
Quoted 4 lines
common/spl/spl.c +2
-0#if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE ) &&CONFIG_VAL (SYS_MALLOC_F_LEN )if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ) { +debug ("SPL malloc() before relocation used 0x%lx bytes (%ld KB)\n" , + gd->malloc_ptr, gd->malloc_ptr /1024 );Shouldn't this use %p ?
Quoted 4 lines
Despite its name, '
gd->malloc_ptr' is of type 'unsigned long', so I think this is
correct. After all, I only copied the code from other places where the heap usage is dumped, too.
Isn't that broken on some arm64 systems then ? :)
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 spl: add debug print for early malloc usage
Quoted 28 lines · Marek Vasut
Quoted 26 lines · Simon Goldschmidt
Quoted 24 lines · Marek Vasut
Quoted 15 lines · Simon Goldschmidt
To find out how big the early malloc heap must be in SPL, add a debug print statement that dumps its usage before switching to relocated heap in
spl_relocate_stack_gd()viaCONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN.Signed-off-by Simon Goldschmidt <[email protected]>---
common/spl/spl.c | 2 ++ 1 file changed, 2 insertions(+)common/spl/spl.c +0
-0common/spl/spl.c ulong spl_relocate_stack_gd(void) · line 732
Quoted 5 lines
common/spl/spl.c +2
-0@@ -728,6 +728,8 @@ ulong spl_relocate_stack_gd(void)#if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE ) &&CONFIG_VAL (SYS_MALLOC_F_LEN )if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ) { +debug ("SPL malloc() before relocation used 0x%lx bytes (%ld KB)\n" , + gd->malloc_ptr, gd->malloc_ptr /1024 );Shouldn't this use %p ?
Quoted 6 lines
Quoted 4 lines
Despite its name, '
gd->malloc_ptr' is of type 'unsigned long', so I think this is
correct. After all, I only copied the code from other places where the heap usage is dumped, too.Isn't that broken on some arm64 systems then ? :)
I don't think it's broken for 'ptr' as that seems to be the offset into the malloc pool.
Some 64-bit platforms migth have a problem with gd->malloc_base being unsigned long though - I don't know the size of unsigned long on arm64.
Regards,
Simon