Feature #8948
closedlibtopo mdb module needs generic topo_list_t walker
100%
Description
The libtopo mdb module has a few specialized walkers for walking a specific topo_list. For example, the "topo_pgroup" walker will walk the tn_pgroups list, when given the pointer to a tnode_t. However, there is no generic walker that can walk any structure with an embedded topo_list_t. The code to add one is simple and it would be much more generally useful than the existing special-case walkers.
I integrated the change described above into illumos-joyent awhile ago via the changeset below:
commit 9cf847e445877b89dda2e814af5af495ec083417 Author: Rob Johnston <rob.johnston@joyent.com> Date: Tue Nov 21 21:52:46 2017 +0000 OS-6466 libtopo mdb module needs generic topo_list_t walker Reviewed by: Robert Mustacchi <robert.mustacchi@joyent.com> Approved by: Robert Mustacchi <robert.mustacchi@joyent.com>
For more information see the corresponding smartos bug:
https://smartos.org/bugview/OS-6466
Updated by Rob Johnston over 5 years ago
Manual testing details:
Invoke mdb with the -L option to force it to load mdb plugins from my illumos-gate repo.
# mdb -L ~rejohnst/ws/illumos-upstream1/proto/root_i386/usr/lib/mdb/proc /usr/lib/fm/fmd/fmtopo >
Verify that the new topo_list walker exits:
> ::bp walk_topo > ::run mdb: stop at walk_topo mdb: target stopped at: walk_topo: pushl %ebp mdb: You've got symbols! Loading modules: [ ld.so.1 libc.so.1 libtopo.so.1 libumem.so.1 libnvpair.so.1 libuutil.so.1 libavl.so.1 libcmdutils.so.1 libsysevent.so.1 ] > ::walkers ! grep topo_list topo_list - walk a topo_list_t linked list
Find a tnode_t with some non-empty topo_list_t structs and dump them with the topo_list walker::
> 900bf40::fmtopo -v ! grep tnode_t | tail -3 tnode_t: 91bb438 tnode_t: 91bb678 tnode_t: 91bb2b8 > 91bb438::print -at tnode_t ! grep topo_list 91bb470 topo_list_t tn_children = { 91bb470 struct topo_list *l_prev = 0x91cf800 91bb474 struct topo_list *l_next = 0x91cf820 91bb478 topo_list_t tn_pgroups = { 91bb478 struct topo_list *l_prev = 0x91d7c78 91bb47c struct topo_list *l_next = 0x91d7df8 91bb480 topo_list_t tn_methods = { 91bb480 struct topo_list *l_prev = 0x91d6ca8 91bb484 struct topo_list *l_next = 0x91d6cf8 > 91bb478::walk topo_list | ::print topo_pgroup_t tpg_info | ::print -t topo_ipgroup_info_t topo_ipgroup_info_t { char *tpi_name = 0x91d4c80 "protocol" topo_stability_t tpi_namestab = 2 (TOPO_STABILITY_PRIVATE) topo_stability_t tpi_datastab = 2 (TOPO_STABILITY_PRIVATE) topo_version_t tpi_version = 0x1 } topo_ipgroup_info_t { char *tpi_name = 0x91d4c40 "authority" topo_stability_t tpi_namestab = 2 (TOPO_STABILITY_PRIVATE) topo_stability_t tpi_datastab = 2 (TOPO_STABILITY_PRIVATE) topo_version_t tpi_version = 0x1 } topo_ipgroup_info_t { char *tpi_name = 0x91bfce8 "io" topo_stability_t tpi_namestab = 2 (TOPO_STABILITY_PRIVATE) topo_stability_t tpi_datastab = 2 (TOPO_STABILITY_PRIVATE) topo_version_t tpi_version = 0x1 } topo_ipgroup_info_t { char *tpi_name = 0x91bfcd8 "pci" topo_stability_t tpi_namestab = 2 (TOPO_STABILITY_PRIVATE) topo_stability_t tpi_datastab = 2 (TOPO_STABILITY_PRIVATE) topo_version_t tpi_version = 0x1 } > 91bb480::walk topo_list | ::print topo_imethod_t tim_name tim_name = 0x91d4c00 "topo_label" tim_name = 0x91d7dc8 "topo_fru_compute"
Try walking an empty list:
> 906e368::print -at tnode_t tn_children 906e3a0 topo_list_t tn_children = { 906e3a0 struct topo_list *tn_children.l_prev = 0 906e3a4 struct topo_list *tn_children.l_next = 0 } > 906e3a0::walk topo_list >
Try passing something that is not a topo_list to the walker:
> 906e398::walk topo_list 0x9011d28 mdb: failed to read topo_list_t at 4d580000: no mapping for address
Updated by Electric Monk over 5 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
git commit 1bd05387d9f0afecec802c6a33ffb181d4c6d93f
commit 1bd05387d9f0afecec802c6a33ffb181d4c6d93f Author: Rob Johnston <rob.johnston@joyent.com> Date: 2018-01-10T18:19:02.000Z 8948 libtopo mdb module needs generic topo_list_t walker Reviewed by: David Höppner <0xffea@gmail.com> Approved by: Richard Lowe <richlowe@richlowe.net>