[PATCH v4 4/4] Let kmem print task context with physical address

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

 



With patch [1], kmem <phyaddr> will print task context when
CONFIG_VMAP_STACK enabled. However when CONFIG_VMAP_STACK disabled,
kmem <phyaddr> will never print task context, so the behaviour is
inconsistent.

This patch addresses the issue, to let kmem <phyaddr> can output
task context when CONFIG_VMAP_STACK disabled.

Before:
    crash> kmem 16663edfda0
	  PAGE          PHYSICAL      MAPPING       INDEX CNT FLAGS
    ffffee33998fb7c0 16663edf000                0        0  0 6fffff00000000

After:
    crash> kmem 16663edfda0
	PID: 19007
    COMMAND: "bash"
       TASK: ffff8bb405d320e0  [THREAD_INFO: ffff8bb463edc000]
	CPU: 59
      STATE: TASK_RUNNING (SYSRQ)

	  PAGE          PHYSICAL      MAPPING       INDEX CNT FLAGS
    ffffee33998fb7c0 16663edf000                0        0  0 6fffff00000000

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

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

diff --git a/memory.c b/memory.c
index eac8262..d0daa58 100644
--- a/memory.c
+++ b/memory.c
@@ -13566,11 +13566,13 @@ kmem_search(struct meminfo *mi)
 	/*
 	 *  Check whether it's a current task or stack address.
 	 */
-	if ((mi->memtype == KVADDR) && (task = vaddr_in_task_struct(vaddr)) &&
+	if (((mi->memtype == KVADDR) || (mi->memtype == PHYSADDR)) &&
+	    (task = vaddr_in_task_struct(vaddr)) &&
 	    (tc = task_to_context(task))) {
 		show_context(tc);
 		fprintf(fp, "\n");
-	} else if ((mi->memtype == KVADDR) && (task = stkptr_to_task(vaddr)) &&
+	} else if (((mi->memtype == KVADDR) || (mi->memtype == PHYSADDR)) &&
+	    (task = stkptr_to_task(vaddr)) &&
 	    (tc = task_to_context(task))) {
 		show_context(tc);
 		fprintf(fp, "\n");
-- 
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