[Crash-utility] [PATCH v2 3/6] Add tree cmd support for maple tree

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Mon Nov 7 07:51:47 UTC 2022


On 2022/10/25 21:38, Tao Liu wrote:
> Maple tree is a new data structure for crash, so cmd_tree support is
> needed for users to dump and view the content of maple tree. This patch
> achieves this by porting mt_dump() and its related functions from kernel,
> and adapting them with tree cmd.

ah.. so the v2 patch set has almost two function sets to walk a
maple tree, starting from vma_next() (i.e. mas_find()) and
do_maple_tree_traverse(), right?

My concern is that maybe we get different results between them.
It will be better to use do_maple_tree(GATHER or DUMP_CB) for vma
iteration, but it may be hard to emulate mas_find() well..
What do you think?

> 
> We introduced a new -v arg specifically for dumping the complete
> content of maple tree:
> 
>      crash> tree -t maple 0xffff9034c006aec0 -v
> 
>      maple_tree(ffff9034c006aec0) flags 309, height 0 root 0xffff9034de70041e
> 
>      0-18446744073709551615: node 0xffff9034de700400 depth 0 type 3 parent 0xffff9034c006aec1 contents:...
>        0-140112331583487: node 0xffff9034c01e8800 depth 1 type 1 parent 0xffff9034de700406 contents:...
> 	0-94643156942847: (nil)
> 	94643156942848-94643158024191: 0xffff9035131754c0
> 	94643158024192-94643160117247: (nil)
> 	...

Please add warnings about exclusive options, e.g.

crash> tree -t xarray -v ...
tree: -v option is not applicable to Xarrays

crash> tree -t maple -l ...
tree: -l option is not applicable to Maple trees

It may be better to have a tree type string.

   else if (STRNEQ(optarg, "m")) {
       type_flag = MAPLE_REQUEST;
       type_name = "Maple trees";
   }

Also there is need to support CRASHDEBUG(1) in cmd_tree().

crash> set debug 1
debug: 1
crash> tree -t maple 0xffff8bb804d54840 -v | head
              flags: 200 ()               <<--
               type: red-black (default)  <<--
       node pointer: no
              start: ffff8bb804d54840
node_member_offset: 0
    structname_args: 0
              count: 0
maple_tree(ffff8bb804d54840) flags 30D, height 0 root 0xffff8bb803a19d1e
...

Thanks,
Kazu


More information about the Crash-utility mailing list