Hi Kazu,
On Tue, Sep 6, 2022 at 1:32 PM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab(a)nec.com> wrote:
On 2022/09/05 16:09, Tao Liu wrote:
> 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.
If we do this, it would be better to support a kernel without
CONFIG_VMAP_STACK, too. Any reason not to support?
I will support it in the v4 patch. Sorry for the late reply, I was
busy working on the maple tree support for crash, which is in a final
stage and code refactoring/testing. Maybe it will take a few days
before I work on the v4.
Thanks,
Tao Liu
crash> sys
KERNEL: vmlinux-3.10.0-957.el7.x86_64
...
crash> kmem ffff88007cfdbf80
PID: 1
COMMAND: "systemd"
TASK: ffff88007cfd0000 [THREAD_INFO: ffff88007cfd8000]
CPU: 0
STATE: TASK_INTERRUPTIBLE
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea0001f3f6c0 7cfdb000 0 0 0 1fffff00000000
crash> kmem 7cfdbf80
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea0001f3f6c0 7cfdb000 0 0 0 1fffff00000000
Thanks,
Kazu
>
> 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(a)redhat.com>
> ---
> 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());