[PATCH makedumpfile v2 0/9] Improvements to makedumpfile extensions, plus userspace stack tracing extension

Tao Liu ltao at redhat.com
Mon Aug 24 16:07:31 PDT 2026


Hi Stephen,

I have tested the patchset upon my filtering extension, working good!
And I agree with your current PG_INCLUDE_HEAD design, let's go with
this.

Reviewed-by: Tao Liu <ltao at redhat.com>

Thanks,
Tao Liu

On Fri, Aug 21, 2026 at 11:31 AM Stephen Brennan
<stephen.s.brennan at oracle.com> wrote:
>
> Hello all,
>
> This is v2 of my series of improvements for makedumpfile extensions.
> v1 can be found here: https://lore.kernel.org/kexec/20260714004550.3698175-1-stephen.s.brennan@oracle.com/
>
> There have only been a few changes from v1:
> - Updated extension/sample.c to use the new API in patch 3.
> - Reordered and reworded the extension retained pages statistic per Tao's
>   suggestion, so that it is more clear.
> - Included a more complete commit message in patch 7.
> - In patch 1, removed the "nr_pages = 1" when extensions return PG_EXCLUDE.
> - Significantly reworded patch 1's commit message to explain the different cases
>   and the alternative approach.
>
> Notable improvements in the "userstack.c" extension are:
> - Leverage "detect_cycle.h" API to apply Brent's algorithm for cycle detection
>   in linked list iteration, to avoid infinite loops while iterating tasks &
>   threads on corrupt vmcores.
> - Set a limit to the number of retained anon_vma entries, to avoid hitting OOM
>   issues in case of a huge vmcore or a bug in the extension.
>
> As discussed on v1, the final two patches containing the extensions are not to
> be merged. I will publish them in a Github repository as soon as I can get it
> arranged with my employer. They are more for demonstration of the API and
> continued sharing until the repository is available.
>
> The major discussion on v1 was on patch 4, dealing with how extensions are
> called, between:
>
> (a) Extensions are called for all base pages, and their decisions may conflict
> with the head page decision.
> (b) Extensions are not called for tail pages, and the head page decision is used
> instead.
>
> As I explained in my last reply, I believe that (b) is still the best way. It is
> less complex than (a). It is also more efficient, because makedumpfile today
> skips processing many excluded tail pages, which adds up for large systems with
> many huge pages. We do not have any extension which requires any policy more
> complex than PG_INCLUDE_HEAD.
>
> - elfheader requires PG_INCLUDE_HEAD
> - userstack only uses PG_INCLUDE. I could imagine potentially wanting to include
>   just the sub-pages of compound pages that are actually used by the stack. But
>   it hasn't been necessary so far.
> - amdgpu buffers may be compound pages but if they are, then the entire page
>   would be excluded.
>
> I do have an implementation of (a) as I showed in the thread. If I'm wrong here,
> I can always fall back to that.
>
> Thank you,
> Stephen
>
>
> Stephen Brennan (9):
>   Do not call extensions for tail pages
>   Honor CFLAGS in extension/Makefile
>   Share page information with extension callbacks
>   Introduce a stat for pages retained by extension
>   Move page checks into makedumpfile.h
>   Simplify arguments for page checks
>   Add PG_INCLUDE_HEAD extension return status
>   Add userstack extension
>   Add elfheader extension
>
>  extension.c             |  10 +-
>  extension.h             |  10 +-
>  extensions/Makefile     |   8 +-
>  extensions/elfheader.c  |  93 +++++++++++
>  extensions/list.h       | 106 ++++++++++++
>  extensions/sample.c     |   2 +-
>  extensions/userstack.c  | 351 ++++++++++++++++++++++++++++++++++++++++
>  extensions/vma_mtree.c  | 140 ++++++++++++++++
>  extensions/vma_mtree.h  |   7 +
>  extensions/vma_rbtree.c |  56 +++++++
>  extensions/vma_rbtree.h |  12 ++
>  makedumpfile.c          | 189 +++++++++-------------
>  makedumpfile.h          |  78 ++++++++-
>  13 files changed, 931 insertions(+), 131 deletions(-)
>  create mode 100644 extensions/elfheader.c
>  create mode 100644 extensions/list.h
>  create mode 100644 extensions/userstack.c
>  create mode 100644 extensions/vma_mtree.c
>  create mode 100644 extensions/vma_mtree.h
>  create mode 100644 extensions/vma_rbtree.c
>  create mode 100644 extensions/vma_rbtree.h
>
> --
> 2.52.0
>




More information about the kexec mailing list