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(a)redhat.com>
---
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