Hi Lianbo, On Mon, Sep 19, 2022 at 9:32 PM lijiang <lijiang@xxxxxxxxxx> wrote: > > Hi, Tao > Thank you for the update. > > On Mon, Sep 19, 2022 at 8:00 PM <crash-utility-request@xxxxxxxxxx> wrote: >> >> Date: Mon, 19 Sep 2022 17:49:24 +0800 >> From: Tao Liu <ltao@xxxxxxxxxx> >> To: crash-utility@xxxxxxxxxx >> Subject: [PATCH v4 4/4] Let kmem print task context >> with physical address >> Message-ID: <20220919094924.17078-5-ltao@xxxxxxxxxx> >> Content-Type: text/plain; charset="US-ASCII"; x-default=true >> >> 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)) && > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > With the following minor changes: > mi->memtype & (KVADDR|PHYSADDR) > Thanks for the code improvement, it looks better! > The v4 looks good to me, so: Ack. > Thanks, Tao Liu > Thanks. > Lianbo > >> >> + (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)) && > > > Ditto. > >> >> + (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