[Crash-utility] Adding a new command rbtree

qiaonuohan qiaonuohan at cn.fujitsu.com
Tue May 22 02:36:01 UTC 2012


At 2012-5-22 4:21, Dave Anderson wrote:
>
>
> ----- Original Message -----
>> The patch has been modified.
>
> Whereas the radix_tree problem I showed in my last email seems to
> be RHEL5-related, I cannot dump a red-black tree from an rb_root on
> RHEL5, RHEL6 or Fedora.

I didn't explain the address clearly.

<cut>
The meaning of the "start" argument, which can be expressed either
symbolically or in hexadecimal format, depends upon whether the -N
option is pre-pended or not:
         start  The address of the structure where radix_tree_root(radix
                tree) or rb_node(red-black tree) is embeded.
      -N start  The address of the structure radix_tree_node(radix tree)
                or rb_node(red-black tree)
<cut>

So you can only specified rb_node's related address. The following is
about why the command doesn't support your situation.

In your situation, the offset you offered is the offset of rb_root.

struct rb_root
{
         struct rb_node *rb_node;
};

So I can get the address of root node, then get the address of its
offspring nodes. But now, I cannot convert the address of an
rb_node(offspring node) to its related structure's information. In
details, the rb_node may be embeded in a structure, but the offset of
rb_node is not offered. So the offset should be the offset of rb_node.

>
> For example, taking an mm_struct, it has an "mm_rb" rb_root:
>
>    crash>  mm_struct.mm_rb
>    struct mm_struct {
>        [0x8] struct rb_root mm_rb;
>    }
>
> Therefore I should be able to dump it with:
>
>    crash>  tree -t rb -o mm_struct.mm_rb<mm-struct-address>
>
> I get the mm_struct address like so:
>
>    crash>  vm
>    PID: 20739  TASK: ffff8100190330c0  CPU: 3   COMMAND: "crash"
>           MM               PGD          RSS    TOTAL_VM
>    ffff81003ceaeb00  ffff810023f9f000  111452k  190736k
>    ...
>
> But it always fails like this on RHEL5:
>
>    crash>  tree -t rb -o mm_struct.mm_rb ffff81003ceaeb00
>    ffff81003ceaeb08
>    ffffffff8006fe65
>    6508ec8348f38948
>    tree: invalid kernel virtual address: 6508ec8348f38958  type: "rb_node rb_left"
>    crash>
>
> The same thing happens on RHEL6:
>
>    crash>  vm
>    PID: 14353  TASK: ffff88003a93c080  CPU: 3   COMMAND: "crash"
>           MM               PGD          RSS    TOTAL_VM
>    ffff880037b65840  ffff88001c31b000  153552k  288936k
>    ...
>
>    crash>  tree -t rb -o mm_struct.mm_rb ffff880037b65840
>    ffff880037b65848
>    ffffffff81010800
>    f075894ce86d894c
>    tree: invalid kernel virtual address: f075894ce86d895c  type: "rb_node rb_left"
>    crash>
>
> And on a Fedora 3.3.1-3.fc16 kernel:
>
>    crash>  vm
>    PID: 1175   TASK: ffff88003acb9730  CPU: 2   COMMAND: "crash"
>           MM               PGD          RSS    TOTAL_VM
>    ffff880038495c00  ffff88003ac5a000  181580k  335436k
>    ...
>
>    crash>  tree -t rb -o mm_struct.mm_rb ffff880038495c00
>    ffff880038495c08
>    ffffffff81018ce0
>    f075894ce86d894c
>    tree: invalid kernel virtual address: f075894ce86d895c  type: "rb_node rb_left"
>    crash>
>
> What's going on there?
>
> Dave
>
>
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
>
>


-- 
--
Regards
Qiao Nuohan






More information about the Crash-utility mailing list