FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Crash Utility

 
 
LinkBack Thread Tools
 
Old 05-29-2012, 04:24 PM
Dave Anderson
 
Default Adding a new command rbtree

----- Original Message -----
> At 2012-5-25 3:12, Dave Anderson wrote:
> > But again, the red-black tree dump should be similar to the radix tree
> > dump, and both of them should be similar to the "list" command.
> Fixed. I misunderstood the address printed by list command. I thought I
> need to print the address of tree node.

You have fixed the red-black tree issue, but now it seems that the
radix tree dump no longer works.

As a verification of a red-black tree list, let's again take the list
of vm_area_structs that in a red-black list rooted at each mm_struct:

crash> vm | head -3
PID: 16041 TASK: ffff8100100187a0 CPU: 1 COMMAND: "crash"
MM PGD RSS TOTAL_VM
ffff810039735ac0 ffff810001d8a000 111400k 190424k
crash>

So the mm_struct address is ffff810039735ac0, its rb_root is
at offset "-r mm_struct.mm_rb", and each rb_node in the list
can be found at the offset "-o vm_area_struct.vm_rb". To
verify, the "-s vm_area_struct.vm_mm" of each entry should
point back to the mm_struct:

crash> tree -t rb -r mm_struct.mm_rb -o vm_area_struct.vm_rb ffff810039735ac0 -s vm_area_struct.vm_mm
ffff810039eedef8
vm_mm = 0xffff810039735ac0
ffff810024e06978
vm_mm = 0xffff810039735ac0
ffff8100065b61e8
vm_mm = 0xffff810039735ac0
ffff810005322e48
vm_mm = 0xffff810039735ac0
ffff81000468b818
vm_mm = 0xffff810039735ac0
ffff810025041d98
vm_mm = 0xffff810039735ac0
...


But in fixing red-black tree list, it seems that you have
broken radix tree lists, which worked OK in the previous patch.
The address_space.page_tree example that you use in the help page,
and that I used in my last email, now fails. For example, take an
address_space structure address of ffff81000d1edb88:

crash> vtop 400000 | tail -2
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffff8100009c4af8 d1e9000 ffff81000d1edb88 0 3 8080000000868
crash>

Here is the radix_tree_root, and the topmost radix_tree_node:

crash> address_space.page_tree ffff81000d1edb88
page_tree = {
height = 0x3,
gfp_mask = 0x220,
rnode = 0xffff81002ac43090
}
crash> kmem -s 0xffff81002ac43090
CACHE NAME OBJSIZE ALLOCATED TOTAL SLABS SSIZE
ffff810037c8a200 radix_tree_node 536 3182 6405 915 4k
SLAB MEMORY TOTAL ALLOCATED FREE
ffff81002ac43040 ffff81002ac43090 7 4 3
FREE / [ALLOCATED]
[ffff81002ac43090]
crash>

It should dump its list of entries with the following command, but
which fails like so:

crash> tree -t radix -r address_space.page_tree ffff81000d1edb88
radix_tree_node at ffff81002ac43090
struct radix_tree_node {
count = 0x2,
slots = {0xffff8100197e8930, 0xffff810033bf9698, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x
0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
tags = {{0x0}, {0x0}}
}
tree: height 530 is greater than height_to_maxindex[] index 12
crash>

Dave

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 05-29-2012, 06:57 PM
Dave Anderson
 
Default Adding a new command rbtree

----- Original Message -----
>
>
> ----- Original Message -----
> > At 2012-5-25 3:12, Dave Anderson wrote:
> > > But again, the red-black tree dump should be similar to the radix tree
> > > dump, and both of them should be similar to the "list" command.
> > Fixed. I misunderstood the address printed by list command. I thought I
> > need to print the address of tree node.
>
> You have fixed the red-black tree issue, but now it seems that the
> radix tree dump no longer works.

As it turns out, the radix tree problem I reported seems to be an issue
associated with the kernel version.

With your latest patch, radix tree dumps do work OK on RHEL6 (and later)
kernels. For example:

crash> sys | grep RELEASE
RELEASE: 2.6.32-156.el6.x86_64
crash> vtop 400000 | tail -2
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea00040d12c0 1284e8000 ffff88012d364de0 0 7 4000000002006c
crash> address_space.page_tree ffff88012d364de0
page_tree = {
height = 2,
gfp_mask = 32,
rnode = 0xffff8801238add71
}
crash> tree -t radix -r address_space.page_tree ffff88012d364de0
ffffea00040d12c0
ffffea00040d9a60
ffffea00040d9b08
ffffea000407eda8
ffffea0004084288
ffffea00040843a0
ffffea000407d6e8
ffffea0004080a50
ffffea0004084250
ffffea0004084170
ffffea00040dba50
ffffea00040b4b18
...

crash> kmem -p ffffea00040dba50 ffffea00040b4b18
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea00040dba50 1287e6000 ffff88012d364de0 a 7 4000000002006c
ffffea00040b4b18 127cc5000 ffff88012d364de0 b 1 40000000020028
crash>

But when I try the same thing on a RHEL5 kernel, it always fails like this:

crash> sys | grep RELEASE
RELEASE: 2.6.18-146.el5
crash> vtop 400000 | tail -2
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffff810103c06490 11265e000 ffff81012eab2e00 0 3 11010000001020c
crash> address_space.page_tree ffff81012eab2e00
page_tree = {
height = 1,
gfp_mask = 544,
rnode = 0xffff81011f9932e8
}
crash> tree -t radix -r address_space.page_tree ffff81012eab2e00
radix_tree_node at ffff81011f9932e8
struct radix_tree_node {
count = 0x6,
slots = {0xffff810103c06490, 0xffff810103c1c760, 0xffff810103c58580, 0xffff810103bfb750, 0xffff810103e84cd8, 0xffff810103bf8b5
8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
tags = {{0x0}, {0x0}}
}
tree: height 1536 is greater than height_to_maxindex[] index 12
crash>

Dave

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 05-29-2012, 07:56 PM
Dave Anderson
 
Default Adding a new command rbtree

----- Original Message -----
>
>
> ----- Original Message -----

> As it turns out, the radix tree problem I reported seems to be an issue
> associated with the kernel version.

> But when I try the same thing on a RHEL5 kernel, it always fails like
> this:
>
> crash> tree -t radix -r address_space.page_tree ffff81012eab2e00
> radix_tree_node at ffff81011f9932e8
> struct radix_tree_node {
> count = 0x6,
> slots = {0xffff810103c06490, 0xffff810103c1c760,
> 0xffff810103c58580, 0xffff810103bfb750, 0xffff810103e84cd8,
> 0xffff810103bf8b5
> 8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
> 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
> 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
> 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
> , 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
> tags = {{0x0}, {0x0}}
> }
> tree: height 1536 is greater than height_to_maxindex[]
> index 12
> crash>

The reason that the command fails on RHEL5 is due to this part of
your patch:

3766 void rdtree_iteration(ulong node_p, struct tree_data *td, char * ppos, ulong indexnum)
3767 {
3768 uint height;
3769 ulong slot;
3770 int index;
3771 int i;
3772 char pos[BUFSIZE];
3773
3774 if (indexnum != -1)
3775 sprintf(pos, "%s/%ld", ppos, indexnum);
3776 else
3777 sprintf(pos, "%s", ppos);
3778
3779 readmem(node_p + MEMBER_OFFSET("radix_tree_node", "height"), KVADDR,
3780 &height, sizeof(uint), "radix_tree_node height", FAULT_ON_ERROR);
3781
3782 if (height > ARRAY_LENGTH(height_to_maxindex)) {
3783 fprintf(fp, "radix_tree_node at %lx
", node_p);
3784 dump_struct("radix_tree_node", node_p, RADIX(16));
3785 error(FATAL, "height %d is greater than height_to_maxindex[]
3786 index %ld
", height, ARRAY_LENGTH(height_to_maxindex));
3787 }

In line 3779, you calculate "height" using: MEMBER_OFFSET("radix_tree_node", "height")
which returns -1, because RHEL5's radix_tree_node does not have a "height" member:

crash> radix_tree_node
struct radix_tree_node {
unsigned int count;
void *slots[64];
long unsigned int tags[2][1];
}
SIZE: 536
crash>

In RHEL6, a radix_tree_node structure does have a "height" member:

crash> radix_tree_node
struct radix_tree_node {
unsigned int height;
unsigned int count;
struct rcu_head rcu_head;
void *slots[64];
long unsigned int tags[3][1];
}
SIZE: 560
crash>

In any case, I now see that your patch uses MEMBER_OFFSET(...) in 4 places:

$ grep MEMBER_OFFSET 0001-add-a-new-command-tree.patch
+ readmem(node_p + MEMBER_OFFSET("radix_tree_node", "height"), KVADDR,
+ readmem(td->start + MEMBER_OFFSET("rb_root", "rb_node"), KVADDR,
+ readmem(node_p+MEMBER_OFFSET("rb_node", "rb_left"), KVADDR, &left_p,
+ readmem(node_p+MEMBER_OFFSET("rb_node", "rb_right"), KVADDR, &right_p,
$

which is not acceptable, because it hides these kinds of programming errors.

For each of the 4 structure members above, add them to the offset_table[] array,
initialize them with MEMBER_OFFSET_INIT(), and use OFFSET(...) instead of
MEMBER_OFFSET(). Then if your code is incorrect as above, it will fail
immediately and show a meaningful error message.

Dave



--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 05-30-2012, 03:48 AM
qiaonuohan
 
Default Adding a new command rbtree

Modified. I remain the "-N" option. But for radix tree on RHEL5 or
below, the height does not exist. So "-N" is not supported for radix
tree on these version.


At 2012-5-30 3:56, Dave Anderson wrote:



----- Original Message -----



----- Original Message -----



As it turns out, the radix tree problem I reported seems to be an issue
associated with the kernel version.



But when I try the same thing on a RHEL5 kernel, it always fails like
this:

crash> tree -t radix -r address_space.page_tree ffff81012eab2e00
radix_tree_node at ffff81011f9932e8
struct radix_tree_node {
count = 0x6,
slots = {0xffff810103c06490, 0xffff810103c1c760,
0xffff810103c58580, 0xffff810103bfb750, 0xffff810103e84cd8,
0xffff810103bf8b5
8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
tags = {{0x0}, {0x0}}
}
tree: height 1536 is greater than height_to_maxindex[]
index 12
crash>


The reason that the command fails on RHEL5 is due to this part of
your patch:

3766 void rdtree_iteration(ulong node_p, struct tree_data *td, char * ppos, ulong indexnum)
3767 {
3768 uint height;
3769 ulong slot;
3770 int index;
3771 int i;
3772 char pos[BUFSIZE];
3773
3774 if (indexnum != -1)
3775 sprintf(pos, "%s/%ld", ppos, indexnum);
3776 else
3777 sprintf(pos, "%s", ppos);
3778
3779 readmem(node_p + MEMBER_OFFSET("radix_tree_node", "height"), KVADDR,
3780&height, sizeof(uint), "radix_tree_node height", FAULT_ON_ERROR);
3781
3782 if (height> ARRAY_LENGTH(height_to_maxindex)) {
3783 fprintf(fp, "radix_tree_node at %lx
", node_p);
3784 dump_struct("radix_tree_node", node_p, RADIX(16));
3785 error(FATAL, "height %d is greater than height_to_maxindex[]
3786 index %ld
", height, ARRAY_LENGTH(height_to_maxindex));
3787 }

In line 3779, you calculate "height" using: MEMBER_OFFSET("radix_tree_node", "height")
which returns -1, because RHEL5's radix_tree_node does not have a "height" member:

crash> radix_tree_node
struct radix_tree_node {
unsigned int count;
void *slots[64];
long unsigned int tags[2][1];
}
SIZE: 536
crash>

In RHEL6, a radix_tree_node structure does have a "height" member:

crash> radix_tree_node
struct radix_tree_node {
unsigned int height;
unsigned int count;
struct rcu_head rcu_head;
void *slots[64];
long unsigned int tags[3][1];
}
SIZE: 560
crash>

In any case, I now see that your patch uses MEMBER_OFFSET(...) in 4 places:

$ grep MEMBER_OFFSET 0001-add-a-new-command-tree.patch
+ readmem(node_p + MEMBER_OFFSET("radix_tree_node", "height"), KVADDR,
+ readmem(td->start + MEMBER_OFFSET("rb_root", "rb_node"), KVADDR,
+ readmem(node_p+MEMBER_OFFSET("rb_node", "rb_left"), KVADDR,&left_p,
+ readmem(node_p+MEMBER_OFFSET("rb_node", "rb_right"), KVADDR,&right_p,
$

which is not acceptable, because it hides these kinds of programming errors.

For each of the 4 structure members above, add them to the offset_table[] array,
initialize them with MEMBER_OFFSET_INIT(), and use OFFSET(...) instead of
MEMBER_OFFSET(). Then if your code is incorrect as above, it will fail
immediately and show a meaningful error message.

Dave



--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility





--
--
Regards
Qiao Nuohan


--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 05-30-2012, 02:53 PM
Dave Anderson
 
Default Adding a new command rbtree

----- Original Message -----
> Modified. I remain the "-N" option. But for radix tree on RHEL5 or
> below, the height does not exist. So "-N" is not supported for radix
> tree on these version.

This is getting tiresome...

With this patch, both red-black or radix tree dumps fail
when dumped from their roots, on RHEL5, RHEL6 and Fedora.

Here are the results using the simple examples shown in your help page.

RHEL5 red-black tree:

crash> vm | head -3
PID: 15684 TASK: ffff81001b4c1820 CPU: 6 COMMAND: "crash"
MM PGD RSS TOTAL_VM
ffff81003b5beb00 ffff810014b43000 112352k 195584k
crash> mm_struct.mm_rb ffff81003b5beb00
mm_rb = {
rb_node = 0xffff8100110a1e78
}
crash> tree -t rb -r mm_struct.mm_rb -o vm_area_struct.vm_rb ffff81003b5beb00
tree: "-r offset" is useless when specified "-N"ffff81003b5bead0
ffff810033522738
7fff36916fd0
tree: invalid kernel virtual address: 7fff36917010 type: "rb_node rb_left"
crash>

RHEL5 radix tree:

crash> vtop 400000 | tail -2
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffff810000a58f88 fc47000 ffff81001d391518 0 3 808000000086c
crash> address_space.page_tree ffff81001d391518
page_tree = {
height = 3,
gfp_mask = 544,
rnode = 0xffff81000e2ec540
}
crash> tree -t radix -r address_space.page_tree ffff81001d391518

tree: invalid structure member offset: radix_tree_node_height
FILE: tools.c LINE: 3756 FUNCTION: do_rdtree()

[./crash] error trace: 45a150 => 466d7e => 46571a => 4f8040

4f8040: OFFSET_verify+224
46571a: do_rdtree+570
466d7e: cmd_tree+670
45a150: exec_command+1328

tree: "-r offset" is useless when specified "-N"tree: invalid structure member offset: radix_tree_node_height
FILE: tools.c LINE: 3756 FUNCTION: do_rdtree()

crash>

RHEL6 red-black tree:

crash> vm | head -3
PID: 861 TASK: ffff880037309500 CPU: 0 COMMAND: "crash"
MM PGD RSS TOTAL_VM
ffff880037b4d280 ffff880015877000 154492k 291112k
crash> mm_struct.mm_rb ffff880037b4d280
mm_rb = {
rb_node = 0xffff880004d0ee40
}
crash> tree -t rb -r mm_struct.mm_rb -o vm_area_struct.vm_rb ffff880037b4d280
tree: "-r offset" is useless when specified "-N"ffff880037b4d248
ffff88003a0dd750
7fff2fb5cfc8
tree: invalid kernel virtual address: 7fff2fb5d010 type: "rb_node rb_left"
crash>

RHEL6 radix tree:

crash> vtop 400000 | tail -2
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea000070bde0 20364000 ffff880024da3de0 0 3 2000000000086c
crash> address_space.page_tree ffff880024da3de0
page_tree = {
height = 3,
gfp_mask = 32,
rnode = 0xffff88001da1c911
}
crash> tree -t radix -r address_space.page_tree ffff880024da3de0
tree: "-r offset" is useless when specified "-N"tree: "-N" option is not supported or applicable for radix tree on this architecture or kernel
crash>

Fedora 3.3.1-3.fc16 red-black tree:

crash> vm | head -3
PID: 1175 TASK: ffff88003acb9730 CPU: 2 COMMAND: "crash"
MM PGD RSS TOTAL_VM
ffff880038495c00 ffff88003ac5a000 181580k 335436k
crash> mm_struct.mm_rb ffff880038495c00
mm_rb = {
rb_node = 0xffff880036ae4668
}
crash> tree -t rb -r mm_struct.mm_rb -o vm_area_struct.vm_rb ffff880038495c00
tree: "-r offset" is useless when specified "-N"ffff880038495bc8
ffff880036ae4968
4703fc8
tree: invalid kernel virtual address: 4704010 type: "rb_node rb_left"
crash>

Fedora 3.3.1-3.fc16 radix tree:

crash> vtop 400000 | tail -2
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea0000ad2500 2b494000 ffff88003a209320 0 2 2000000002006c
crash> address_space.page_tree ffff88003a209320
page_tree = {
height = 2,
gfp_mask = 32,
rnode = 0xffff88003dff6e99
}
crash> tree -t radix -r address_space.page_tree ffff88003a209320
tree: "-r offset" is useless when specified "-N"tree: "-N" option is not supported or applicable for radix tree on this architecture or kernel
crash>

Do you even test these patches before posting them?

Dave

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 05-31-2012, 01:59 AM
qiaonuohan
 
Default Adding a new command rbtree

At 2012-5-30 22:53, Dave Anderson wrote:

Do you even test these patches before posting them?


Sorry. I made a patch, and after it was tested, I rework it and forget
to test it again. It's all my fault that made so much trouble to you. I
apologize for it.


--
--
Regards
Qiao Nuohan


--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 05-31-2012, 06:34 PM
Dave Anderson
 
Default Adding a new command rbtree

----- Original Message -----
> At 2012-5-30 22:53, Dave Anderson wrote:
> > Do you even test these patches before posting them?
>
> Sorry. I made a patch, and after it was tested, I rework it and forget
> to test it again. It's all my fault that made so much trouble to you. I
> apologize for it.

No problem...

OK, so here is my current test matrix and results:

(1) tree -t rbtree -r mm_struct.mm_rb -o vm_area_struct.vm_rb <root>

RHEL5: OK
RHEL6: OK
Fedora: OK

(2) tree -t rbtree -o vm_area_struct.vm_rb -N <node>

RHEL5: OK
RHEL6: OK
Fedora: OK

(3) tree -t radix -r address_space.page_tree <root>

RHEL5: OK
RHEL6: OK
Fedora: OK

(4) tree -t radix -N <node>

RHEL5: OK (not supported)
RHEL6: OK (note caveat below)
Fedora: OK (note caveat below)

Caveat: for newer kernels that support -N for radix trees, a user might
run into a situation where the radix_tree_node pointer has the "1-bit"
set, and the node address is just cut-and-pasted. For example:

crash> address_space.page_tree ffff88000990e5e0
page_tree = {
height = 3,
gfp_mask = 32,
rnode = 0xffff880004682281
}
crash> tree -t radix -N 0xffff880004682281
radix_tree_node at ffff880004682281
struct radix_tree_node {
height = 0x2000000,
count = 0xb8000000,
rcu_head = {
next = 0x40ffff8800046824,
func = 0x70ffffffff812700
},
slots = {0x50ffff880017202d, 0xffff88003d60d0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
tags = {{0x0}, {0x0}, {0x100000000000000}}
}
tree: height 33554432 is greater than height_to_maxindex[] index 12
crash>

I forget what the usage of the low-bit means w/respect to
radix_tree_node pointers (?), but you've already got this in
place in your do_rdtree() function:

if (node_p & 1)
node_p &= ~1;

and I remember having to do the same thing in the currently
existing radix_tree_lookup() function.

So I believe that the 1-bit should be stripped off when a user
inadvertently enters such an address as a -N radix_tree_node address.
With this change to cmd_tree():

if (hexadecimal_only(args[optind], 0)) {
value = htol(args[optind], FAULT_ON_ERROR, NULL);
if (IS_KVADDR(value)) {
td->start = value;
+ if ((td->start & 1) &&
+ (td->flags & TREE_NODE_POINTER) &&
+ (type_flag == RADIXTREE_REQUEST))
+ td->start &= ~1;
goto next_arg;
}
}

it works OK regardless of the 1-bit setting:

crash> address_space.page_tree ffff88000990e5e0
page_tree = {
height = 3,
gfp_mask = 32,
rnode = 0xffff880022c1ab41
}
crash> tree -t radix -N 0xffff880022c1ab41
ffffea0000327e28
ffffea00002ee0d8
ffffea00002ee110
...
crash> tree -t radix -N 0xffff880022c1ab40
ffffea0000327e28
ffffea00002ee0d8
ffffea00002ee110
...

I haven't tinkered with the -p option, although I don't think that it's
a particularly important option. I may add a couple more error-handling
additions, and perhaps some slight user interface changes, and the help
page needs to be cleaned-up/clarified. But aside from that, this is
looking pretty good for inclusion in crash-6.0.8.

No further patch posting is required unless you find a new bug or other
problem -- nice job!

Thanks,
Dave


--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 05-31-2012, 07:51 PM
Dave Anderson
 
Default Adding a new command rbtree

----- Original Message -----

> I haven't tinkered with the -p option, although I don't think that it's
> a particularly important option. I may add a couple more error-handling
> additions, and perhaps some slight user interface changes, and the help
> page needs to be cleaned-up/clarified. But aside from that, this is
> looking pretty good for inclusion in crash-6.0.8.
>
> No further patch posting is required unless you find a new bug or other
> problem -- nice job!

And just in case you notice these, no further patch is required -- I've got
them fixed:

1. I removed the TREE_START_ENTERED #define since it's unused.

2. This error message uses the wrong offset value, it should use the local
"root_offset" variable:

case 'r':
if (td->flags & TREE_ROOT_OFFSET_ENTERED)
error(FATAL,
"root offset value %d (0x%lx) already entered
",
td->member_offset, td->member_offset);

3. The rdtree_interation() function did not do an hq_enter() of each slot entry
to check for duplicates.

4. FYI -- whenever you add new entries to the offset_table[] array, please put
them at the end of the array so that extension modules that were built with
an older "defs.h" will still see the same offsets. The new entries can be still
be displayed next to similar members as you've done in dump_offset_table().
(and thanks for remembering to do that -- most people forget or are unaware of
the function).

Thanks,
Dave


Dave

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 

Thread Tools




All times are GMT. The time now is 06:23 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org