| #
5e70edb1 |
| 18-May-2021 |
Jerome Forissier <jerome@forissier.org> |
mem_usage.py: consider all allocatable sections
All allocatable sections end up using memory when the TEE binary is loaded. Therefore the 'A' (allocatable) flag in the readelf output is all that mat
mem_usage.py: consider all allocatable sections
All allocatable sections end up using memory when the TEE binary is loaded. Therefore the 'A' (allocatable) flag in the readelf output is all that matters when gathering memory usage data using mem_usage.py. The combinations that are currently hardcoded in the script ('AX', 'WA', 'A', 'AL') are fragile and need to be replaced. For example, with COMPILER=clang many sections have the 'W' flag set.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
479c49dd |
| 29-Nov-2019 |
Jerome Forissier <jerome@forissier.org> |
mem_usage.py: stop parsing file when _end_of_ram is reached
Since commit 5966660c02b3 ("core: move relocation to embedded data region"), when ASLR is enabled, some sections are stored at the end of
mem_usage.py: stop parsing file when _end_of_ram is reached
Since commit 5966660c02b3 ("core: move relocation to embedded data region"), when ASLR is enabled, some sections are stored at the end of tee.elf for use by gen_tee_bin.py which then discards them. As a result, they are not present in the final binary and should not be reported by the memory usage script.
By ignoring any section past the _end_of_ram symbol, we avoid reporting those discarded sections as well as a hole before them.
Before:
$ make -s CFG_CORE_ASLR=y $ scripts/mem_usage.py out/arm-plat-vexpress/core/tee.elf RAM Usage 0E100000 - 0E301E04 size 00201E04 2056 KiB 514 pages .text 0E100000 - 0E12FA68 size 0002FA68 190 KiB *hole* 0E12FA68 - 0E130000 size 00000598 1 KiB .rodata 0E130000 - 0E140598 size 00010598 65 KiB .gnu.hash 0E140598 - 0E1405B0 size 00000018 0 KiB .got 0E1405B0 - 0E1406F8 size 00000148 0 KiB .ARM.exidx 0E1406F8 - 0E142B78 size 00002480 9 KiB .ARM.extab 0E142B78 - 0E143274 size 000006FC 1 KiB *hole* 0E143274 - 0E144000 size 00000D8C 3 KiB .data 0E144000 - 0E145410 size 00001410 5 KiB .bss 0E145410 - 0E1509A8 size 0000B598 45 KiB .heap1 0E1509A8 - 0E164000 size 00013658 77 KiB .nozi 0E164000 - 0E176B80 size 00012B80 74 KiB *hole* 0E176B80 - 0E300000 size 00189480 1573 KiB .dynamic 0E300000 - 0E300098 size 00000098 0 KiB .hash 0E300098 - 0E3000B0 size 00000018 0 KiB .dynsym 0E3000B0 - 0E3000E0 size 00000030 0 KiB .dynstr 0E3000E0 - 0E3000E1 size 00000001 0 KiB *hole* 0E3000E1 - 0E3000E4 size 00000003 0 KiB .rel 0E3000E4 - 0E301E04 size 00001D20 7 KiB
After:
$ make -s CFG_CORE_ASLR=y $ scripts/mem_usage.py out/arm-plat-vexpress/core/tee.elf RAM Usage 0E100000 - 0E176B80 size 00076B80 475 KiB 119 pages .text 0E100000 - 0E12FA68 size 0002FA68 190 KiB *hole* 0E12FA68 - 0E130000 size 00000598 1 KiB .rodata 0E130000 - 0E140598 size 00010598 65 KiB .gnu.hash 0E140598 - 0E1405B0 size 00000018 0 KiB .got 0E1405B0 - 0E1406F8 size 00000148 0 KiB .ARM.exidx 0E1406F8 - 0E142B78 size 00002480 9 KiB .ARM.extab 0E142B78 - 0E143274 size 000006FC 1 KiB *hole* 0E143274 - 0E144000 size 00000D8C 3 KiB .data 0E144000 - 0E145410 size 00001410 5 KiB .bss 0E145410 - 0E1509A8 size 0000B598 45 KiB .heap1 0E1509A8 - 0E164000 size 00013658 77 KiB .nozi 0E164000 - 0E176B80 size 00012B80 74 KiB
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
146cbc4f |
| 14-Nov-2018 |
Jerome Forissier <jerome.forissier@linaro.org> |
mem_usage.py: fix issues reported by pycodestyle
Fixes issues reported by: pycodestyle mem_usage.py. Patch obtained by running: autopep8 -i -a mem_usage.py.
Signed-off-by: Jerome Forissier <jerome.
mem_usage.py: fix issues reported by pycodestyle
Fixes issues reported by: pycodestyle mem_usage.py. Patch obtained by running: autopep8 -i -a mem_usage.py.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
b1d7375c |
| 15-Dec-2017 |
Jerome Forissier <jerome.forissier@linaro.org> |
Remove 'All rights reserved' from Linaro files
The text 'All rights reserved' is useless [1]. The Free Software Foundation's REUSE Initiative best practices document [2] does not contain these words
Remove 'All rights reserved' from Linaro files
The text 'All rights reserved' is useless [1]. The Free Software Foundation's REUSE Initiative best practices document [2] does not contain these words. Therefore, we can safely remove the text from the files that are owned by Linaro.
Generated by: spdxify.py --linaro-only --strip-arr optee_os/
Link: [1] https://en.wikipedia.org/wiki/All_rights_reserved Link: [2] https://reuse.software/practices/ Link: [3] https://github.com/jforissier/misc/blob/f7b56c8/spdxify.py Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org>
show more ...
|
| #
edbeddc1 |
| 21-Nov-2017 |
Jerome Forissier <jerome.forissier@linaro.org> |
mem_usage.py: fix error with ccache
Fix the following error:
make mem_usage CROSS_COMPILE="ccache arm-linux-gnueabihf-" ... GEN out/arm-plat-vexpress/core/tee.mem_usage Traceback (most recent
mem_usage.py: fix error with ccache
Fix the following error:
make mem_usage CROSS_COMPILE="ccache arm-linux-gnueabihf-" ... GEN out/arm-plat-vexpress/core/tee.mem_usage Traceback (most recent call last): File "./scripts/mem_usage.py", line 162, in <module> main() File "./scripts/mem_usage.py", line 94, in main universal_newlines=True) File "/usr/lib/python3.5/subprocess.py", line 947, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child raise child_exception_type(errno_num, err_msg) FileNotFoundError: [Errno 2] No such file or directory: 'ccache arm-linux-gnueabihf-readelf' core/arch/arm/kernel/link.mk:255: recipe for target 'out/arm-plat-vexpress/core/tee.mem_usage' failed make: *** [out/arm-plat-vexpress/core/tee.mem_usage] Error 1
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
3be7773f |
| 09-Nov-2017 |
Jerome Forissier <jerome.forissier@linaro.org> |
Add pager options to mem_usage.py
Adds options to report the size of the init, paged and unpaged areas in pager builds (CFG_WITH_PAGER=y). This is helpful to monitor the evolution of the code size,
Add pager options to mem_usage.py
Adds options to report the size of the init, paged and unpaged areas in pager builds (CFG_WITH_PAGER=y). This is helpful to monitor the evolution of the code size, and identify issues such as when useless functions get pulled into the unpaged area by mistake. For instance, here is what we can get with 'mem_usage.py -nUr' and a few lines of script (shows changes in the size of unpaged code and data for a non-debug qemu_virt build since 2.5.0):
2.5.0 67600 2.5.0-2-g0b8e6e78 67632 +32 core: abort: fix get_fault_type() 2.5.0-11-g87d96185 67728 +96 core: pager: avoid page faults with pager lock held 2.5.0-37-g0073c9a8 67792 +64 core: pager: optimize tee_pager_handle_fault() 2.5.0-40-g935ac3ec 67888 +96 core: arm32: handle aborts in system mode 2.5.0-53-g2e4e94bf 67920 +32 core: default enable program flow prediction on ARMv7 cores 2.5.0-57-ge84e1fec 67704 -216 core: clean and unwind arm32_aeabi_[l]divmod_a32.S 2.5.0-63-g23346f16 67736 +32 Add support for several user TA stores 2.5.0-76-gb2087a20 67608 -128 core: pager: deal with large CFG_TEE_RAM_VA_SIZE 2.5.0-77-g00aa47a4 67688 +80 core: plat-vexpress: increase CFG_TEE_RAM_VA_SIZE 2.5.0-112-g86e50a60 67696 +8 core: arm: psci: add suspend resume common functions 2.5.0-120-g13b3ee90 67768 +72 core: print rwx flags for each MMU region when a user TA aborts 2.5.0-122-ge61644fb 83408 +15640 core: make reset_secondary() unpaged 2.5.0-123-g1506eb6f 83424 +16 core: plat-vexpress: init gic on secondary cores 2.5.0-124-ge2b68c87 91368 +7944 core: plat-vextpress-qemu_virt: update num cores 2.5.0-126-g5402a9fe 92808 +1440 qemu_virt: enable smp boot 2.5.0-132-gda51216b 92840 +32 dts: pass PA of reserved region 2.5.0-173-gb4121bfb 92848 +8 pl011: prevent putc() and flush() function from blocking indefinitely 2.5.0-176-g55d6853c 92912 +64 core: add registered shared memory support 2.5.0-182-g93d3c451 163936 +71024 core: pager: ltc: prng: add entropy to the AE key for paged TAs 2.5.0-202-ga71af55e 163984 +48 core: mobj: add mobj_get_phys_offs() 2.5.0-203-g5c7a19bb 163968 -16 core: mobj: remove double physical offset 2.5.0-205-g430dcbd8 163944 -24 core: reimplement mobj_mapped_shm_alloc() 2.5.0-208-gbbed97b6 163976 +32 core:mmu: fix userland va2pa conversion 2.5.0-209-g42d91b4b 164040 +64 core:mmu: fix userland pa2va conversion 2.6.0-rc1-1-gb6449075 164136 +96 thread.c: free rpc arg mobj during cache disabling 2.6.0-7-g8473540d 77144 -86992 Keep assembly functions in separate sections 2.6.0-8-g64113fca 77112 -32 core: arm32: replace _start with reset() function 2.6.0-9-g486754e8 77176 +64 core: arm32: reset_secondary() set reset vector
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| #
abaf1209 |
| 08-Nov-2017 |
Jerome Forissier <jerome.forissier@linaro.org> |
Rewrite mem_usage.awk in Python
Rewrite the memory usage script in Python. No functional change, except that the script now takes tee.elf as an argument instead of processing the output of readelf.
Rewrite mem_usage.awk in Python
Rewrite the memory usage script in Python. No functional change, except that the script now takes tee.elf as an argument instead of processing the output of readelf. The makefile (make mem_usage) is adjusted accordingly.
This makes the script shorter and easier to call, and it is now possible to add command line options.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|