From 4249b02f5c4c8a14faa0b88479b8eac75b212617 Mon Sep 17 00:00:00 2001 From: Ann Koehler Date: Thu, 20 Jun 2019 13:25:02 -0500 Subject: [PATCH] LU-12461 contrib: Add epython scripts for crash dump analysis This mod creates a new subdirectory, debug_tools/epython_scripts, in ./contrib to contain PyKdump scripts. These scripts written in an extended version of Python aid in memory dump analysis by extracting and formatting the content of Lustre data structures. The scripts are written using Python 2.7 and tested on Lustre 2.11 client dumps. Test-Parameters: trivial Cray-bug-id: LUS-7501 Signed-off-by: Ann Koehler Change-Id: I0a15eb9025fb604742f4ae99508a080ce04163dc Reviewed-on: https://review.whamcloud.com/35282 Reviewed-by: Andrew Perepechko Reviewed-by: Shaun Tancheff Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- contrib/debug_tools/epython_scripts/README | 37 +++ contrib/debug_tools/epython_scripts/cfs_hashes.py | 160 ++++++++++ contrib/debug_tools/epython_scripts/cfs_hnodes.py | 73 +++++ .../epython_scripts/crashlib/addrlib.py | 22 ++ .../epython_scripts/crashlib/cid/__init__.py | 19 ++ .../epython_scripts/crashlib/cid/kernel_table.py | 80 +++++ .../epython_scripts/crashlib/cid/machdep_table.py | 98 ++++++ .../epython_scripts/crashlib/cid/page_flags.py | 61 ++++ .../epython_scripts/crashlib/cid/phys_mem_map.py | 111 +++++++ .../epython_scripts/crashlib/cid/vm_table.py | 73 +++++ .../epython_scripts/crashlib/input/__init__.py | 241 ++++++++++++++ .../epython_scripts/crashlib/input/argparse_ext.py | 231 ++++++++++++++ .../epython_scripts/crashlib/input/enumtools.py | 211 ++++++++++++ .../epython_scripts/crashlib/input/flagtools.py | 355 +++++++++++++++++++++ .../epython_scripts/crashlib/input/uflookup.py | 127 ++++++++ .../debug_tools/epython_scripts/crashlib/page.py | 127 ++++++++ .../debug_tools/epython_scripts/crashlib/time.py | 42 +++ .../debug_tools/epython_scripts/crashlib/util.py | 210 ++++++++++++ contrib/debug_tools/epython_scripts/debug_flags.py | 72 +++++ contrib/debug_tools/epython_scripts/dk.py | 107 +++++++ .../debug_tools/epython_scripts/jiffies2date.py | 37 +++ .../debug_tools/epython_scripts/ldlm_dumplocks.py | 157 +++++++++ .../debug_tools/epython_scripts/ldlm_lockflags.py | 83 +++++ contrib/debug_tools/epython_scripts/lu_object.py | 211 ++++++++++++ contrib/debug_tools/epython_scripts/lustrelib.py | 244 ++++++++++++++ contrib/debug_tools/epython_scripts/obd_devs.py | 114 +++++++ contrib/debug_tools/epython_scripts/ptlrpc.py | 308 ++++++++++++++++++ contrib/debug_tools/epython_scripts/rpc_opcode.py | 129 ++++++++ contrib/debug_tools/epython_scripts/rpc_stats.py | 126 ++++++++ contrib/debug_tools/epython_scripts/sbi_ptrs.py | 37 +++ .../epython_scripts/uniqueStacktrace.py | 108 +++++++ 31 files changed, 4011 insertions(+) create mode 100644 contrib/debug_tools/epython_scripts/README create mode 100644 contrib/debug_tools/epython_scripts/cfs_hashes.py create mode 100644 contrib/debug_tools/epython_scripts/cfs_hnodes.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/addrlib.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/cid/__init__.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/cid/kernel_table.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/cid/machdep_table.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/cid/page_flags.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/cid/phys_mem_map.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/cid/vm_table.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/input/__init__.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/input/argparse_ext.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/input/enumtools.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/input/flagtools.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/input/uflookup.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/page.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/time.py create mode 100644 contrib/debug_tools/epython_scripts/crashlib/util.py create mode 100644 contrib/debug_tools/epython_scripts/debug_flags.py create mode 100644 contrib/debug_tools/epython_scripts/dk.py create mode 100644 contrib/debug_tools/epython_scripts/jiffies2date.py create mode 100644 contrib/debug_tools/epython_scripts/ldlm_dumplocks.py create mode 100644 contrib/debug_tools/epython_scripts/ldlm_lockflags.py create mode 100644 contrib/debug_tools/epython_scripts/lu_object.py create mode 100644 contrib/debug_tools/epython_scripts/lustrelib.py create mode 100644 contrib/debug_tools/epython_scripts/obd_devs.py create mode 100644 contrib/debug_tools/epython_scripts/ptlrpc.py create mode 100644 contrib/debug_tools/epython_scripts/rpc_opcode.py create mode 100644 contrib/debug_tools/epython_scripts/rpc_stats.py create mode 100644 contrib/debug_tools/epython_scripts/sbi_ptrs.py create mode 100644 contrib/debug_tools/epython_scripts/uniqueStacktrace.py diff --git a/contrib/debug_tools/epython_scripts/README b/contrib/debug_tools/epython_scripts/README new file mode 100644 index 0000000..d33af91 --- /dev/null +++ b/contrib/debug_tools/epython_scripts/README @@ -0,0 +1,37 @@ +These epython scripts extract the content of various Lustre data +structures from crash dumps and formats the output for readability. +They are written for use with PyKdump, a framework for using Python +as an extension language for the crash tool. + +Documentation and source for PyKdump are available at: + https://sourceforge.net/p/pykdump/wiki/Home/ + +These scripts are written in Python2. The above wiki page has instructions +for converting to Python3. The language extensions are documented in: + https://sourceforge.net/p/pykdump/code/ci/master/tree/docs/pykdump.lyx + +The scripts were tested with Lustre 2.11, primarily with dumps of client +nodes. The scripts will work with server dumps as long as the data +structures match the ones used on clients. + +Summary of scripts: + * cfs_hashes.py Displays summary of cfs_hash tables. + * cfs_hnodes.py Displays the specified Lustre hash table. + * debug_flags.py Prints Lustre libcfs_debug flags as strings. + * dk.py Dumps and sorts the Lustre dk logs. + * jiffies2date.py Prints the date and time of a given jiffies timestamp. + * ldlm_dumplocks.py Lists granted and waiting locks by namespace/resource. + * ldlm_lockflags.py Prints string identifiers for specified LDLM flags. + * lu_object.py Prints contents of an lu_object. + * lustre_opcode.py Maps Lustre rpc opcodes to string identifiers. + * obd_devs.py Displays the contents of global 'obd_devs'. + * ptlrpc.py Displays the RPC queues of the Lustre ptlrpcd daemons. + * rpc_stats.py Dumps the client_obd structure given by client argument. + * sbi_ptrs.py Prints Lustre structs associated with inode. + * uniqueStacktrace.py Prints stack traces for each task. + +The scripts require symbols from the Lustre and LNet modules to be loaded +(mod command in crash). A script is invoked with the command +"epython