Skip to content

DLPX-90487 sdb stacks appears to loop resulting in many repeated stack frames#349

Merged
mmaybee merged 1 commit into
developfrom
dlpx/pr/mmaybee/f0c97fd9-0213-4936-8639-3385c72f36e4
Jan 15, 2025
Merged

DLPX-90487 sdb stacks appears to loop resulting in many repeated stack frames#349
mmaybee merged 1 commit into
developfrom
dlpx/pr/mmaybee/f0c97fd9-0213-4936-8639-3385c72f36e4

Conversation

@mmaybee
Copy link
Copy Markdown
Contributor

@mmaybee mmaybee commented Jan 14, 2025

Problem

Often, when using the stacks command, the stack listing will be very long
(1024 lines) with most of the stack being 0x0+0x0 or some other "cruft":

0xffff9debf71ecc80 INTERRUPTIBLE       493
                  __schedule+0x2c8
                  __schedule+0x2c8
                  schedule+0x69
                  schedule_timeout+0x18f
                  svc_recv+0x45e
                  svc_recv+0x45e
                  nfsd+0xdb
                  kthread+0x127
                  ret_from_fork+0x1f
                  0x0+0x0
                  0x0+0x0
                  0x0+0x0
                  0x0+0x0
                  0x0+0x0
                  0x0+0x0
                  0x0+0x0
                  ...

Evaluation

The issue does not appear to be in the stack trace output code, but rather
in the drgn code that generates the array of stack task pointers. Sometimes
this array appears to be non-terminated and instead has the max length
(of 1024) with “cruft” (usually zeros) padding out the end after the stack.

Solution

The stack printing algorithm has been modified to ignore task frames that
have a program counter value of 0x0. The algorithm will also aggregate
adjacent frames where the program counter and offset are the same:

0xffff9debf71ecc80 INTERRUPTIBLE       493
                  __schedule+0x2c8 (2)
                  schedule+0x69
                  schedule_timeout+0x18f
                  svc_recv+0x45e (2)
                  nfsd+0xdb
                  kthread+0x127
                  ret_from_fork+0x1f

Testing Done

Verified that the stack prints as expected on a system where the old
algorithm printed long stacks.

@mmaybee mmaybee force-pushed the dlpx/pr/mmaybee/f0c97fd9-0213-4936-8639-3385c72f36e4 branch from d6c8909 to 513d273 Compare January 14, 2025 19:25
@mmaybee mmaybee marked this pull request as ready for review January 14, 2025 19:34
Copy link
Copy Markdown

@tonynguien tonynguien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me.

@mmaybee mmaybee merged commit aaf6d3b into develop Jan 15, 2025
@mmaybee mmaybee deleted the dlpx/pr/mmaybee/f0c97fd9-0213-4936-8639-3385c72f36e4 branch January 15, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants