[PATCH v3 3/3] Let kmem print task context when physical address is vmalloced stack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patch [1] enables kmem to print task context if the given virtual
address is a vmalloced stack.

This patch handles the same issue except the given address is
physical address.

Before:
    crash> kmem 1883700e28
       VMAP_AREA         VM_STRUCT                 ADDRESS RANGE                SIZE
    ffff94eb9102c640  ffff94eb9102b140  ffffb7efce9b8000 - ffffb7efce9bd000    20480

	  PAGE         PHYSICAL      MAPPING       INDEX CNT FLAGS
    ffffdd28220dc000 1883700000                0        0  1 50000000000000

After:
    crash> kmem 1883700e28
	PID: 847
    COMMAND: "khungtaskd"
       TASK: ffff94f8038f4000  [THREAD_INFO: ffff94f8038f4000]
	CPU: 72
      STATE: TASK_RUNNING (PANIC)

       VMAP_AREA         VM_STRUCT                 ADDRESS RANGE                SIZE
    ffff94eb9102c640  ffff94eb9102b140  ffffb7efce9b8000 - ffffb7efce9bd000    20480

	  PAGE         PHYSICAL      MAPPING       INDEX CNT FLAGS
    ffffdd28220dc000 1883700000                0        0  1 50000000000000

[1]: https://listman.redhat.com/archives/crash-utility/2022-August/010074.html

Signed-off-by: Tao Liu <ltao@xxxxxxxxxx>
---
 memory.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/memory.c b/memory.c
index 1b6f9ba..eac8262 100644
--- a/memory.c
+++ b/memory.c
@@ -13506,6 +13506,10 @@ kmem_search(struct meminfo *mi)
 		mi->flags &= ~GET_PHYS_TO_VMALLOC;
 
 		if (mi->retval) {
+			if ((task = stkptr_to_task(mi->retval)) && (tc = task_to_context(task))) {
+				show_context(tc);
+				fprintf(fp, "\n");
+			}
 			if ((sp = value_search(mi->retval, &offset))) {
                         	show_symbol(sp, offset, 
 					SHOW_LINENUM | SHOW_RADIX());
-- 
2.33.1

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux