Skip to contentSkip to conversation

RISC-V: erizo: large gap between bss and stack regions

DISCUSSION Antony Pavlov 3 participants 7 messages Apr 14, 2021 – Apr 15, 2021

lore
Share & tools
lore
#0 lore raw

Hi Ahmad!

Here is the iomem command output on erizo:

barebox:/ iomem
0x00000000 - 0xffffffff (size 0x00000000) iomem
0x80000000 - 0x807fffff (size 0x00800000) ram0

    0x804ffd00 - 0x805ffcff (size 0x00100000) malloc space
    0x805ffd00 - 0x805fffe6 (size 0x000002e7) board data
    0x80600000 - 0x80636b1f (size 0x00036b20) barebox
    0x80636b20 - 0x8063ec9b (size 0x0000817c) barebox data
    0x8063ec9c - 0x80643147 (size 0x000044ac) bss
    0x807e0000 - 0x807fffff (size 0x00020000) stack

0x90000000 - 0x9000001f (size 0x00000020) [email protected] 0x91000000 - 0x91000003 (size 0x00000004) [email protected] 0x91000004 - 0x91000007 (size 0x00000004) [email protected]

I see large unused region between bss and stack regions (>1600 Kbytes).

For comparrison, the regions on mips malta are packed much more closely:

barebox@qemu malta:/ iomem
0x00000000 - 0xffffffff (size 0x00000000) iomem
0x180003f8 - 0x180003ff (size 0x00000008) [email protected] 0x1e000000 - 0x1e3fffff (size 0x00400000) [email protected] 0x1f000900 - 0x1f00093f (size 0x00000040) [email protected] 0x1f000b00 - 0x1f000b1f (size 0x00000020) [email protected] 0xa0000000 - 0xafffffff (size 0x10000000) kseg1_ram0

    0xafb39000 - 0xafb3ffff (size 0x00007000) stack
    0xafb40000 - 0xaff3ffff (size 0x00400000) malloc space
    0xaff40000 - 0xaffa417f (size 0x00064180) barebox
    0xaffa4180 - 0xafff263f (size 0x0004e4c0) barebox data
    0xafffa640 - 0xafffe7ab (size 0x0000416c) bss
Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 13 lines · Antony Pavlov

Hi Ahmad!

Here is the iomem command output on erizo:

barebox:/ iomem
0x00000000 - 0xffffffff (size 0x00000000) iomem
0x80000000 - 0x807fffff (size 0x00800000) ram0

    0x804ffd00 - 0x805ffcff (size 0x00100000) malloc space
    0x805ffd00 - 0x805fffe6 (size 0x000002e7) board data
    0x80600000 - 0x80636b1f (size 0x00036b20) barebox
    0x80636b20 - 0x8063ec9b (size 0x0000817c) barebox data
    0x8063ec9c - 0x80643147 (size 0x000044ac) bss
    0x807e0000 - 0x807fffff (size 0x00020000) stack
Quoted 5 lines

0x90000000 - 0x9000001f (size 0x00000020) [email protected] 0x91000000 - 0x91000003 (size 0x00000004) [email protected] 0x91000004 - 0x91000007 (size 0x00000004) [email protected]

I see large unused region between bss and stack regions (>1600 Kbytes).

That's normal. The compressed barebox knows the size of the uncompressed barebox, but it doesn't know the size of the bss segment above it. For that reason we have a very pessimistic estimate of:

#define MAX_BSS_SIZE SZ_1M

The barebox binary itself is then aligned to the previous 1MiB boundary, so barebox usually starts at 2MiB below the end of SDRAM. That's a bit wasteful for boards with very little memory like the erizo, but that's how things are at the moment.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw
Quoted 24 lines · On Wed, 14 Apr 2021 11:54:27 +0200 Sascha Hauer <[email protected]> wrote:
Quoted 13 lines · Antony Pavlov

Hi Ahmad!

Here is the iomem command output on erizo:

barebox:/ iomem
0x00000000 - 0xffffffff (size 0x00000000) iomem
0x80000000 - 0x807fffff (size 0x00800000) ram0

    0x804ffd00 - 0x805ffcff (size 0x00100000) malloc space
    0x805ffd00 - 0x805fffe6 (size 0x000002e7) board data
    0x80600000 - 0x80636b1f (size 0x00036b20) barebox
    0x80636b20 - 0x8063ec9b (size 0x0000817c) barebox data
    0x8063ec9c - 0x80643147 (size 0x000044ac) bss
    0x807e0000 - 0x807fffff (size 0x00020000) stack
Quoted 5 lines

0x90000000 - 0x9000001f (size 0x00000020) [email protected] 0x91000000 - 0x91000003 (size 0x00000004) [email protected] 0x91000004 - 0x91000007 (size 0x00000004) [email protected]

I see large unused region between bss and stack regions (>1600 Kbytes).

That's normal. The compressed barebox knows the size of the uncompressed barebox, but it doesn't know the size of the bss segment above it. For that reason we have a very pessimistic estimate of:

Quoted 6 lines

#define MAX_BSS_SIZE SZ_1M

The barebox binary itself is then aligned to the previous 1MiB boundary, so barebox usually starts at 2MiB below the end of SDRAM. That's a bit wasteful for boards with very little memory like the erizo, but that's how things are at the moment.

Can we make it configurable via Kconfig?

Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
Quoted 27 lines · Antony Pavlov
Quoted 24 lines · On Wed, 14 Apr 2021 11:54:27 +0200 Sascha Hauer <[email protected]> wrote:
Quoted 13 lines · Antony Pavlov

Hi Ahmad!

Here is the iomem command output on erizo:

barebox:/ iomem
0x00000000 - 0xffffffff (size 0x00000000) iomem
0x80000000 - 0x807fffff (size 0x00800000) ram0

    0x804ffd00 - 0x805ffcff (size 0x00100000) malloc space
    0x805ffd00 - 0x805fffe6 (size 0x000002e7) board data
    0x80600000 - 0x80636b1f (size 0x00036b20) barebox
    0x80636b20 - 0x8063ec9b (size 0x0000817c) barebox data
    0x8063ec9c - 0x80643147 (size 0x000044ac) bss
    0x807e0000 - 0x807fffff (size 0x00020000) stack
Quoted 5 lines

0x90000000 - 0x9000001f (size 0x00000020) [email protected] 0x91000000 - 0x91000003 (size 0x00000004) [email protected] 0x91000004 - 0x91000007 (size 0x00000004) [email protected]

I see large unused region between bss and stack regions (>1600 Kbytes).

That's normal. The compressed barebox knows the size of the uncompressed barebox, but it doesn't know the size of the bss segment above it. For that reason we have a very pessimistic estimate of:

Quoted 8 lines
Quoted 6 lines

#define MAX_BSS_SIZE SZ_1M

The barebox binary itself is then aligned to the previous 1MiB boundary, so barebox usually starts at 2MiB below the end of SDRAM. That's a bit wasteful for boards with very little memory like the erizo, but that's how things are at the moment.

Can we make it configurable via Kconfig?

Or even better: Could we easily add to the piggy data the size of bss it contains?

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw
Quoted 35 lines · On Wed, 14 Apr 2021 13:20:44 +0200 Ahmad Fatoum <[email protected]> wrote:
Quoted 34 lines · Antony Pavlov
Quoted 30 lines · On Wed, 14 Apr 2021 11:54:27 +0200 Sascha Hauer <[email protected]> wrote:
Quoted 13 lines · Antony Pavlov

Hi Ahmad!

Here is the iomem command output on erizo:

barebox:/ iomem
0x00000000 - 0xffffffff (size 0x00000000) iomem
0x80000000 - 0x807fffff (size 0x00800000) ram0

    0x804ffd00 - 0x805ffcff (size 0x00100000) malloc space
    0x805ffd00 - 0x805fffe6 (size 0x000002e7) board data
    0x80600000 - 0x80636b1f (size 0x00036b20) barebox
    0x80636b20 - 0x8063ec9b (size 0x0000817c) barebox data
    0x8063ec9c - 0x80643147 (size 0x000044ac) bss
    0x807e0000 - 0x807fffff (size 0x00020000) stack
Quoted 5 lines

0x90000000 - 0x9000001f (size 0x00000020) [email protected] 0x91000000 - 0x91000003 (size 0x00000004) [email protected] 0x91000004 - 0x91000007 (size 0x00000004) [email protected]

I see large unused region between bss and stack regions (>1600 Kbytes).

That's normal. The compressed barebox knows the size of the uncompressed barebox, but it doesn't know the size of the bss segment above it. For that reason we have a very pessimistic estimate of:

#define MAX_BSS_SIZE SZ_1M

The barebox binary itself is then aligned to the previous 1MiB boundary, so barebox usually starts at 2MiB below the end of SDRAM. That's a bit wasteful for boards with very little memory like the erizo, but that's how things are at the moment.

Quoted 5 lines
Quoted 1 line

Can we make it configurable via Kconfig?

Or even better: Could we easily add to the piggy data the size of bss it contains?

On MIPS we already have:

   bss_len = (unsigned long)&__bss_stop - (unsigned long)__bss_start;

On RISC-V we have __bss_stop and __bss_start, but we don't use them as MIPS does.

P.S. hmmm... why there is '&' prior to __bss_stop on MIPS and there is no '&' prior to __bss_start?

Quoted 5 lines
Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw
Quoted 40 lines · Antony Pavlov
Quoted 37 lines · On Wed, 14 Apr 2021 13:20:44 +0200 Ahmad Fatoum <[email protected]> wrote:
Quoted 35 lines · Antony Pavlov
Quoted 24 lines · On Wed, 14 Apr 2021 11:54:27 +0200 Sascha Hauer <[email protected]> wrote:
Quoted 13 lines · Antony Pavlov

Hi Ahmad!

Here is the iomem command output on erizo:

barebox:/ iomem
0x00000000 - 0xffffffff (size 0x00000000) iomem
0x80000000 - 0x807fffff (size 0x00800000) ram0

    0x804ffd00 - 0x805ffcff (size 0x00100000) malloc space
    0x805ffd00 - 0x805fffe6 (size 0x000002e7) board data
    0x80600000 - 0x80636b1f (size 0x00036b20) barebox
    0x80636b20 - 0x8063ec9b (size 0x0000817c) barebox data
    0x8063ec9c - 0x80643147 (size 0x000044ac) bss
    0x807e0000 - 0x807fffff (size 0x00020000) stack
Quoted 5 lines

0x90000000 - 0x9000001f (size 0x00000020) [email protected] 0x91000000 - 0x91000003 (size 0x00000004) [email protected] 0x91000004 - 0x91000007 (size 0x00000004) [email protected]

I see large unused region between bss and stack regions (>1600 Kbytes).

That's normal. The compressed barebox knows the size of the uncompressed barebox, but it doesn't know the size of the bss segment above it. For that reason we have a very pessimistic estimate of:

Quoted 6 lines

#define MAX_BSS_SIZE SZ_1M

The barebox binary itself is then aligned to the previous 1MiB boundary, so barebox usually starts at 2MiB below the end of SDRAM. That's a bit wasteful for boards with very little memory like the erizo, but that's how things are at the moment.

Can we make it configurable via Kconfig?

Quoted 7 lines
Quoted 3 lines

Or even better: Could we easily add to the piggy data the size of bss it contains?

On MIPS we already have:

   bss_len = (unsigned long)&__bss_stop - (unsigned long)__bss_start;

When running in the decompressor that gives you the bss size of the decompressor binary, but we need the bss size of barebox proper.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw
In reply to Ahmad Fatoum
Quoted 35 lines · Ahmad Fatoum
Quoted 34 lines · Antony Pavlov
Quoted 30 lines · On Wed, 14 Apr 2021 11:54:27 +0200 Sascha Hauer <[email protected]> wrote:
Quoted 13 lines · Antony Pavlov

Hi Ahmad!

Here is the iomem command output on erizo:

barebox:/ iomem
0x00000000 - 0xffffffff (size 0x00000000) iomem
0x80000000 - 0x807fffff (size 0x00800000) ram0

    0x804ffd00 - 0x805ffcff (size 0x00100000) malloc space
    0x805ffd00 - 0x805fffe6 (size 0x000002e7) board data
    0x80600000 - 0x80636b1f (size 0x00036b20) barebox
    0x80636b20 - 0x8063ec9b (size 0x0000817c) barebox data
    0x8063ec9c - 0x80643147 (size 0x000044ac) bss
    0x807e0000 - 0x807fffff (size 0x00020000) stack
Quoted 5 lines

0x90000000 - 0x9000001f (size 0x00000020) [email protected] 0x91000000 - 0x91000003 (size 0x00000004) [email protected] 0x91000004 - 0x91000007 (size 0x00000004) [email protected]

I see large unused region between bss and stack regions (>1600 Kbytes).

That's normal. The compressed barebox knows the size of the uncompressed barebox, but it doesn't know the size of the bss segment above it. For that reason we have a very pessimistic estimate of:

#define MAX_BSS_SIZE SZ_1M

The barebox binary itself is then aligned to the previous 1MiB boundary, so barebox usually starts at 2MiB below the end of SDRAM. That's a bit wasteful for boards with very little memory like the erizo, but that's how things are at the moment.

Quoted 4 lines
Quoted 1 line

Can we make it configurable via Kconfig?

Or even better: Could we easily add to the piggy data the size of bss it contains?

That probably depends on your definition of 'easily', but that would be the preferred solution for me as well.
We already include a sha256 of the compressed image in the pbl binary, maybe we could include the bss size in a similar way.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox