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

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Tue Sep 20 06:52:22 UTC 2022


On 2022/09/19 23:29, Tao Liu wrote:
> Hi Lianbo,
> 
> On Mon, Sep 19, 2022 at 9:32 PM lijiang <lijiang at redhat.com> wrote:
>>
>> Hi, Tao
>> Thank you for the update.
>>
>> On Mon, Sep 19, 2022 at 8:00 PM <crash-utility-request at redhat.com> wrote:
>>>
>>> Date: Mon, 19 Sep 2022 17:49:24 +0800
>>> From: Tao Liu <ltao at redhat.com>
>>> To: crash-utility at redhat.com
>>> Subject: [Crash-utility] [PATCH v4 4/4] Let kmem print task context
>>>          with physical address
>>> Message-ID: <20220919094924.17078-5-ltao at redhat.com>
>>> 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 at 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)) &&
>>
>>                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> 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 for the update.  It did not make much sense to me that the 4/4
patch was apart from the 3/4, so combined them with the minor change
above and applied the series.

https://github.com/crash-utility/crash/commit/3b5e3e1583a1f596360c04e8a322e30cf88f27ab

Thanks!
Kazu



More information about the Crash-utility mailing list