Re: [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]

 



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?

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@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());
--
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