btf/kallsyms based eppic extension for mm page filtering
Subsystems (3)
cover btf/kallsyms based eppic extension for mm page filtering
A) This patchset will introduce the following features to makedumpfile:
1) Enable eppic script for memory pages filtering.
2) Enable btf and kallsyms for symbol type and address resolving.
3) Port maple tree data structures and functions, primarily used for vma iteration.
B) The purpose of the features are:
1) Currently makedumpfile filters mm pages based on page flags, because flags can help to determine one page's usage. But this page-flag-checking method lacks of flexibility in certain cases, e.g. if we want to filter those mm pages occupied by GPU during vmcore dumping due to:
a) GPU may be taking a large memory and contains sensitive data;
b) GPU mm pages have no relations to kernel crash and useless for vmcore analysis.
But there is no GPU mm page specific flags, and apparently we don't need to create one just for kdump use. A programmable filtering tool is more suitable for such cases. In addition, different GPU vendors may use different ways for mm pages allocating, programmable filtering is better than hard coding these GPU specific logics into makedumpfile in this case.
2) Currently makedumpfile already contains a programmable filtering tool, aka eppic script, which allows user to write customized code for data erasing. However it has the following drawbacks:
a) cannot do mm page filtering.
b) need to access to debuginfo of both kernel and modules, which is not applicable in the 2nd kernel.
c) Poor performance, making vmcore dumping time unacceptable (See the following performance testing).
makedumpfile need to resolve the dwarf data from debuginfo, to get symbols types and addresses. In recent kernel there are dwarf alternatives such as btf/kallsyms which can be used for this purpose. And btf/kallsyms info are already packed within vmcore, so we can use it directly.
3) Maple tree data structures are used in recent kernels, such as vma iteration. So maple tree poring is needed.
With these, this patchset introduces an upgraded eppic, which is based on btf/kallsyms symbol resolving, and is programmable for mm page filtering. The following info shows its usage and performance, please note the tests are performed in 1st kernel:
$ time ./makedumpfile -d 31 -l /var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore
/tmp/dwarf.out -x /lib/debug/lib/modules/6.11.8-300.fc41.x86_64/vmlinux
--eppic eppic_scripts/filter_amdgpu_mm_pages.c
real 14m6.894s
user 4m16.900s
sys 9m44.695s $ time ./makedumpfile -d 31 -l /var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore
/tmp/btf.out --eppic eppic_scripts/filter_amdgpu_mm_pages.c
real 0m10.672s
user 0m9.270s
sys 0m1.130s -rw------- 1 root root 367475074 Jun 10 18:06 btf.out
-rw------- 1 root root 367475074 Jun 10 21:05 dwarf.out
-rw-rw-rw- 1 root root 387181418 Jun 10 18:03 /var/crash/127.0.0.1-2025-06-10-18:03:12/vmcore
C) Discussion:
1) GPU types: Currently only tested with amdgpu's mm page filtering, others are not tested.
2) Code structure: There are some similar code shared by makedumpfile and crash, such as maple tree data structure, also I planed to port the btf/kallsyms code to crash as well, so there are code duplications for crash & makedumpfile. Since I havn't working on crash poring, code change on btf/kallsyms is expected. How can we share the code, creating a common library or keep the duplication as it is?
3) OS: The code can work on rhel-10+/rhel9.5+ on x86_64/arm64/s390/ppc64. Others are not tested.
D) Testing:
1) If you don't want to create your vmcore, you can find a vmcore which I created with amdgpu mm pages unfiltered [1], the amdgpu mm pages are allocated by program [2]. You can use the vmcore in 1st kernel to filter the amdgpu mm pages by the previous performance testing cmdline. To verify the pages are filtered in crash:
Unfiltered:
crash> search -c "!QAZXSW@#EDC"
ffff96b7fa800000: !QAZXSW@#EDCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ffff96b87c800000: !QAZXSW@#EDCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX crash> rd ffff96b7fa800000
ffff96b7fa800000: 405753585a415121 !QAZXSW@
crash> rd ffff96b87c800000
ffff96b87c800000: 405753585a415121 !QAZXSW@
Filtered:
crash> search -c "!QAZXSW@#EDC"
crash> rd ffff96b7fa800000
rd: page excluded: kernel virtual address: ffff96b7fa800000 type: "64-bit KVADDR" crash> rd ffff96b87c800000
rd: page excluded: kernel virtual address: ffff96b87c800000 type: "64-bit KVADDR"
2) You can use eppic_scripts/print_all_vma.c against an ordinary vmcore to test only btf/kallsyms functions by output all VMAs if no amdgpu vmcores/machine avaliable.
[1]: https://people.redhat.com/~ltao/core/
[2]: https://gist.github.com/liutgnu/a8cbce1c666452f1530e1410d1f352df
Tao Liu (10):
dwarf_info: Support kernel address randomization
dwarf_info: Fix a infinite recursion bug for search_domain Add page filtering function
Add btf/kallsyms support for symbol type/address resolving Export necessary btf/kallsyms functions to eppic extension Port the maple tree data structures and functions Supporting main() as the entry of eppic script
Enable page filtering for dwarf eppic
Enable page filtering for btf/kallsyms eppic Introducing 2 eppic scripts to test the dwarf/btf eppic extension
Makefile | 6 +- btf.c | 919 +++++++++++++++++++++++++ btf.h | 176 +++++ dwarf_info.c | 15 +- eppic_maple.c | 431 ++++++++++++ eppic_maple.h | 8 + eppic_scripts/filter_amdgpu_mm_pages.c | 36 + eppic_scripts/print_all_vma.c | 29 + erase_info.c | 123 +++- erase_info.h | 22 + extension_btf.c | 218 ++++++ extension_eppic.c | 41 +- extension_eppic.h | 6 +- kallsyms.c | 371 ++++++++++ kallsyms.h | 42 ++ makedumpfile.c | 21 +- makedumpfile.h | 11 + 17 files changed, 2448 insertions(+), 27 deletions(-) create mode 100644 btf.c create mode 100644 btf.h create mode 100644 eppic_maple.c create mode 100644 eppic_maple.h create mode 100644 eppic_scripts/filter_amdgpu_mm_pages.c create mode 100644 eppic_scripts/print_all_vma.c create mode 100644 extension_btf.c create mode 100644 kallsyms.c create mode 100644 kallsyms.h
Signature · 1 line
2.47.0
RFC PATCH 1/10 dwarf_info: Support kernel address randomization
There is a bug of not supporting randomized kernel address, this patch fix it.
--- erase_info.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
erase_info.c +4 -4
@@ -1881,7 +1881,7 @@ get_symbol_addr_all(char *name) {if (!strcmp (get_dwarf_module_name (),"vmlinux" )) { symbol_addr =get_symbol_addr (name);if (symbol_addr) -return symbol_addr; +return symbol_addr + info->kaslr_offset; vmlinux_searched =1 ; }
@@ -1942,9 +1942,9 @@ get_symbol_addr_all(char *name) {* this function is called with debuginfo set to a particular * kernel module and we are looking for symbol in vmlinux */ -if (!vmlinux_searched) -return get_symbol_addr (name); -else +if (!vmlinux_searched && !!(symbol_addr =get_symbol_addr (name))) { +return symbol_addr + info->kaslr_offset; + }else return NOT_FOUND_SYMBOL ; }
Signature · 1 line
2.47.0
Re: [PATCH RFC][makedumpfile 01/10] dwarf_info: Support kernel address randomization
Hi,Liu
Thanks your patch. What kind of environment did you test this KASLR problem ? Especialy is it kernel verssion 6.11.8-300.fc41.x86_64 ? Have you checked other versions? Additionally, do you know the version of eppic ?
Also, if possible, show this problem results when an error occurs and the results when it is correct. Please tell me.
Sincerely
Quoted 33 lines · Tao Liu
There is a bug of not supporting randomized kernel address, this patch fix it.
Signed-off-by Tao Liu <[email protected]>--- erase_info.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)erase_info.c +4
-4@@ -1881,7 +1881,7 @@ get_symbol_addr_all(char *name) {if (!strcmp (get_dwarf_module_name (),"vmlinux" )) { symbol_addr =get_symbol_addr (name);if (symbol_addr) -return symbol_addr; +return symbol_addr + info->kaslr_offset; vmlinux_searched =1 ; }@@ -1942,9 +1942,9 @@ get_symbol_addr_all(char *name) {* this function is called with debuginfo set to a particular * kernel module and we are looking for symbol in vmlinux */ -if (!vmlinux_searched) -return get_symbol_addr (name); -else +if (!vmlinux_searched && !!(symbol_addr =get_symbol_addr (name))) { +return symbol_addr + info->kaslr_offset; + }else return NOT_FOUND_SYMBOL ; }
Re: [PATCH RFC][makedumpfile 01/10] dwarf_info: Support kernel address randomization
Hi YAMAZAKI,
Quoted 7 lines · YAMAZAKI MASAMITSU(山崎 真光)
Hi,Liu
Thanks your patch. What kind of environment did you test this KASLR problem ? Especialy is it kernel verssion 6.11.8-300.fc41.x86_64 ? Have you checked other versions? Additionally, do you know the version of eppic ?
I had primarily tested the patchset within 6.11.8-300.fc41.x86_64, since it has been a while, and I have updated my kernel to 6.16.3. The dwarf issue(PATCH 01/10 & PATCH 02/10) can still be reproduced there, see the following:
1) Env:
$ uname -a Linux localhost.localdomain 6.16.3 #3 SMP PREEMPT_DYNAMIC Thu Aug 28 15:12:38 2025 x86_64 GNU/Linux
liutgnu@localhost:~/sources/up-makedumpfile$ git log --oneline | head -2 65bf4c9 [PATCH v2] Fix a data race in multi-threading mode (--num-threads=N)
liutgnu@localhost:~/sources/up-eppic$ git branch * master v5.0 liutgnu@localhost:~/sources/up-eppic$ git log --oneline | head -2 72da440 Merge pull request #20 from yselkowitz/master 5ecafb7 Fix build with glibc-2.42
liutgnu@localhost:~/sources/up-makedumpfile$ cat eppic_scripts/test.c
string test_opt() {...}
string test_usage() {...}
static void test_showusage() {...}
string test_help() {...}
int test()
{
printf("linux banner: %lx\n", (unsigned long)&linux_banner);
return 0;
}2) The recursive issue as fixed in PATCH 02/10:
$ ./makedumpfile -d 31 -l vmcore /tmp/out -x vmlinux --eppic
eppic_scripts/test.c --dry-run
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7c3ca4b in pthread_rwlock_unlock@GLIBC_2.2.5 () from
target:/lib64/libc.so.6
(gdb) bt
...
#5 0x0000000000409a67 in search_domain (die=0x7fffff7ff220,
found=0x7fffffffcf24) at dwarf_info.c:904
#6 0x0000000000409978 in search_domain (die=0x7fffff7ff290,
found=0x7fffffffcf24) at dwarf_info.c:865
#7 0x0000000000409978 in search_domain (die=0x7fffff7ff300,
found=0x7fffffffcf24) at dwarf_info.c:865
...
#74820 0x0000000000409978 in search_domain (die=0x7fffffffcdb0,
found=0x7fffffffcf24) at dwarf_info.c:865
#74821 0x0000000000409978 in search_domain (die=0x7fffffffce60,
found=0x7fffffffcf24) at dwarf_info.c:865
#74822 0x0000000000409bfc in search_die_tree (die=0x7fffffffce60,
found=0x7fffffffcf24) at dwarf_info.c:953
#74823 0x0000000000409b2c in search_die_tree (die=0x7fffffffce90,
found=0x7fffffffcf24) at dwarf_info.c:935
#74824 0x0000000000409ec7 in get_debug_info () at dwarf_info.c:1010
#74825 0x000000000040af2a in get_domain (symname=0x90aeb0 "memset",
cmd=13, die=0x7fffffffd020) at dwarf_info.c:1381
#74826 0x00000000004143d0 in get_domain_all (symname=0x90aeb0
"memset", cmd=13, die=0x7fffffffd020) at erase_info.c:1965
#74827 0x00007ffff76c0fc1 in apigetctype (ctype=7, name=0x90aeb0
"memset", tout=0x48be80) at extension_eppic.c:280
#74828 0x00007ffff76cab1b in eppic_getctype (ctype=7, name=0x90aeb0
"memset", silent=1) at eppic_api.c:454
#74829 0x00007ffff76d56c0 in eppiclex () at lex.eppic.c:1831
#74830 0x00007ffff76d2ae5 in eppicparse () at eppic.tab.c:1804
#74831 0x00007ffff76c1f4d in eppic_parsexpr (expr=0x7ffff7707364 "int
memset(char *, int, int)") at eppic_func.c:437
#74832 0x00007ffff76c740e in eppic_builtin (proto=0x7ffff7707364 "int
memset(char *, int, int)", fp=0x7ffff76c1349 <eppic_memset>)
at eppic_builtin.c:252
#74833 0x00007ffff76c1420 in eppic_init (fun_ptr=0x473600 <eppic_cb>)
at extension_eppic.c:461
#74834 0x0000000000414f83 in process_eppic_file
(name_config=0x7fffffffe0b7 "eppic_scripts/test.c") at
erase_info.c:2226
#74835 0x0000000000415513 in gather_filter_info () at erase_info.c:2357
#74836 0x000000000044f237 in create_dumpfile () at makedumpfile.c:10885
#74837 0x000000000045569a in main (argc=11, argv=0x7fffffffdc08) at
makedumpfile.c:12478
(gdb) frame 74821
#74821 0x0000000000409978 in search_domain (die=0x7fffffffce60,
found=0x7fffffffcf24) at dwarf_info.c:865
865 search_domain(&child, found);
(gdb) p name
$1 = 0x7ffff1bdb782 "&core::num::fmt::Part"
...
(gdb) frame 6
#6 0x0000000000409978 in search_domain (die=0x7fffff7ff290,
found=0x7fffffffcf24) at dwarf_info.c:865
865 search_domain(&child, found);
(gdb) p name
$8 = 0x7ffff1bdbe1f "and_then<char, (),
core::net::parser::{impl#0}::read_given_char::{closure#0}::{closure_env#0}>"So the stack overflows, and is caused by rust symbols. I have no idea why rust symbols will cause this, so in PATCH 02/10, I skipped all rust symbols for now. With the patch applied, no segfaults.
3) The kaslr issue as fixed in PATCH 01/10:
$ ./makedumpfile -d 31 -l vmcore /tmp/out -x vmlinux --eppic eppic_scripts/test.c --dry-run __vtop4_x86_64: Can't get a valid pmd_pte. readmem: Can't convert a virtual address(ffffffff828445f0) to physical address. readmem: type_addr: 0, addr:ffffffff828445f0, size:1 linux banner: ffffffff828445f0
crash> sym linux_bannerffffffff938445f0 (D) linux_banner
liutgnu@localhost:/lib/modules/6.16.3/build$ cat System.map |grep linux_banner ffffffff828445f0 D linux_banner
So the value outputted by eppic script is not kaslred. With the patch applied, the eppic can output the correct value as crash's:
$ ./makedumpfile -d 31 -l vmcore /tmp/out -x vmlinux --eppic eppic_scripts/test.c --dry-run linux banner: ffffffff938445f0
Hope the debug process can help for PATCH 01/10 & PATCH 02/10
Thanks,
Tao Liu
Quoted 40 lines
Also, if possible, show this problem results when an error occurs and the results when it is correct. Please tell me.
Sincerely
Quoted 33 lines · Tao Liu
There is a bug of not supporting randomized kernel address, this patch fix it.
Signed-off-by Tao Liu <[email protected]>--- erase_info.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)erase_info.c +4
-4@@ -1881,7 +1881,7 @@ get_symbol_addr_all(char *name) {if (!strcmp (get_dwarf_module_name (),"vmlinux" )) { symbol_addr =get_symbol_addr (name);if (symbol_addr) -return symbol_addr; +return symbol_addr + info->kaslr_offset; vmlinux_searched =1 ; }@@ -1942,9 +1942,9 @@ get_symbol_addr_all(char *name) {* this function is called with debuginfo set to a particular * kernel module and we are looking for symbol in vmlinux */ -if (!vmlinux_searched) -return get_symbol_addr (name); -else +if (!vmlinux_searched && !!(symbol_addr =get_symbol_addr (name))) { +return symbol_addr + info->kaslr_offset; + }else return NOT_FOUND_SYMBOL ; }
Re: [PATCH RFC][makedumpfile 01/10] dwarf_info: Support kernel address randomization
In reply to Tao LiuHi Tao,
Quoted 3 lines · Tao Liu
There is a bug of not supporting randomized kernel address, this patch fix it.
Signed-off-by Tao Liu <[email protected]>
apologies for my long delay and thank you for the patch.
This patch looks good to me and I would like to merge this separately from the series, so
Thanks,
Kazu
Quoted 30 lines
--- erase_info.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)erase_info.c +4
-4@@ -1881,7 +1881,7 @@ get_symbol_addr_all(char *name) {if (!strcmp (get_dwarf_module_name (),"vmlinux" )) { symbol_addr =get_symbol_addr (name);if (symbol_addr) -return symbol_addr; +return symbol_addr + info->kaslr_offset; vmlinux_searched =1 ; }@@ -1942,9 +1942,9 @@ get_symbol_addr_all(char *name) {* this function is called with debuginfo set to a particular * kernel module and we are looking for symbol in vmlinux */ -if (!vmlinux_searched) -return get_symbol_addr (name); -else +if (!vmlinux_searched && !!(symbol_addr =get_symbol_addr (name))) { +return symbol_addr + info->kaslr_offset; + }else return NOT_FOUND_SYMBOL ; }
Re: [PATCH RFC][makedumpfile 01/10] dwarf_info: Support kernel address randomization
Hi Kazu,
Thanks for your review of the patch [1 & 2].
As for the left [3 - 10] patches, I will redraft and post v2 later.
Thanks,
Tao Liu
Quoted 48 lines · HAGIO KAZUHITO(萩尾 一仁)
Hi Tao,
Quoted 3 lines · Tao Liu
There is a bug of not supporting randomized kernel address, this patch fix it.
Signed-off-by Tao Liu <[email protected]>apologies for my long delay and thank you for the patch.
This patch looks good to me and I would like to merge this separately from the series, so
Acked-by Kazuhito Hagio <[email protected]>Thanks,
KazuQuoted 30 lines
--- erase_info.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)erase_info.c +4
-4@@ -1881,7 +1881,7 @@ get_symbol_addr_all(char *name) {if (!strcmp (get_dwarf_module_name (),"vmlinux" )) { symbol_addr =get_symbol_addr (name);if (symbol_addr) -return symbol_addr; +return symbol_addr + info->kaslr_offset; vmlinux_searched =1 ; }@@ -1942,9 +1942,9 @@ get_symbol_addr_all(char *name) {* this function is called with debuginfo set to a particular * kernel module and we are looking for symbol in vmlinux */ -if (!vmlinux_searched) -return get_symbol_addr (name); -else +if (!vmlinux_searched && !!(symbol_addr =get_symbol_addr (name))) { +return symbol_addr + info->kaslr_offset; + }else return NOT_FOUND_SYMBOL ; }
Re: [PATCH RFC][makedumpfile 01/10] dwarf_info: Support kernel address randomization
Quoted 3 lines · Tao Liu
Hi Kazu,
Thanks for your review of the patch [1 & 2].
ah sorry, the ack was for 01/10, I will review 02/10 later.
Quoted 2 lines
As for the left [3 - 10] patches, I will redraft and post v2 later.
I see.
Thanks,
Kazu
Quoted 54 lines
Thanks,
Tao LiuQuoted 48 lines · HAGIO KAZUHITO(萩尾 一仁)
Hi Tao,
Quoted 3 lines · Tao Liu
There is a bug of not supporting randomized kernel address, this patch fix it.
Signed-off-by Tao Liu <[email protected]>apologies for my long delay and thank you for the patch.
This patch looks good to me and I would like to merge this separately from the series, so
Acked-by Kazuhito Hagio <[email protected]>Thanks,
KazuQuoted 30 lines
--- erase_info.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)erase_info.c +4
-4@@ -1881,7 +1881,7 @@ get_symbol_addr_all(char *name) {if (!strcmp (get_dwarf_module_name (),"vmlinux" )) { symbol_addr =get_symbol_addr (name);if (symbol_addr) -return symbol_addr; +return symbol_addr + info->kaslr_offset; vmlinux_searched =1 ; }@@ -1942,9 +1942,9 @@ get_symbol_addr_all(char *name) {* this function is called with debuginfo set to a particular * kernel module and we are looking for symbol in vmlinux */ -if (!vmlinux_searched) -return get_symbol_addr (name); -else +if (!vmlinux_searched && !!(symbol_addr =get_symbol_addr (name))) { +return symbol_addr + info->kaslr_offset; + }else return NOT_FOUND_SYMBOL ; }
Re: [PATCH RFC][makedumpfile 01/10] dwarf_info: Support kernel address randomization
Quoted 7 lines · HAGIO KAZUHITO(萩尾 一仁)
Quoted 3 lines · Tao Liu
Hi Kazu,
Thanks for your review of the patch [1 & 2].
ah sorry, the ack was for 01/10, I will review 02/10 later.
Oh I see, no worries, please take your time :)
Thanks,
Tao Liu
Quoted 64 lines
Quoted 3 lines
As for the left [3 - 10] patches, I will redraft and post v2 later.
I see.
Thanks,
KazuQuoted 54 lines
Thanks,
Tao LiuQuoted 48 lines · HAGIO KAZUHITO(萩尾 一仁)
Hi Tao,
Quoted 3 lines · Tao Liu
There is a bug of not supporting randomized kernel address, this patch fix it.
Signed-off-by Tao Liu <[email protected]>apologies for my long delay and thank you for the patch.
This patch looks good to me and I would like to merge this separately from the series, so
Acked-by Kazuhito Hagio <[email protected]>Thanks,
KazuQuoted 30 lines
--- erase_info.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)erase_info.c +4
-4@@ -1881,7 +1881,7 @@ get_symbol_addr_all(char *name) {if (!strcmp (get_dwarf_module_name (),"vmlinux" )) { symbol_addr =get_symbol_addr (name);if (symbol_addr) -return symbol_addr; +return symbol_addr + info->kaslr_offset; vmlinux_searched =1 ; }@@ -1942,9 +1942,9 @@ get_symbol_addr_all(char *name) {* this function is called with debuginfo set to a particular * kernel module and we are looking for symbol in vmlinux */ -if (!vmlinux_searched) -return get_symbol_addr (name); -else +if (!vmlinux_searched && !!(symbol_addr =get_symbol_addr (name))) { +return symbol_addr + info->kaslr_offset; + }else return NOT_FOUND_SYMBOL ; }
RFC PATCH 2/10 dwarf_info: Fix a infinite recursion bug for search_domain
In reply to Tao LiuThere is an infinite recursion bug noticed in rust symbols. The root cause is unclear to me. This patch will avoid the bug by skip the recursion of rust symbols, since currently we don't need to deal with those.
--- dwarf_info.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
dwarf_info.c +8 -7
@@ -837,7 +837,7 @@ search_symbol(Dwarf_Die *die, int *found) }static void -search_domain (Dwarf_Die *die,int *found) +search_domain (Dwarf_Die *die,int *found,int lang) {int tag;const char *name;
@@ -859,10 +859,11 @@ search_domain(Dwarf_Die *die, int *found)if (is_container (&die_type)) {Dwarf_Die child; -if (dwarf_child (&die_type, &child) !=0 ) +if (dwarf_child (&die_type, &child) !=0 || + lang == DW_LANG_Rust)continue ; -search_domain (&child, found); +search_domain (&child, found, lang);if (*found)return ;
@@ -924,7 +925,7 @@ search_die(Dwarf_Die *die, int *found) }static void -search_die_tree (Dwarf_Die *die,int *found) +search_die_tree (Dwarf_Die *die,int *found,int lang) {Dwarf_Die child;
@@ -932,7 +933,7 @@ search_die_tree(Dwarf_Die *die, int *found)* start by looking at the children */ if (dwarf_child (die, &child) ==0 ) -search_die_tree (&child, found); +search_die_tree (&child, found, lang);if (*found)return ;
@@ -950,7 +951,7 @@ search_die_tree(Dwarf_Die *die, int *found)search_typedef (die, found); else if (is_search_domain(dwarf_info.cmd)) - search_domain(die, found); + search_domain(die, found, lang); else if (is_search_die(dwarf_info.cmd)) search_die(die, found);
@@ -1007,7 +1008,7 @@ get_debug_info(void)ERRMSG ("Can't get CU die.\n" ); goto out; } -search_die_tree (&cu_die, &found); +search_die_tree (&cu_die, &found,dwarf_srclang (&cu_die));if (found)break ; off = next_off;
Signature · 1 line
2.47.0
Re: [PATCH RFC][makedumpfile 02/10] dwarf_info: Fix a infinite recursion bug for search_domain
Quoted 64 lines · Tao Liu
There is an infinite recursion bug noticed in rust symbols. The root cause is unclear to me. This patch will avoid the bug by skip the recursion of rust symbols, since currently we don't need to deal with those.
Signed-off-by Tao Liu <[email protected]>--- dwarf_info.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)dwarf_info.c +7
-6@@ -837,7 +837,7 @@ search_symbol(Dwarf_Die *die, int *found) }static void -search_domain (Dwarf_Die *die,int *found) +search_domain (Dwarf_Die *die,int *found,int lang) {int tag;const char *name;@@ -859,10 +859,11 @@ search_domain(Dwarf_Die *die, int *found)if (is_container (&die_type)) {Dwarf_Die child; -if (dwarf_child (&die_type, &child) !=0 ) +if (dwarf_child (&die_type, &child) !=0 || + lang == DW_LANG_Rust)continue ; -search_domain (&child, found); +search_domain (&child, found, lang);if (*found)return ;@@ -924,7 +925,7 @@ search_die(Dwarf_Die *die, int *found) }static void -search_die_tree (Dwarf_Die *die,int *found) +search_die_tree (Dwarf_Die *die,int *found,int lang) {Dwarf_Die child;@@ -932,7 +933,7 @@ search_die_tree(Dwarf_Die *die, int *found)* start by looking at the children */ if (dwarf_child (die, &child) ==0 ) -search_die_tree (&child, found); +search_die_tree (&child, found, lang);if (*found)return ;@@ -950,7 +951,7 @@ search_die_tree(Dwarf_Die *die, int *found)search_typedef (die, found); else if (is_search_domain(dwarf_info.cmd)) - search_domain(die, found); + search_domain(die, found, lang); else if (is_search_die(dwarf_info.cmd)) search_die(die, found);
dwarf_info.c get_debug_info(void) · line 1014
Quoted 8 lines
dwarf_info.c +1
-1@@ -1007,7 +1008,7 @@ get_debug_info(void)ERRMSG ("Can't get CU die.\n" ); goto out; } -search_die_tree (&cu_die, &found); +search_die_tree (&cu_die, &found,dwarf_srclang (&cu_die));if (found)break ; off = next_off;
Hi Liu
This problem need to be solve. But I don't know how to reproduce. If Your server is running rust program. Or Or is it running as a module by rust? Please tell me how to reproduce it.
Thanks,
Masa
Re: [PATCH RFC][makedumpfile 02/10] dwarf_info: Fix a infinite recursion bug for search_domain
Hi YAMAZAKI,
Quoted 77 lines · YAMAZAKI MASAMITSU(山崎 真光)
Quoted 64 lines · Tao Liu
There is an infinite recursion bug noticed in rust symbols. The root cause is unclear to me. This patch will avoid the bug by skip the recursion of rust symbols, since currently we don't need to deal with those.
Signed-off-by Tao Liu <[email protected]>--- dwarf_info.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)dwarf_info.c +7
-6@@ -837,7 +837,7 @@ search_symbol(Dwarf_Die *die, int *found) }static void -search_domain (Dwarf_Die *die,int *found) +search_domain (Dwarf_Die *die,int *found,int lang) {int tag;const char *name;@@ -859,10 +859,11 @@ search_domain(Dwarf_Die *die, int *found)if (is_container (&die_type)) {Dwarf_Die child; -if (dwarf_child (&die_type, &child) !=0 ) +if (dwarf_child (&die_type, &child) !=0 || + lang == DW_LANG_Rust)continue ; -search_domain (&child, found); +search_domain (&child, found, lang);if (*found)return ;@@ -924,7 +925,7 @@ search_die(Dwarf_Die *die, int *found) }static void -search_die_tree (Dwarf_Die *die,int *found) +search_die_tree (Dwarf_Die *die,int *found,int lang) {Dwarf_Die child;@@ -932,7 +933,7 @@ search_die_tree(Dwarf_Die *die, int *found)* start by looking at the children */ if (dwarf_child (die, &child) ==0 ) -search_die_tree (&child, found); +search_die_tree (&child, found, lang);if (*found)return ;@@ -950,7 +951,7 @@ search_die_tree(Dwarf_Die *die, int *found)search_typedef (die, found); else if (is_search_domain(dwarf_info.cmd)) - search_domain(die, found); + search_domain(die, found, lang); else if (is_search_die(dwarf_info.cmd)) search_die(die, found);dwarf_info.c get_debug_info(void) · line 1014
Quoted 8 lines
dwarf_info.c +1
-1@@ -1007,7 +1008,7 @@ get_debug_info(void)ERRMSG ("Can't get CU die.\n" ); goto out; } -search_die_tree (&cu_die, &found); +search_die_tree (&cu_die, &found,dwarf_srclang (&cu_die));if (found)break ; off = next_off;Hi Liu
Quoted 3 lines
This problem need to be solve. But I don't know how to reproduce. If Your server is running rust program. Or Or is it running as a module by rust? Please tell me how to reproduce it.
Sure
E.g. using the following eppic program: /tmp/test.c:
string test_opt(){return "";}
string test_usage(){return "";}
static void test_showusage(){printf("");} string test_help(){return "";}
int test()
{
struct task_struct *p;
unsigned long offset;
p = (struct task_struct *)&init_task;
offset = (unsigned long)&(p->tasks) - (unsigned long)p;
do {printf("%d\n", (int)(p->pid));
p = (struct task_struct *)((unsigned long)(p->tasks.next) - (unsigned long)p); } while (p != &init_task);
return 1;
}
$ ./makedumpfile --dry-run -d 31 -l /var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore /tmp/out -x /lib/debug/lib/modules/6.11.8-300.fc41.x86_64/vmlinux --eppic /tmp/test.c Segmentation fault (core dumped)
With the patch, no segfault.
The vmcore/vmlinux should contain rust symbols: CONFIG_RUST=y, you can use the following vmcore https://people.redhat.com/~ltao/core/vmcore +
https://kojipkgs.fedoraproject.org//packages/kernel/6.11.8/300.fc41/x86_64/kernel-debuginfo-6.11.8-300.fc41.x86_64.rpm
for vmlinux and vmcore to test.
Thanks,
Tao Liu
Quoted 4 lines
Thanks,
Masa
Re: [PATCH RFC][makedumpfile 02/10] dwarf_info: Fix a infinite recursion bug for search_domain
In reply to Tao LiuHi Tao,
thank you for the fix.
Quoted 3 lines · Tao Liu
There is an infinite recursion bug noticed in rust symbols. The root cause is unclear to me. This patch will avoid the bug by skip the recursion of rust symbols, since currently we don't need to deal with those.
I confirmed that the recursive dwarf_child() calls result in a loop, and I'm also not sure how we can avoid it correctly. I think for now there is no demand for eppic + Rust with makedumpfile, so I can agree about skipping Rust DIEs.
I think that probably you tried to support them as much as possible, so the patch has the lang check in search_domain(). but a halfway support may be confusing, i.e. maybe a user cannot determine whether it's not supported or a bug.
So could we skip it in get_debug_info() like below and describe that the eppic extension does not support Rust's debug information in the man page?
@@ -1007,6 +1010,12 @@ get_debug_info(void)
ERRMSG("Can't get CU die.\n");
goto out;
}+
+ /* NOTE: currently Rust is not supported. */
+ if (dwarf_srclang(&cu_die) == DW_LANG_Rust)
+ continue;
+
search_die_tree(&cu_die, &found);
if (found)
break;Thanks,
Kazu
Quoted 69 lines
Signed-off-by Tao Liu <[email protected]>--- dwarf_info.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)dwarf_info.c +8
-7@@ -837,7 +837,7 @@ search_symbol(Dwarf_Die *die, int *found) }static void -search_domain (Dwarf_Die *die,int *found) +search_domain (Dwarf_Die *die,int *found,int lang) {int tag;const char *name;@@ -859,10 +859,11 @@ search_domain(Dwarf_Die *die, int *found)if (is_container (&die_type)) {Dwarf_Die child; -if (dwarf_child (&die_type, &child) !=0 ) +if (dwarf_child (&die_type, &child) !=0 || + lang == DW_LANG_Rust)continue ; -search_domain (&child, found); +search_domain (&child, found, lang);if (*found)return ;@@ -924,7 +925,7 @@ search_die(Dwarf_Die *die, int *found) }static void -search_die_tree (Dwarf_Die *die,int *found) +search_die_tree (Dwarf_Die *die,int *found,int lang) {Dwarf_Die child;@@ -932,7 +933,7 @@ search_die_tree(Dwarf_Die *die, int *found)* start by looking at the children */ if (dwarf_child (die, &child) ==0 ) -search_die_tree (&child, found); +search_die_tree (&child, found, lang);if (*found)return ;@@ -950,7 +951,7 @@ search_die_tree(Dwarf_Die *die, int *found)search_typedef (die, found); else if (is_search_domain(dwarf_info.cmd)) - search_domain(die, found); + search_domain(die, found, lang); else if (is_search_die(dwarf_info.cmd)) search_die(die, found);@@ -1007,7 +1008,7 @@ get_debug_info(void)ERRMSG ("Can't get CU die.\n" ); goto out; } -search_die_tree (&cu_die, &found); +search_die_tree (&cu_die, &found,dwarf_srclang (&cu_die));if (found)break ; off = next_off;
Re: [PATCH RFC][makedumpfile 02/10] dwarf_info: Fix a infinite recursion bug for search_domain
Hi Kauz,
Quoted 15 lines · HAGIO KAZUHITO(萩尾 一仁)
Hi Tao,
thank you for the fix.
Quoted 3 lines · Tao Liu
There is an infinite recursion bug noticed in rust symbols. The root cause is unclear to me. This patch will avoid the bug by skip the recursion of rust symbols, since currently we don't need to deal with those.
I confirmed that the recursive
dwarf_child()calls result in a loop, and I'm also not sure how we can avoid it correctly. I think for now there is no demand for eppic + Rust with makedumpfile, so I can agree about skipping Rust DIEs.
Quoted 4 lines
I think that probably you tried to support them as much as possible, so the patch has the lang check in
search_domain(). but a halfway support may be confusing, i.e. maybe a user cannot determine whether it's not supported or a bug.
Agreed.
Quoted 3 lines
So could we skip it in
get_debug_info()like below and describe that the eppic extension does not support Rust's debug information in the man page?
Sure, thanks for your suggestion, I will update it in v2.
Review get_debug_info(void) · line 1017
Quoted 10 lines
(quoted diff) +5
-0@@ -1007,6 +1010,12 @@ get_debug_info(void) ERRMSG("Can't get CU die.\n"); goto out; } + + /* NOTE: currently Rust is not supported. */ + if (dwarf_srclang(&cu_die) == DW_LANG_Rust) + continue; +
The following change works for me:
/* NOTE: currently Rust is not supported. */
if (dwarf_srclang(&cu_die) == DW_LANG_Rust) {
off = next_off;
continue;
}I'm currently testing and will get it improved in v2
Thanks,
Tao Liu
Quoted 76 lines
dwarf_info.c +0
-0search_die_tree (&cu_die, &found);if (found)break ;Thanks,
KazuQuoted 69 lines
Signed-off-by Tao Liu <[email protected]>--- dwarf_info.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)dwarf_info.c +8
-7@@ -837,7 +837,7 @@ search_symbol(Dwarf_Die *die, int *found) }static void -search_domain (Dwarf_Die *die,int *found) +search_domain (Dwarf_Die *die,int *found,int lang) {int tag;const char *name;@@ -859,10 +859,11 @@ search_domain(Dwarf_Die *die, int *found)if (is_container (&die_type)) {Dwarf_Die child; -if (dwarf_child (&die_type, &child) !=0 ) +if (dwarf_child (&die_type, &child) !=0 || + lang == DW_LANG_Rust)continue ; -search_domain (&child, found); +search_domain (&child, found, lang);if (*found)return ;@@ -924,7 +925,7 @@ search_die(Dwarf_Die *die, int *found) }static void -search_die_tree (Dwarf_Die *die,int *found) +search_die_tree (Dwarf_Die *die,int *found,int lang) {Dwarf_Die child;@@ -932,7 +933,7 @@ search_die_tree(Dwarf_Die *die, int *found)* start by looking at the children */ if (dwarf_child (die, &child) ==0 ) -search_die_tree (&child, found); +search_die_tree (&child, found, lang);if (*found)return ;@@ -950,7 +951,7 @@ search_die_tree(Dwarf_Die *die, int *found)search_typedef (die, found); else if (is_search_domain(dwarf_info.cmd)) - search_domain(die, found); + search_domain(die, found, lang); else if (is_search_die(dwarf_info.cmd)) search_die(die, found);@@ -1007,7 +1008,7 @@ get_debug_info(void)ERRMSG ("Can't get CU die.\n" ); goto out; } -search_die_tree (&cu_die, &found); +search_die_tree (&cu_die, &found,dwarf_srclang (&cu_die));if (found)break ; off = next_off;
RFC PATCH 3/10 Add page filtering function
In reply to Tao Liupfn and num is the data which eppic scritps give to makedumpfile for mm page filtering, so any page within [pfn ~ pfn + num) can be filtered. Since makedumpfile will iterate the pfn in an ascending order, the pfn & num linked lists are also organized in a ascending order by pfn, so if one pfn is hit by one list, the following pfn is more likely to be hit either by this list again, or the one after, and a cur variable is used for saving the current list to speedup the checking process.
--- erase_info.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ erase_info.h | 8 ++++++ makedumpfile.c | 18 ++++++++++--- 3 files changed, 91 insertions(+), 4 deletions(-)
erase_info.c +69 -0
@@ -2466,3 +2466,72 @@ get_size_eraseinfo(void)return size_eraseinfo; } +static struct ft_page_info *ft_head =NULL ; + +/* +* Insert the ft_page_info blocks into ft_head by ascending pfn. +*/ +int +update_filter_pages_info (unsigned long pfn,unsigned long num) +{ +struct ft_page_info *p; +struct ft_page_info *new_p =malloc (sizeof (struct ft_page_info )); + +if (!new_p) { +ERRMSG ("Can't allocate memory for ft_page_info at %lx\n" , pfn); +return 1 ; + } + new_p->pfn = pfn; + new_p->num = num; + new_p->next =NULL ; + +if (!ft_head || ft_head->pfn > new_p->pfn) { + new_p->next = ft_head; + ft_head = new_p; +return 0 ; + } + + p = ft_head; +while (p->next !=NULL && p->next->pfn < new_p->pfn) { + p = p->next; + } + + new_p->next = p->next; + p->next = new_p; +return 0 ; +} + +/* +* Check if the pfn page should be filtered. +* +* pfn and ft_head are in ascending order, so save the current ft_page_info +* block into **p because it is likely to hit again next time. +*/ +int +filter_page (unsigned long pfn,struct ft_page_info **p) +{ +if (ft_head ==NULL ) +return 0 ; + +if (*p ==NULL ) + *p = ft_head; + +/* Handle the 1st gap */ +if (pfn >=0 && pfn < ft_head->pfn) +return 0 ; + +/* Handle ft_page_info blocks and following gaps */ +while ((*p)->next) { +if (pfn >= (*p)->pfn && pfn < (*p)->pfn + (*p)->num) +return 1 ;// filter this page +if (pfn >= (*p)->pfn + (*p)->num && pfn < (*p)->next->pfn) +return 0 ;// save this page + *p = (*p)->next; + } + +/* Handle the last gap */ +if (pfn >= (*p)->pfn + (*p)->num) +return 0 ; +else +return 1 ; +}
erase_info.h +8 -0
@@ -64,6 +64,14 @@ void filter_data_buffer_parallel(unsigned char *buf, unsigned long long paddr, size_t size, pthread_mutex_t *mutex);unsigned long get_size_eraseinfo (void );int update_filter_info_raw (unsigned long long ,int ,int ); +int update_filter_pages_info (unsigned long ,unsigned long ); + +struct ft_page_info { +unsigned long pfn; +unsigned long num; +struct ft_page_info *next; +}; +int filter_page (unsigned long ,struct ft_page_info **p);#endif /* _ERASE_INFO_H */
makedumpfile.c +14 -4
@@ -100,6 +100,7 @@ mdf_pfn_t pfn_user;mdf_pfn_t pfn_free;mdf_pfn_t pfn_hwpoison;mdf_pfn_t pfn_offline; +mdf_pfn_t pfn_eppic;mdf_pfn_t pfn_elf_excluded;mdf_pfn_t num_dumped;
@@ -6453,6 +6454,7 @@ __exclude_unnecessary_pages(unsigned long mem_map,unsigned int order_offset, dtor_offset;unsigned long flags, mapping, private =0 ;unsigned long compound_dtor, compound_head =0 ; +struct ft_page_info *cur =NULL ;/* * If a multi-page exclusion is pending, do it first
@@ -6670,6 +6672,13 @@ check_order:else if (isOffline (flags, _mapcount)) { pfn_counter = &pfn_offline; } +/* +* Exclude pages that specified by eppic script +*/ +else if (filter_page (pfn, &cur)) { + nr_pages =1 ; + pfn_counter = &pfn_eppic; + }/* * Unexcludable page */
@@ -8217,7 +8226,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)*/ if (info->flag_cyclic) { pfn_zero = pfn_cache = pfn_cache_private =0 ; - pfn_user = pfn_free = pfn_hwpoison = pfn_offline =0 ; + pfn_user = pfn_free = pfn_hwpoison = pfn_offline = pfn_eppic =0 ; pfn_memhole = info->max_mapnr; }
@@ -9555,7 +9564,7 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d* Reset counter for debug message. */ pfn_zero = pfn_cache = pfn_cache_private =0 ; - pfn_user = pfn_free = pfn_hwpoison = pfn_offline =0 ; + pfn_user = pfn_free = pfn_hwpoison = pfn_offline = pfn_eppic =0 ; pfn_memhole = info->max_mapnr;/*
@@ -10504,7 +10513,7 @@ print_report(void) pfn_original = info->max_mapnr - pfn_memhole; pfn_excluded = pfn_zero + pfn_cache + pfn_cache_private - + pfn_user + pfn_free + pfn_hwpoison + pfn_offline; + + pfn_user + pfn_free + pfn_hwpoison + pfn_offline + pfn_eppic;REPORT_MSG ("\n" );REPORT_MSG ("Original pages : 0x%016llx\n" , pfn_original);
@@ -10520,6 +10529,7 @@ print_report(void)REPORT_MSG (" Free pages : 0x%016llx\n" , pfn_free);REPORT_MSG (" Hwpoison pages : 0x%016llx\n" , pfn_hwpoison);REPORT_MSG (" Offline pages : 0x%016llx\n" , pfn_offline); +REPORT_MSG (" Eppic filtered pages : 0x%016llx\n" , pfn_eppic);REPORT_MSG (" Remaining pages : 0x%016llx\n" , pfn_original - pfn_excluded);
@@ -10560,7 +10570,7 @@ print_mem_usage(void) pfn_original = info->max_mapnr - pfn_memhole; pfn_excluded = pfn_zero + pfn_cache + pfn_cache_private - + pfn_user + pfn_free + pfn_hwpoison + pfn_offline; + + pfn_user + pfn_free + pfn_hwpoison + pfn_offline + pfn_eppic; shrinking = (pfn_original - pfn_excluded) *100 ; shrinking = shrinking / pfn_original; total_size = info->page_size * pfn_original;
Signature · 1 line
2.47.0
RFC PATCH 4/10 Add btf/kallsyms support for symbol type/address resolving
In reply to Tao Liubtf data contains symbols' type and size, which is essential to determine a structure/member size & offset. kallsyms contains symbols' address. All the data can provide complete info for symbol resolving.
To initialize, we will:
1st) read vmcore info and parse kernel's kallsyms data;
2nd) read kernel data range of "__start/stop_BTF" and parse kernel's btf data,
now we have complete type/address info for kernel symbols;
3rd) iterate kernel's module and parse all kernel modules' kallsyms data; 4th) iterate btf_modules and parse all kernel modules' btf data, now we have
complete type/address info for kernel and modules symbols.
Also to speed up the converting of symbol name to address/type, the parsed btf/kallsyms data are stored in hash tables.
--- Makefile | 2 +- btf.c | 919 +++++++++++++++++++++++++++++++++++++++++++++++++ btf.h | 176 ++++++++++ kallsyms.c | 371 ++++++++++++++++++++ kallsyms.h | 42 +++ makedumpfile.c | 3 + makedumpfile.h | 11 + 7 files changed, 1523 insertions(+), 1 deletion(-) create mode 100644 btf.c create mode 100644 btf.h create mode 100644 kallsyms.c create mode 100644 kallsyms.h
Makefile +1 -1
@@ -45,7 +45,7 @@ CFLAGS_ARCH += -m32 endif SRC_BASE = makedumpfile.c makedumpfile.h diskdump_mod.h sadump_mod.h sadump_info.h -SRC_PART = print_info.c dwarf_info.c elf_info.c erase_info.c sadump_info.c cache.c tools.c printk.c detect_cycle.c +SRC_PART = print_info.c dwarf_info.c elf_info.c erase_info.c sadump_info.c cache.c tools.c printk.c detect_cycle.c kallsyms.c btf.c OBJ_PART=$(patsubst %.c,%.o,$(SRC_PART)) SRC_ARCH = arch/arm.c arch/arm64.c arch/x86.c arch/x86_64.c arch/ia64.c arch/ppc64.c arch/s390x.c arch/ppc.c arch/sparc64.c arch/mips64.c arch/loongarch64.c arch/riscv64.c OBJ_ARCH=$(patsubst %.c,%.o,$(SRC_ARCH))
btf.c new file +919 -0
919 lines not on this page · raw message
btf.h new file +176 -0
176 lines not on this page · raw message
kallsyms.c new file +371 -0
372 lines not on this page · raw message
kallsyms.h new file +42 -0
43 lines not on this page · raw message
makedumpfile.c +3 -0
@@ -27,6 +27,7 @@#include <limits.h> #include <assert.h> #include <zlib.h> +#include "kallsyms.h" struct symbol_table symbol_table;struct size_table size_table;
@@ -3103,6 +3104,8 @@ read_vmcoreinfo_from_vmcore(off_t offset, unsigned long size, int flag_xen_hv)if (!read_vmcoreinfo ()) goto out; } +read_vmcoreinfo_kallsyms (); +close_vmcoreinfo (); ret = TRUE;
makedumpfile.h +11 -0
@@ -257,6 +257,7 @@ static inline int string_exists(char *s) { return (s ? TRUE : FALSE); }#define UINT (ADDR ) *((unsigned int *)(ADDR))#define ULONG (ADDR ) *((unsigned long *)(ADDR))#define ULONGLONG (ADDR ) *((unsigned long long *)(ADDR)) +#define VOID_PTR (ADDR ) *((void **)(ADDR))/*
@@ -1917,6 +1918,16 @@ struct symbol_table {* symbols on sparc64 arch */ unsigned long long vmemmap_table; + +/* +* kallsyms related +*/ +unsigned long long kallsyms_names; +unsigned long long kallsyms_num_syms; +unsigned long long kallsyms_token_table; +unsigned long long kallsyms_token_index; +unsigned long long kallsyms_offsets; +unsigned long long kallsyms_relative_base; };struct size_table {
Signature · 1 line
2.47.0
RFC PATCH 5/10 Export necessary btf/kallsyms functions to eppic extension
In reply to Tao Liu--- erase_info.c | 16 +++++++++++++++- erase_info.h | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-)
erase_info.c +15 -1
@@ -20,6 +20,8 @@#include "print_info.h" #include "dwarf_info.h" #include "erase_info.h" +#include "kallsyms.h" +#include "btf.h" #include <dlfcn.h>
@@ -36,7 +38,19 @@ struct call_back eppic_cb = { &get_die_member_all, &get_die_nfields_all, &get_symbol_addr_all, - &update_filter_info_raw + &update_filter_info_raw, + &get_structure_size, + &get_member_offset, +/**********************/ + &update_filter_pages_info, + &get_kallsyms_value_by_name, + &get_struct_member_by_name, + &get_type_member_by_index, + &get_type_size_by_name, + &get_en_by_uniq_id, + &resolve_typedef, + &get_btf_type_by_type_id, + &id_to_uniq_id, };
erase_info.h +14 -0
@@ -19,6 +19,7 @@#ifndef _ERASE_INFO_H#define _ERASE_INFO_H +#include "btf.h" #define MAX_SIZE_STR_LEN (26)/*
@@ -52,6 +53,19 @@ struct call_back {int (*get_die_nfields_all)(unsigned long long die_off);unsigned long long (*get_symbol_addr_all)(char *symname);int (*update_filter_info_raw)(unsigned long long ,int ,int ); +long (*get_structure_size)(char *,int ); +long (*get_member_offset)(char *,char *,int ); +/********************************/ +int (*update_filter_pages_info)(unsigned long ,unsigned long ); +uint64_t (*get_kallsyms_value_by_name)(char *); +uint32_t (*get_struct_member_by_name)(char *,char *,struct member_info *); +bool (*get_type_member_by_index)(uint64_t ,int ,struct member_info *); +uint32_t (*get_type_size_by_name)(char *,int ,uint32_t *); +struct name_entry *(*get_en_by_uniq_id)(uint32_t ,struct btf_type *); +void (*resolve_typedef)(struct name_entry *,struct name_entry **,struct btf_type *); +int (*get_btf_type_by_type_id)(struct btf_file *,uint32_t , +struct btf_type *,struct name_entry **); +uint32_t (*id_to_uniq_id)(uint32_t ,struct btf_file *); };extern struct erase_info *erase_info;
Signature · 1 line
2.47.0
RFC PATCH 6/10 Port the maple tree data structures and functions
In reply to Tao LiuThe majority of maple tree code is copied from crash utility. Since currenty it is not needed by makedumpfile, maple tree is integrated with eppic extension only.
The minor change of maple tree code are:
1) a cache buffer for maple tree data because eppic script cannot allocate a buffer currently;
2) an interface for eppic script.
--- Makefile | 4 +- eppic_maple.c | 431 ++++++++++++++++++++++++++++++++++++++++++++++++++ eppic_maple.h | 8 + 3 files changed, 441 insertions(+), 2 deletions(-) create mode 100644 eppic_maple.c create mode 100644 eppic_maple.h
Makefile +2 -2
@@ -121,8 +121,8 @@ makedumpfile: $(SRC_BASE) $(OBJ_PART) $(OBJ_ARCH) -e "s/@VERSION@/$(VERSION)/" \ $(VPATH)makedumpfile.conf.5.in > $(VPATH)makedumpfile.conf.5 -eppic_makedumpfile.so: extension_eppic.c - $(CC) $(CFLAGS) $(LDFLAGS) -shared -rdynamic -o $@ extension_eppic.c -fPIC -leppic -ltinfo +eppic_makedumpfile.so: extension_eppic.c eppic_maple.c + $(CC) $(CFLAGS) $(LDFLAGS) -shared -rdynamic -o $@ $^ -fPIC -leppic -ltinfo clean: rm -f $(OBJ) $(OBJ_PART) $(OBJ_ARCH) makedumpfile makedumpfile.8 makedumpfile.conf.5
eppic_maple.c new file +431 -0
431 lines not on this page · raw message
eppic_maple.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef _EPPIC_MAPLE_H +#define _EPPIC_MAPLE_H +#include "makedumpfile.h" +int maple_init (bool ); +VALUE_S *maple_count (VALUE_S *); +VALUE_S *maple_elem (VALUE_S *,VALUE_S *); +#endif /*_EPPIC_MAPLE_H*/ +
Signature · 1 line
2.47.0
RFC PATCH 7/10 Supporting main() as the entry of eppic script
In reply to Tao LiuPreviously only a function with usage or help functions is regarded as the entry of eppic script. This constraint makes no sense because main() is widely accepted, and people can easily get confused when writing eppic script and blocked by the constraint. This patch will support main() as an entry.
--- extension_eppic.c | 7 +++++++ 1 file changed, 7 insertions(+)
extension_eppic.c +7 -0
@@ -49,6 +49,8 @@ static int apigetctype(int, char *, type_t *);* entry point and user will not have any option to execute the usage * or help functions. However they are required to identify the entry * points in the eppic macro. +* +* "main" can also work as the entry point of eppic macro. */ void reg_callback (char *name,int load)
@@ -59,6 +61,11 @@ reg_callback(char *name, int load)if (!load)return ; +if (!strcmp (name,"main" )) { +eppic_cmd (name,NULL ,0 ); +return ; + } +snprintf (fname,sizeof (fname),"%s_help" , name);if (eppic_chkfname (fname,0 )) {snprintf (fname,sizeof (fname),"%s_usage" , name);
Signature · 1 line
2.47.0
RFC PATCH 8/10 Enable page filtering for dwarf eppic
In reply to Tao LiuSince dwarf and btf have different apiops, so making it as parameter to eppic_init, and initialized respectively.
--- erase_info.c | 8 +++++--- extension_eppic.c | 34 +++++++++++++++++++++++++++++++--- extension_eppic.h | 6 ++++-- 3 files changed, 40 insertions(+), 8 deletions(-)
erase_info.c +5 -3
@@ -2202,7 +2202,7 @@ get_die_member_all(unsigned long long die_off, int index, long *offset,/* Process the eppic macro using eppic library */ static int -process_eppic_file (char *name_config) +process_eppic_file (char *name_config,bool is_btf) {void *handle;void (*eppic_load)(char *), (*eppic_unload)(char *);
@@ -2221,7 +2221,9 @@ process_eppic_file(char *name_config)* Support specifying eppic macros in makedumpfile.conf file */ - eppic_init =dlsym (handle,"eppic_init" ); +if (!is_btf) { + eppic_init =dlsym (handle,"eppic_dwarf_init" ); + }if (!eppic_init) {ERRMSG ("Could not find eppic_init function\n" );return FALSE;
@@ -2368,7 +2370,7 @@ gather_filter_info(void) ret =process_config_file (info->name_filterconfig);if (info->name_eppic_config) - ret &=process_eppic_file (info->name_eppic_config); + ret &=process_eppic_file (info->name_eppic_config, false);/* * Remove modules symbol information, we dont need now.
extension_eppic.c +31 -3
@@ -23,8 +23,10 @@#include "makedumpfile.h" #include "extension_eppic.h" +#include "eppic_maple.h" static int apigetctype (int ,char *,type_t *); +struct call_back *cb;/* * Most of the functions included in this file performs similar
@@ -416,7 +418,7 @@ apifindsym(char *p)return NULL ; } -apiops icops = { +apiops dwarf_icops = { apigetmem, apiputmem, apimember,
@@ -449,17 +451,27 @@ eppic_memset(VALUE_S *vaddr, VALUE_S *vch, VALUE_S *vlen)return eppic_makebtype (1 ); } +VALUE_S * +eppic_filter_pages (VALUE_S *p,VALUE_S *n) +{ +unsigned long pfn =eppic_getval (p); +unsigned long num =eppic_getval (n); + +UPDATE_FILTER_PAGE_INFO (pfn, num); +return eppic_makebtype (1 ); +} +/* Initialize eppic */ int -eppic_init (void *fun_ptr) +eppic_init (void *fun_ptr,apiops *ops,bool is_btf) { cb = (struct call_back *)fun_ptr;if (eppic_open () >=0 ) {/* Register call back functions */ -eppic_apiset (&icops,3 ,sizeof (long ),0 ); +eppic_apiset (ops,3 ,sizeof (long ),0 );/* set the new function callback */ eppic_setcallback (reg_callback);
@@ -468,8 +480,24 @@ eppic_init(void *fun_ptr)eppic_builtin ("int memset(char *, int, int)" , (bf_t *)eppic_memset); +if (maple_init (is_btf) == FALSE) +return 1 ; + +eppic_builtin ("int maple_count(char *)" , + (bf_t *)maple_count); + +eppic_builtin ("unsigned long maple_elem(char *, int)" , + (bf_t *)maple_elem); + +eppic_builtin ("unsigned long filter_pages(unsigned long, unsigned long)" , + (bf_t *)eppic_filter_pages); +return 0 ; }return 1 ; } +int eppic_dwarf_init (void *fun_ptr) +{ +return eppic_init (fun_ptr, &dwarf_icops, false); +}
extension_eppic.h +4 -2
@@ -79,8 +79,7 @@ do { \fprintf (stderr, x); \ }while (0 ) - -struct call_back *cb; +extern struct call_back *cb;#define GET_DOMAIN_ALL cb->get_domain_all#define READMEM cb->readmem
@@ -92,5 +91,8 @@ struct call_back *cb;#define GET_DIE_NFIELDS_ALL cb->get_die_nfields_all#define GET_SYMBOL_ADDR_ALL cb->get_symbol_addr_all#define UPDATE_FILTER_INFO_RAW cb->update_filter_info_raw +#define UPDATE_FILTER_PAGE_INFO cb->update_filter_pages_info + +int eppic_init (void *,apiops *,bool );#endif /* _EXTENSION_EPPIC_H */
Signature · 1 line
2.47.0
RFC PATCH 9/10 Enable page filtering for btf/kallsyms eppic
In reply to Tao LiuThis patch mainly implements the eppic interfaces using btf/kallsyms functions.
--- Makefile | 2 +- erase_info.c | 22 +++++ extension_btf.c | 218 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 extension_btf.c
Makefile +1 -1
@@ -121,7 +121,7 @@ makedumpfile: $(SRC_BASE) $(OBJ_PART) $(OBJ_ARCH) -e "s/@VERSION@/$(VERSION)/" \ $(VPATH)makedumpfile.conf.5.in > $(VPATH)makedumpfile.conf.5 -eppic_makedumpfile.so: extension_eppic.c eppic_maple.c +eppic_makedumpfile.so: extension_eppic.c eppic_maple.c extension_btf.c $(CC) $(CFLAGS) $(LDFLAGS) -shared -rdynamic -o $@ $^ -fPIC -leppic -ltinfo clean:
erase_info.c +22 -0
@@ -2223,6 +2223,8 @@ process_eppic_file(char *name_config, bool is_btf)if (!is_btf) { eppic_init =dlsym (handle,"eppic_dwarf_init" ); + }else { + eppic_init =dlsym (handle,"eppic_btf_init" ); }if (!eppic_init) {ERRMSG ("Could not find eppic_init function\n" );
@@ -2351,6 +2353,26 @@ gather_filter_info(void) {int ret = TRUE; +if (!info->name_vmlinux && info->name_eppic_config) { +/* No vmlinux is present, use btf & kallsyms instead. */ +if (init_kernel_kallsyms ()) + goto fail; +if (init_kernel_btf ()) + goto fail; +if (init_module_kallsyms ()) + goto fail; +if (init_module_btf ()) + goto fail; + ret =process_eppic_file (info->name_eppic_config, true); + goto out; +fail: + ret = FALSE; +out: +cleanup_btf (); +cleanup_kallsyms (); +return ret; + } +/* * Before processing filter config file, load the symbol data of * loaded modules from vmcore.
extension_btf.c new file +218 -0
219 lines not on this page · raw message
Signature · 1 line
2.47.0
RFC PATCH 10/10 Introducing 2 eppic scripts to test the dwarf/btf eppic extension
In reply to Tao LiuThis patch will introduce 2 eppic scripts. One is for filtering out amdgpu mm pages, the other is for printing all tasks VMAs. dwarf & btf eppic extension should produce the same result for every eppic script, mainly for test use.
--- eppic_scripts/filter_amdgpu_mm_pages.c | 36 ++++++++++++++++++++++++++ eppic_scripts/print_all_vma.c | 29 +++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 eppic_scripts/filter_amdgpu_mm_pages.c create mode 100644 eppic_scripts/print_all_vma.c
eppic_scripts/filter_amdgpu_mm_pages.c new file +36 -0
@@ -0,0 +1,36 @@ +int main () +{ +struct task_struct *p; +unsigned long p_off; +int i, c; +struct vm_area_struct *vma; +struct ttm_buffer_object *tbo; +unsigned long pfn, num, mt; + + p = (struct task_struct *)&init_task; + p_off = (unsigned long )&(p->tasks) - (unsigned long )p; + +do { +if (!(p->mm)) { + p = (struct task_struct *)((unsigned long )(p->tasks.next) - p_off); +continue ; + } + mt = (unsigned long )&(p->mm->mm_mt); + + c =maple_count ((char *)mt); +for (i =0 ; i < c; i++) { + vma = (struct vm_area_struct *)maple_elem ((char *)mt, i); +if (vma->vm_ops == &amdgpu_gem_vm_ops) { + tbo = (struct ttm_buffer_object *)(vma->vm_private_data); +if (tbo->ttm) { + num = (unsigned long )(tbo->ttm->num_pages); + pfn = ((unsigned long )(tbo->ttm->pages[0 ]) - *(unsigned long *)&vmemmap_base) /sizeof (struct page ); +filter_pages (pfn, num); + } + } + } + p = (struct task_struct *)((unsigned long )(p->tasks.next) - p_off); + }while (p != &init_task); + +return 1 ; +}
eppic_scripts/print_all_vma.c new file +29 -0
@@ -0,0 +1,29 @@ +int main () +{ +struct task_struct *p; +unsigned long p_off; +int i, c; +struct vm_area_struct *vma; +unsigned long mt; + + p = (struct task_struct *)&init_task; + p_off = (unsigned long )&(p->tasks) - (unsigned long )p; + +do { +if (!(p->mm)) { + p = (struct task_struct *)((unsigned long )(p->tasks.next) - p_off); +continue ; + } +printf ("PID: %d\n" , (int )(p->pid)); + mt = (unsigned long )&(p->mm->mm_mt); + + c =maple_count ((char *)mt); +for (i =0 ; i < c; i++) { + vma = (struct vm_area_struct *)maple_elem ((char *)mt, i); +printf ("%lx\n" , vma); + } + p = (struct task_struct *)((unsigned long )(p->tasks.next) - p_off); + }while (p != &init_task); + +return 1 ; +}
Signature · 1 line
2.47.0
Kindly ping...
Any comments for this patchset?
Thanks,
Tao Liu
Quoted 152 lines · Tao Liu
A) This patchset will introduce the following features to makedumpfile:
1) Enable eppic script for memory pages filtering.
2) Enable btf and kallsyms for symbol type and address resolving.
3) Port maple tree data structures and functions, primarily used for vma iteration.B) The purpose of the features are:
1) Currently makedumpfile filters mm pages based on page flags, because flags can help to determine one page's usage. But this page-flag-checking method lacks of flexibility in certain cases, e.g. if we want to filter those mm pages occupied by GPU during vmcore dumping due to:
a) GPU may be taking a large memory and contains sensitive data;
b) GPU mm pages have no relations to kernel crash and useless for vmcore analysis.But there is no GPU mm page specific flags, and apparently we don't need to create one just for kdump use. A programmable filtering tool is more suitable for such cases. In addition, different GPU vendors may use different ways for mm pages allocating, programmable filtering is better than hard coding these GPU specific logics into makedumpfile in this case.
2) Currently makedumpfile already contains a programmable filtering tool, aka eppic script, which allows user to write customized code for data erasing. However it has the following drawbacks:
a) cannot do mm page filtering.
b) need to access to debuginfo of both kernel and modules, which is not applicable in the 2nd kernel.
c) Poor performance, making vmcore dumping time unacceptable (See the following performance testing).makedumpfile need to resolve the dwarf data from debuginfo, to get symbols types and addresses. In recent kernel there are dwarf alternatives such as btf/kallsyms which can be used for this purpose. And btf/kallsyms info are already packed within vmcore, so we can use it directly.
3) Maple tree data structures are used in recent kernels, such as vma iteration. So maple tree poring is needed.
With these, this patchset introduces an upgraded eppic, which is based on btf/kallsyms symbol resolving, and is programmable for mm page filtering. The following info shows its usage and performance, please note the tests are performed in 1st kernel:
$ time ./makedumpfile -d 31 -l /var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore /tmp/dwarf.out -x /lib/debug/lib/modules/6.11.8-300.fc41.x86_64/vmlinux --eppic eppic_scripts/filter_amdgpu_mm_pages.c real 14m6.894s user 4m16.900s sys 9m44.695s$ time ./makedumpfile -d 31 -l /var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore /tmp/btf.out --eppic eppic_scripts/filter_amdgpu_mm_pages.c real 0m10.672s user 0m9.270s sys 0m1.130s-rw------- 1 root root 367475074 Jun 10 18:06 btf.out
-rw------- 1 root root 367475074 Jun 10 21:05 dwarf.out
-rw-rw-rw- 1 root root 387181418 Jun 10 18:03 /var/crash/127.0.0.1-2025-06-10-18:03:12/vmcoreC) Discussion:
1) GPU types: Currently only tested with amdgpu's mm page filtering, others are not tested.
2) Code structure: There are some similar code shared by makedumpfile and crash, such as maple tree data structure, also I planed to port the btf/kallsyms code to crash as well, so there are code duplications for crash & makedumpfile. Since I havn't working on crash poring, code change on btf/kallsyms is expected. How can we share the code, creating a common library or keep the duplication as it is?
3) OS: The code can work on rhel-10+/rhel9.5+ on x86_64/arm64/s390/ppc64. Others are not tested.D) Testing:
1) If you don't want to create your vmcore, you can find a vmcore which I created with amdgpu mm pages unfiltered [1], the amdgpu mm pages are allocated by program [2]. You can use the vmcore in 1st kernel to filter the amdgpu mm pages by the previous performance testing cmdline. To verify the pages are filtered in crash:
Unfiltered:
crash> search -c "!QAZXSW@#EDC"
ffff96b7fa800000: !QAZXSW@#EDCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ffff96b87c800000: !QAZXSW@#EDCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX crash> rdffff96b7fa800000
ffff96b7fa800000:405753585a415121!QAZXSW@
crash> rdffff96b87c800000
ffff96b87c800000:405753585a415121!QAZXSW@Filtered:
crash> search -c "!QAZXSW@#EDC"
crash> rdffff96b7fa800000
rd: page excluded: kernel virtual address:ffff96b7fa800000type: "64-bit KVADDR" crash> rdffff96b87c800000
rd: page excluded: kernel virtual address:ffff96b87c800000type: "64-bit KVADDR"2) You can use
eppic_scripts/print_all_vma.cagainst an ordinary vmcore to test only btf/kallsyms functions by output all VMAs if no amdgpu vmcores/machine avaliable.[1]: https://people.redhat.com/~ltao/core/
[2]: https://gist.github.com/liutgnu/a8cbce1c666452f1530e1410d1f352dfTao Liu (10):
dwarf_info: Support kernel address randomization
dwarf_info: Fix a infinite recursion bug forsearch_domainAdd page filtering function
Add btf/kallsyms support for symbol type/address resolving Export necessary btf/kallsyms functions to eppic extension Port the maple tree data structures and functions Supportingmain()as the entry of eppic script
Enable page filtering for dwarf eppic
Enable page filtering for btf/kallsyms eppic Introducing 2 eppic scripts to test the dwarf/btf eppic extensionMakefile | 6 +- btf.c | 919 +++++++++++++++++++++++++ btf.h | 176 +++++ dwarf_info.c | 15 +- eppic_maple.c | 431 ++++++++++++ eppic_maple.h | 8 + eppic_scripts/filter_amdgpu_mm_pages.c | 36 + eppic_scripts/print_all_vma.c | 29 + erase_info.c | 123 +++- erase_info.h | 22 + extension_btf.c | 218 ++++++ extension_eppic.c | 41 +- extension_eppic.h | 6 +- kallsyms.c | 371 ++++++++++ kallsyms.h | 42 ++ makedumpfile.c | 21 +- makedumpfile.h | 11 + 17 files changed, 2448 insertions(+), 27 deletions(-) create mode 100644 btf.c create mode 100644 btf.h create mode 100644 eppic_maple.c create mode 100644 eppic_maple.h create mode 100644 eppic_scripts/filter_amdgpu_mm_pages.c create mode 100644 eppic_scripts/print_all_vma.c create mode 100644 extension_btf.c create mode 100644 kallsyms.c create mode 100644 kallsyms.h--
2.47.0
Thank you for the suggestion.
I think it's a good idea, but epppic needs careful consideration. I'm sorry, but please let me check for a moment.
Thanks,
Masa
Quoted 160 lines · Tao Liu
Kindly ping...
Any comments for this patchset?
Thanks,
Tao LiuQuoted 151 lines · Tao Liu
A) This patchset will introduce the following features to makedumpfile:
1) Enable eppic script for memory pages filtering.
2) Enable btf and kallsyms for symbol type and address resolving.
3) Port maple tree data structures and functions, primarily used for vma iteration.B) The purpose of the features are:
1) Currently makedumpfile filters mm pages based on page flags, because flags can help to determine one page's usage. But this page-flag-checking method lacks of flexibility in certain cases, e.g. if we want to filter those mm pages occupied by GPU during vmcore dumping due to:
a) GPU may be taking a large memory and contains sensitive data;
b) GPU mm pages have no relations to kernel crash and useless for vmcore analysis.But there is no GPU mm page specific flags, and apparently we don't need to create one just for kdump use. A programmable filtering tool is more suitable for such cases. In addition, different GPU vendors may use different ways for mm pages allocating, programmable filtering is better than hard coding these GPU specific logics into makedumpfile in this case.
2) Currently makedumpfile already contains a programmable filtering tool, aka eppic script, which allows user to write customized code for data erasing. However it has the following drawbacks:
a) cannot do mm page filtering.
b) need to access to debuginfo of both kernel and modules, which is not applicable in the 2nd kernel.
c) Poor performance, making vmcore dumping time unacceptable (See the following performance testing).makedumpfile need to resolve the dwarf data from debuginfo, to get symbols types and addresses. In recent kernel there are dwarf alternatives such as btf/kallsyms which can be used for this purpose. And btf/kallsyms info are already packed within vmcore, so we can use it directly.
3) Maple tree data structures are used in recent kernels, such as vma iteration. So maple tree poring is needed. With these, this patchset introduces an upgraded eppic, which is based on btf/kallsyms symbol resolving, and is programmable for mm page filtering. The following info shows its usage and performance, please note the tests are performed in 1st kernel: $ time ./makedumpfile -d 31 -l /var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore /tmp/dwarf.out -x /lib/debug/lib/modules/6.11.8-300.fc41.x86_64/vmlinux --eppic eppic_scripts/filter_amdgpu_mm_pages.c real 14m6.894s user 4m16.900s sys 9m44.695s $ time ./makedumpfile -d 31 -l /var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore /tmp/btf.out --eppic eppic_scripts/filter_amdgpu_mm_pages.c real 0m10.672s user 0m9.270s sys 0m1.130s -rw------- 1 root root 367475074 Jun 10 18:06 btf.out -rw------- 1 root root 367475074 Jun 10 21:05 dwarf.out -rw-rw-rw- 1 root root 387181418 Jun 10 18:03 /var/crash/127.0.0.1-2025-06-10-18:03:12/vmcoreC) Discussion:
1) GPU types: Currently only tested with amdgpu's mm page filtering, others are not tested.
2) Code structure: There are some similar code shared by makedumpfile and crash, such as maple tree data structure, also I planed to port the btf/kallsyms code to crash as well, so there are code duplications for crash & makedumpfile. Since I havn't working on crash poring, code change on btf/kallsyms is expected. How can we share the code, creating a common library or keep the duplication as it is?
3) OS: The code can work on rhel-10+/rhel9.5+ on x86_64/arm64/s390/ppc64. Others are not tested.D) Testing:
1) If you don't want to create your vmcore, you can find a vmcore which I created with amdgpu mm pages unfiltered [1], the amdgpu mm pages are allocated by program [2]. You can use the vmcore in 1st kernel to filter the amdgpu mm pages by the previous performance testing cmdline. To verify the pages are filtered in crash:
Unfiltered:
crash> search -c "!QAZXSW@#EDC"
ffff96b7fa800000: !QAZXSW@#EDCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ffff96b87c800000: !QAZXSW@#EDCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX crash> rdffff96b7fa800000
ffff96b7fa800000:405753585a415121!QAZXSW@
crash> rdffff96b87c800000
ffff96b87c800000:405753585a415121!QAZXSW@Filtered:
crash> search -c "!QAZXSW@#EDC"
crash> rdffff96b7fa800000
rd: page excluded: kernel virtual address:ffff96b7fa800000type: "64-bit KVADDR" crash> rdffff96b87c800000
rd: page excluded: kernel virtual address:ffff96b87c800000type: "64-bit KVADDR"2) You can use
eppic_scripts/print_all_vma.cagainst an ordinary vmcore to test only btf/kallsyms functions by output all VMAs if no amdgpu vmcores/machine avaliable.[1]: https://people.redhat.com/~ltao/core/
[2]: https://gist.github.com/liutgnu/a8cbce1c666452f1530e1410d1f352dfTao Liu (10):
dwarf_info: Support kernel address randomization
dwarf_info: Fix a infinite recursion bug forsearch_domainAdd page filtering function
Add btf/kallsyms support for symbol type/address resolving Export necessary btf/kallsyms functions to eppic extension Port the maple tree data structures and functions Supportingmain()as the entry of eppic script
Enable page filtering for dwarf eppic
Enable page filtering for btf/kallsyms eppic Introducing 2 eppic scripts to test the dwarf/btf eppic extensionMakefile | 6 +- btf.c | 919 +++++++++++++++++++++++++ btf.h | 176 +++++ dwarf_info.c | 15 +- eppic_maple.c | 431 ++++++++++++ eppic_maple.h | 8 + eppic_scripts/filter_amdgpu_mm_pages.c | 36 + eppic_scripts/print_all_vma.c | 29 + erase_info.c | 123 +++- erase_info.h | 22 + extension_btf.c | 218 ++++++ extension_eppic.c | 41 +- extension_eppic.h | 6 +- kallsyms.c | 371 ++++++++++ kallsyms.h | 42 ++ makedumpfile.c | 21 +- makedumpfile.h | 11 + 17 files changed, 2448 insertions(+), 27 deletions(-)create mode 100644
btf.c
create mode 100644btf.h
create mode 100644eppic_maple.c
create mode 100644eppic_maple.h
create mode 100644eppic_scripts/filter_amdgpu_mm_pages.ccreate mode 100644eppic_scripts/print_all_vma.ccreate mode 100644extension_btf.c
create mode 100644kallsyms.c
create mode 100644kallsyms.h--
2.47.0
Hi YAMAZAKI,
Thanks for your comments.
Quoted 4 lines · YAMAZAKI MASAMITSU(山崎 真光)
Thank you for the suggestion.
I think it's a good idea,
but epppic needs careful consideration.
Do you mean there are drawbacks of using eppic?
From my side, one advantage of eppic is, users can use the kernel data structures/variables directly without redefine it, like:
struct task_struct *p;
p = (struct task_struct *)&init_task;
Users don't need to include headers to define what task_struct looks like, and can use global variable init_task without declaring it. The callbacks of eppic can resolve these missing info via dwarf/btf/kallsyms during runtime. I think this feature can make the eppic scripts tidy and convenient. Also we can use other similar c interpreters, but I haven't encountered one with the similar feature, also considering eppic has been in makedumpfile for years, so people may already be familiar with it...
Quoted 2 lines
I'm sorry, but please let me check for a moment.
Sure, no problem, please take your time.
Thanks,
Tao Liu
Quoted 164 lines
Thanks,
MasaQuoted 160 lines · Tao Liu
Kindly ping...
Any comments for this patchset?
Thanks,
Tao LiuQuoted 151 lines · Tao Liu
A) This patchset will introduce the following features to makedumpfile:
1) Enable eppic script for memory pages filtering.
2) Enable btf and kallsyms for symbol type and address resolving.
3) Port maple tree data structures and functions, primarily used for vma iteration.B) The purpose of the features are:
1) Currently makedumpfile filters mm pages based on page flags, because flags can help to determine one page's usage. But this page-flag-checking method lacks of flexibility in certain cases, e.g. if we want to filter those mm pages occupied by GPU during vmcore dumping due to:
a) GPU may be taking a large memory and contains sensitive data;
b) GPU mm pages have no relations to kernel crash and useless for vmcore analysis.But there is no GPU mm page specific flags, and apparently we don't need to create one just for kdump use. A programmable filtering tool is more suitable for such cases. In addition, different GPU vendors may use different ways for mm pages allocating, programmable filtering is better than hard coding these GPU specific logics into makedumpfile in this case.
2) Currently makedumpfile already contains a programmable filtering tool, aka eppic script, which allows user to write customized code for data erasing. However it has the following drawbacks:
a) cannot do mm page filtering.
b) need to access to debuginfo of both kernel and modules, which is not applicable in the 2nd kernel.
c) Poor performance, making vmcore dumping time unacceptable (See the following performance testing).makedumpfile need to resolve the dwarf data from debuginfo, to get symbols types and addresses. In recent kernel there are dwarf alternatives such as btf/kallsyms which can be used for this purpose. And btf/kallsyms info are already packed within vmcore, so we can use it directly.
3) Maple tree data structures are used in recent kernels, such as vma iteration. So maple tree poring is needed. With these, this patchset introduces an upgraded eppic, which is based on btf/kallsyms symbol resolving, and is programmable for mm page filtering. The following info shows its usage and performance, please note the tests are performed in 1st kernel: $ time ./makedumpfile -d 31 -l /var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore /tmp/dwarf.out -x /lib/debug/lib/modules/6.11.8-300.fc41.x86_64/vmlinux --eppic eppic_scripts/filter_amdgpu_mm_pages.c real 14m6.894s user 4m16.900s sys 9m44.695s $ time ./makedumpfile -d 31 -l /var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore /tmp/btf.out --eppic eppic_scripts/filter_amdgpu_mm_pages.c real 0m10.672s user 0m9.270s sys 0m1.130s -rw------- 1 root root 367475074 Jun 10 18:06 btf.out -rw------- 1 root root 367475074 Jun 10 21:05 dwarf.out -rw-rw-rw- 1 root root 387181418 Jun 10 18:03 /var/crash/127.0.0.1-2025-06-10-18:03:12/vmcoreC) Discussion:
1) GPU types: Currently only tested with amdgpu's mm page filtering, others are not tested.
2) Code structure: There are some similar code shared by makedumpfile and crash, such as maple tree data structure, also I planed to port the btf/kallsyms code to crash as well, so there are code duplications for crash & makedumpfile. Since I havn't working on crash poring, code change on btf/kallsyms is expected. How can we share the code, creating a common library or keep the duplication as it is?
3) OS: The code can work on rhel-10+/rhel9.5+ on x86_64/arm64/s390/ppc64. Others are not tested.D) Testing:
1) If you don't want to create your vmcore, you can find a vmcore which I created with amdgpu mm pages unfiltered [1], the amdgpu mm pages are allocated by program [2]. You can use the vmcore in 1st kernel to filter the amdgpu mm pages by the previous performance testing cmdline. To verify the pages are filtered in crash:
Unfiltered:
crash> search -c "!QAZXSW@#EDC"
ffff96b7fa800000: !QAZXSW@#EDCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ffff96b87c800000: !QAZXSW@#EDCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX crash> rdffff96b7fa800000
ffff96b7fa800000:405753585a415121!QAZXSW@
crash> rdffff96b87c800000
ffff96b87c800000:405753585a415121!QAZXSW@Filtered:
crash> search -c "!QAZXSW@#EDC"
crash> rdffff96b7fa800000
rd: page excluded: kernel virtual address:ffff96b7fa800000type: "64-bit KVADDR" crash> rdffff96b87c800000
rd: page excluded: kernel virtual address:ffff96b87c800000type: "64-bit KVADDR"2) You can use
eppic_scripts/print_all_vma.cagainst an ordinary vmcore to test only btf/kallsyms functions by output all VMAs if no amdgpu vmcores/machine avaliable.[1]: https://people.redhat.com/~ltao/core/
[2]: https://gist.github.com/liutgnu/a8cbce1c666452f1530e1410d1f352dfTao Liu (10):
dwarf_info: Support kernel address randomization
dwarf_info: Fix a infinite recursion bug forsearch_domainAdd page filtering function
Add btf/kallsyms support for symbol type/address resolving Export necessary btf/kallsyms functions to eppic extension Port the maple tree data structures and functions Supportingmain()as the entry of eppic script
Enable page filtering for dwarf eppic
Enable page filtering for btf/kallsyms eppic Introducing 2 eppic scripts to test the dwarf/btf eppic extensionMakefile | 6 +- btf.c | 919 +++++++++++++++++++++++++ btf.h | 176 +++++ dwarf_info.c | 15 +- eppic_maple.c | 431 ++++++++++++ eppic_maple.h | 8 + eppic_scripts/filter_amdgpu_mm_pages.c | 36 + eppic_scripts/print_all_vma.c | 29 + erase_info.c | 123 +++- erase_info.h | 22 + extension_btf.c | 218 ++++++ extension_eppic.c | 41 +- extension_eppic.h | 6 +- kallsyms.c | 371 ++++++++++ kallsyms.h | 42 ++ makedumpfile.c | 21 +- makedumpfile.h | 11 + 17 files changed, 2448 insertions(+), 27 deletions(-)create mode 100644
btf.c
create mode 100644btf.h
create mode 100644eppic_maple.c
create mode 100644eppic_maple.h
create mode 100644eppic_scripts/filter_amdgpu_mm_pages.ccreate mode 100644eppic_scripts/print_all_vma.ccreate mode 100644extension_btf.c
create mode 100644kallsyms.c
create mode 100644kallsyms.h--
2.47.0
Hi Liu
I'm sorry it took so long.
Your proposed issue with regard to GPU memory is useful, but it may not be a frequently used feature. I think it would be better to use an external library, script, or option whenever possible.
As you already know, I am concerned that code related to btf, kallsyms and maple tree has been ported. These newer features are appealing. However, I feel that sharing code with crash will increase future maintenance efforts if we try to maintain consistency. On the other hand, if they are not identical, maintenance will be less frequent and the feature may not be updated.
I also think that the eppic script would be better treated as an additional script. Although some time has passed since the eppic function was added, the addition of new scripts and updates to supported versions are limited.
I think it would be better to add documentation introducing the script as a related script rather than including it directly in the makedumpfile repository.
However, this proposal also includes suggestions for fixing some bugs and speeding up existing eppic functions. It seems that these things need to be incorporated.
In other words, I think it's better to separate things that can be separated.
Sincerely
Quoted 197 lines · Tao Liu
Hi YAMAZAKI,
Thanks for your comments.
Quoted 3 lines · YAMAZAKI MASAMITSU(山崎 真光)
Thank you for the suggestion.
I think it's a good idea,
but epppic needs careful consideration.Do you mean there are drawbacks of using eppic?
From my side, one advantage of eppic is, users can use the kernel data
structures/variables directly without redefine it, like:struct
task_struct*p;
p = (structtask_struct*)&init_task;Users don't need to include headers to define what
task_structlooks like, and can use global variableinit_taskwithout declaring it. The callbacks of eppic can resolve these missing info via dwarf/btf/kallsyms during runtime. I think this feature can make the eppic scripts tidy and convenient. Also we can use other similar c interpreters, but I haven't encountered one with the similar feature, also considering eppic has been in makedumpfile for years, so people may already be familiar with it...Quoted 2 lines
I'm sorry, but please let me check for a moment.
Sure, no problem, please take your time.
Thanks,
Tao LiuQuoted 164 lines
Thanks,
MasaQuoted 160 lines · Tao Liu
Kindly ping...
Any comments for this patchset?
Thanks,
Tao LiuQuoted 151 lines · Tao Liu
A) This patchset will introduce the following features to makedumpfile:
1) Enable eppic script for memory pages filtering.
2) Enable btf and kallsyms for symbol type and address resolving.
3) Port maple tree data structures and functions, primarily used for vma iteration.B) The purpose of the features are:
1) Currently makedumpfile filters mm pages based on page flags, because flags can help to determine one page's usage. But this page-flag-checking method lacks of flexibility in certain cases, e.g. if we want to filter those mm pages occupied by GPU during vmcore dumping due to:
a) GPU may be taking a large memory and contains sensitive data;
b) GPU mm pages have no relations to kernel crash and useless for vmcore analysis.But there is no GPU mm page specific flags, and apparently we don't need to create one just for kdump use. A programmable filtering tool is more suitable for such cases. In addition, different GPU vendors may use different ways for mm pages allocating, programmable filtering is better than hard coding these GPU specific logics into makedumpfile in this case.
2) Currently makedumpfile already contains a programmable filtering tool, aka eppic script, which allows user to write customized code for data erasing. However it has the following drawbacks:
a) cannot do mm page filtering.
b) need to access to debuginfo of both kernel and modules, which is not applicable in the 2nd kernel.
c) Poor performance, making vmcore dumping time unacceptable (See the following performance testing).makedumpfile need to resolve the dwarf data from debuginfo, to get symbols types and addresses. In recent kernel there are dwarf alternatives such as btf/kallsyms which can be used for this purpose. And btf/kallsyms info are already packed within vmcore, so we can use it directly.
3) Maple tree data structures are used in recent kernels, such as vma iteration. So maple tree poring is needed.
With these, this patchset introduces an upgraded eppic, which is based on btf/kallsyms symbol resolving, and is programmable for mm page filtering. The following info shows its usage and performance, please note the tests are performed in 1st kernel:
$ time ./makedumpfile -d 31 -l /var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore
/tmp/dwarf.out-x/lib/debug/lib/modules/6.11.8-300.fc41.x86_64/vmlinux--eppiceppic_scripts/filter_amdgpu_mm_pages.c
real 14m6.894s
user 4m16.900s
sys 9m44.695s$ time ./makedumpfile -d 31 -l /var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore
/tmp/btf.out--eppiceppic_scripts/filter_amdgpu_mm_pages.c
real 0m10.672s
user 0m9.270s
sys 0m1.130s-rw------- 1 root root 367475074 Jun 10 18:06 btf.out
-rw------- 1 root root 367475074 Jun 10 21:05 dwarf.out
-rw-rw-rw- 1 root root 387181418 Jun 10 18:03 /var/crash/127.0.0.1-2025-06-10-18:03:12/vmcoreC) Discussion:
1) GPU types: Currently only tested with amdgpu's mm page filtering, others are not tested.
2) Code structure: There are some similar code shared by makedumpfile and crash, such as maple tree data structure, also I planed to port the btf/kallsyms code to crash as well, so there are code duplications for crash & makedumpfile. Since I havn't working on crash poring, code change on btf/kallsyms is expected. How can we share the code, creating a common library or keep the duplication as it is?
3) OS: The code can work on rhel-10+/rhel9.5+ on x86_64/arm64/s390/ppc64. Others are not tested.D) Testing:
1) If you don't want to create your vmcore, you can find a vmcore which I created with amdgpu mm pages unfiltered [1], the amdgpu mm pages are allocated by program [2]. You can use the vmcore in 1st kernel to filter the amdgpu mm pages by the previous performance testing cmdline. To verify the pages are filtered in crash:
Unfiltered:
crash> search -c "!QAZXSW@#EDC"
ffff96b7fa800000: !QAZXSW@#EDCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ffff96b87c800000: !QAZXSW@#EDCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX crash> rdffff96b7fa800000
ffff96b7fa800000:405753585a415121!QAZXSW@
crash> rdffff96b87c800000
ffff96b87c800000:405753585a415121!QAZXSW@Filtered:
crash> search -c "!QAZXSW@#EDC"
crash> rdffff96b7fa800000
rd: page excluded: kernel virtual address:ffff96b7fa800000type: "64-bit KVADDR" crash> rdffff96b87c800000
rd: page excluded: kernel virtual address:ffff96b87c800000type: "64-bit KVADDR"2) You can use
eppic_scripts/print_all_vma.cagainst an ordinary vmcore to test only btf/kallsyms functions by output all VMAs if no amdgpu vmcores/machine avaliable.[1]: https://people.redhat.com/~ltao/core/
[2]: https://gist.github.com/liutgnu/a8cbce1c666452f1530e1410d1f352dfTao Liu (10):
dwarf_info: Support kernel address randomization
dwarf_info: Fix a infinite recursion bug forsearch_domainAdd page filtering function
Add btf/kallsyms support for symbol type/address resolving Export necessary btf/kallsyms functions to eppic extension Port the maple tree data structures and functions Supportingmain()as the entry of eppic script
Enable page filtering for dwarf eppic
Enable page filtering for btf/kallsyms eppic Introducing 2 eppic scripts to test the dwarf/btf eppic extensionMakefile | 6 +- btf.c | 919 +++++++++++++++++++++++++ btf.h | 176 +++++ dwarf_info.c | 15 +- eppic_maple.c | 431 ++++++++++++ eppic_maple.h | 8 + eppic_scripts/filter_amdgpu_mm_pages.c | 36 + eppic_scripts/print_all_vma.c | 29 + erase_info.c | 123 +++- erase_info.h | 22 + extension_btf.c | 218 ++++++ extension_eppic.c | 41 +- extension_eppic.h | 6 +- kallsyms.c | 371 ++++++++++ kallsyms.h | 42 ++ makedumpfile.c | 21 +- makedumpfile.h | 11 + 17 files changed, 2448 insertions(+), 27 deletions(-)create mode 100644
btf.c
create mode 100644btf.h
create mode 100644eppic_maple.c
create mode 100644eppic_maple.h
create mode 100644eppic_scripts/filter_amdgpu_mm_pages.ccreate mode 100644eppic_scripts/print_all_vma.ccreate mode 100644extension_btf.c
create mode 100644kallsyms.c
create mode 100644kallsyms.h--
2.47.0
Hi YAMAZAKI,
Thanks a lot for your comments!
Quoted 4 lines · YAMAZAKI MASAMITSU(山崎 真光)
Hi Liu
I'm sorry it took so long.
No worries. :)
Quoted 4 lines
Your proposed issue with regard to GPU memory is useful, but it may not be a frequently used feature. I think it would be better to use an external library, script, or option whenever possible.
To add some context, I have received some issue reports about filtering GPU mem pages out of vmcore, otherwise the vmcore will be too large. And I think this is a to-do feature, as GPU nowadays are used more often as AI training, and frankly we have to address the issue eventually.
Quoted 7 lines
As you already know, I am concerned that code related to btf, kallsyms and maple tree has been ported. These newer features are appealing. However, I feel that sharing code with crash will increase future maintenance efforts if we try to maintain consistency. On the other hand, if they are not identical, maintenance will be less frequent and the feature may not be updated.
OK, understood. Then I will not make it share code with crash.
Quoted 8 lines
I also think that the eppic script would be better treated as an additional script. Although some time has passed since the eppic function was added, the addition of new scripts and updates to supported versions are limited.
I think it would be better to add documentation introducing the script as a related script rather than including it directly in the makedumpfile repository.
Yes, I totally agree. The filter_amdgpu_mm_pages.c is just a POC to demo the final result that the patchset is doing, all the code modifications are to serve this eppic script for amdgpu's mm pages filtering. We won't ship the eppic script to everyone, because it is not generic to all. My thought is, we empower makedumpfile with the ability to filter GPU mm pages via BTF/eppic, and end users can use this feature to address their specific cases, so it's users' duty to maintain/adapt the eppic scripts.
Quoted 4 lines
However, this proposal also includes suggestions for fixing some bugs and speeding up existing eppic functions. It seems that these things need to be incorporated.
The bug fixes related to dwarf_info aren't a must-have for filtering gpu mm page via eppic. In fact, dwarf or BTF either can be the source of debuginfo, which will be used to determine the details of kernel data structures. In other words, we can do gpu mm pages filtering via (dwarf + eppic + maple_tree), or via (BTF/kallsyms + eppic + maple_tree). Either path can get the final vmcore with gpu mm page filtered. But, the 2nd path(BTF/kallsyms + eppic + maple_tree) is more suitable for kdump in 2nd kernel, because BTF/kallsyms are available from kernel(in memory & smaller), and dwarf is only available from debuginfo files(in disk & larger). Also we can make a performance comparison of the 2 paths. So I added the bug fixes of dwarf_info in this patch set.
Quoted 3 lines
In other words, I think it's better to separate things that can be separated.
Yes, sure! I will try to do the separate in v2.
Thanks,
Tao Liu
Quoted 201 lines
Sincerely
Quoted 197 lines · Tao Liu
Hi YAMAZAKI,
Thanks for your comments.
Quoted 3 lines · YAMAZAKI MASAMITSU(山崎 真光)
Thank you for the suggestion.
I think it's a good idea,
but epppic needs careful consideration.Do you mean there are drawbacks of using eppic?
From my side, one advantage of eppic is, users can use the kernel data
structures/variables directly without redefine it, like:struct
task_struct*p;
p = (structtask_struct*)&init_task;Users don't need to include headers to define what
task_structlooks like, and can use global variableinit_taskwithout declaring it. The callbacks of eppic can resolve these missing info via dwarf/btf/kallsyms during runtime. I think this feature can make the eppic scripts tidy and convenient. Also we can use other similar c interpreters, but I haven't encountered one with the similar feature, also considering eppic has been in makedumpfile for years, so people may already be familiar with it...Quoted 2 lines
I'm sorry, but please let me check for a moment.
Sure, no problem, please take your time.
Thanks,
Tao LiuQuoted 164 lines
Thanks,
MasaQuoted 160 lines · Tao Liu
Kindly ping...
Any comments for this patchset?
Thanks,
Tao LiuQuoted 151 lines · Tao Liu
A) This patchset will introduce the following features to makedumpfile:
1) Enable eppic script for memory pages filtering.
2) Enable btf and kallsyms for symbol type and address resolving.
3) Port maple tree data structures and functions, primarily used for vma iteration.B) The purpose of the features are:
1) Currently makedumpfile filters mm pages based on page flags, because flags can help to determine one page's usage. But this page-flag-checking method lacks of flexibility in certain cases, e.g. if we want to filter those mm pages occupied by GPU during vmcore dumping due to:
a) GPU may be taking a large memory and contains sensitive data;
b) GPU mm pages have no relations to kernel crash and useless for vmcore analysis.But there is no GPU mm page specific flags, and apparently we don't need to create one just for kdump use. A programmable filtering tool is more suitable for such cases. In addition, different GPU vendors may use different ways for mm pages allocating, programmable filtering is better than hard coding these GPU specific logics into makedumpfile in this case.
2) Currently makedumpfile already contains a programmable filtering tool, aka eppic script, which allows user to write customized code for data erasing. However it has the following drawbacks:
a) cannot do mm page filtering.
b) need to access to debuginfo of both kernel and modules, which is not applicable in the 2nd kernel.
c) Poor performance, making vmcore dumping time unacceptable (See the following performance testing).makedumpfile need to resolve the dwarf data from debuginfo, to get symbols types and addresses. In recent kernel there are dwarf alternatives such as btf/kallsyms which can be used for this purpose. And btf/kallsyms info are already packed within vmcore, so we can use it directly.
3) Maple tree data structures are used in recent kernels, such as vma iteration. So maple tree poring is needed.
With these, this patchset introduces an upgraded eppic, which is based on btf/kallsyms symbol resolving, and is programmable for mm page filtering. The following info shows its usage and performance, please note the tests are performed in 1st kernel:
$ time ./makedumpfile -d 31 -l /var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore
/tmp/dwarf.out-x/lib/debug/lib/modules/6.11.8-300.fc41.x86_64/vmlinux--eppiceppic_scripts/filter_amdgpu_mm_pages.c
real 14m6.894s
user 4m16.900s
sys 9m44.695s$ time ./makedumpfile -d 31 -l /var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore
/tmp/btf.out--eppiceppic_scripts/filter_amdgpu_mm_pages.c
real 0m10.672s
user 0m9.270s
sys 0m1.130s-rw------- 1 root root 367475074 Jun 10 18:06 btf.out
-rw------- 1 root root 367475074 Jun 10 21:05 dwarf.out
-rw-rw-rw- 1 root root 387181418 Jun 10 18:03 /var/crash/127.0.0.1-2025-06-10-18:03:12/vmcoreC) Discussion:
1) GPU types: Currently only tested with amdgpu's mm page filtering, others are not tested.
2) Code structure: There are some similar code shared by makedumpfile and crash, such as maple tree data structure, also I planed to port the btf/kallsyms code to crash as well, so there are code duplications for crash & makedumpfile. Since I havn't working on crash poring, code change on btf/kallsyms is expected. How can we share the code, creating a common library or keep the duplication as it is?
3) OS: The code can work on rhel-10+/rhel9.5+ on x86_64/arm64/s390/ppc64. Others are not tested.D) Testing:
1) If you don't want to create your vmcore, you can find a vmcore which I created with amdgpu mm pages unfiltered [1], the amdgpu mm pages are allocated by program [2]. You can use the vmcore in 1st kernel to filter the amdgpu mm pages by the previous performance testing cmdline. To verify the pages are filtered in crash:
Unfiltered:
crash> search -c "!QAZXSW@#EDC"
ffff96b7fa800000: !QAZXSW@#EDCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ffff96b87c800000: !QAZXSW@#EDCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX crash> rdffff96b7fa800000
ffff96b7fa800000:405753585a415121!QAZXSW@
crash> rdffff96b87c800000
ffff96b87c800000:405753585a415121!QAZXSW@Filtered:
crash> search -c "!QAZXSW@#EDC"
crash> rdffff96b7fa800000
rd: page excluded: kernel virtual address:ffff96b7fa800000type: "64-bit KVADDR" crash> rdffff96b87c800000
rd: page excluded: kernel virtual address:ffff96b87c800000type: "64-bit KVADDR"2) You can use
eppic_scripts/print_all_vma.cagainst an ordinary vmcore to test only btf/kallsyms functions by output all VMAs if no amdgpu vmcores/machine avaliable.[1]: https://people.redhat.com/~ltao/core/
[2]: https://gist.github.com/liutgnu/a8cbce1c666452f1530e1410d1f352dfTao Liu (10):
dwarf_info: Support kernel address randomization
dwarf_info: Fix a infinite recursion bug forsearch_domainAdd page filtering function
Add btf/kallsyms support for symbol type/address resolving Export necessary btf/kallsyms functions to eppic extension Port the maple tree data structures and functions Supportingmain()as the entry of eppic script
Enable page filtering for dwarf eppic
Enable page filtering for btf/kallsyms eppic Introducing 2 eppic scripts to test the dwarf/btf eppic extensionMakefile | 6 +- btf.c | 919 +++++++++++++++++++++++++ btf.h | 176 +++++ dwarf_info.c | 15 +- eppic_maple.c | 431 ++++++++++++ eppic_maple.h | 8 + eppic_scripts/filter_amdgpu_mm_pages.c | 36 + eppic_scripts/print_all_vma.c | 29 + erase_info.c | 123 +++- erase_info.h | 22 + extension_btf.c | 218 ++++++ extension_eppic.c | 41 +- extension_eppic.h | 6 +- kallsyms.c | 371 ++++++++++ kallsyms.h | 42 ++ makedumpfile.c | 21 +- makedumpfile.h | 11 + 17 files changed, 2448 insertions(+), 27 deletions(-)create mode 100644
btf.c
create mode 100644btf.h
create mode 100644eppic_maple.c
create mode 100644eppic_maple.h
create mode 100644eppic_scripts/filter_amdgpu_mm_pages.ccreate mode 100644eppic_scripts/print_all_vma.ccreate mode 100644extension_btf.c
create mode 100644kallsyms.c
create mode 100644kallsyms.h--
2.47.0