[Crash-utility] [RFC] cacheutils crash extension module

Kazuhito Hagio k-hagio at ab.jp.nec.com
Tue May 21 19:50:09 UTC 2019


Hi Dave,

On 5/21/2019 2:58 PM, Dave Anderson wrote:
> 
> Hi Kazu,
> 
> Your patch that exports the get_mount_list() and get_dump_level() functions has
> been queued for crash-7.2.7:
> 
>   https://github.com/crash-utility/crash/commit/3370ae03edf3d815bfffe556ffddc43619420674
> 
> Also, the CRASHDEBUG(0) in do_xarray_dump_cb() was a leftover from when I was debugging
> the initial XArray support patch-set.  As you noted, it should be set to CRASHDEBUG(1):
> 
>   https://github.com/crash-utility/crash/commit/1f6b1ce5678224dd5085020e45259ea8c057e4a1

Thank you for merging and fixing.

> 
> With respect to your extension module, do you want to post an updated version?

Yes. I will post a github link when I finish preparing.

Thanks!
Kazu

> 
> Thanks,
>   Dave
> 
> 
> 
> ----- Original Message -----
>> Hi Dave,
>>
>> I've written "cacheutils" crash extension module that lists dentry caches and
>> dumps page caches associated with a specified file path. I think this module
>> would be helpful for support folks to find and see config/log files in
>> vmcore.
>>
>> For example:
>>   $ make extensions
>>
>>   crash> extend cacheutils.so
>>   ./cacheutils.so: shared object loaded
>>   crash> extend
>>   SHARED OBJECT    COMMANDS
>>   ./cacheutils.so  ccat cls
>>   crash> cls /var/log
>>   DENTRY           INODE            I_MAPPING        NRPAGES   % PATH
>>   ffff9c0c3eabe300 ffff9c0c3e875b78 ffff9c0c3e875ce8       0   0 ./
>>   ffff9c0c16a22900 ffff9c0c16ada2f8 ffff9c0c16ada468       0   0 anaconda/
>>   ffff9c0c37611000 ffff9c0c3759f5b8 ffff9c0c3759f728       0   0 audit/
>>   ffff9c0c375ccc00 ffff9c0c3761c8b8 ffff9c0c3761ca28       1 100 btmp
>>   ffff9c0c28fda240 ffff9c0c22c713f8 ffff9c0c22c71568       6 100 cron
>>   ffff9c0c3eb7f180 ffff9c0bfd402a78 ffff9c0bfd402be8      36   7
>>   dnf.librepo.log
>>   ...
>>   crash> ccat /var/log/messages | tail
>>   Nov 28 16:43:57 fedora systemd[27015]: Reached target Basic System.
>>   Nov 28 16:43:57 fedora systemd[27015]: Reached target Default.
>>   Nov 28 16:43:57 fedora systemd[1]: Started User Manager for UID 0.
>>   Nov 28 16:43:57 fedora systemd[27015]: Startup finished in 61ms.
>>
>> It tested OK from RHEL5 (x86_64) to kernel 5.1, which has XArray,
>> and a recent x86 Fedora.
>>
>>
>> I have three questions (requests) related to this, and I would appreciate it
>> if you would take a look at them after your vacation :)
>>
>> * Is it possible to export the get_mount_list() and get_dump_level()
>> functions
>> to extension modules? (The patch at the end exports these two functions.)
>>
>> Now the get_mount_list() is copied from crash/filesys.c to this module.
>> And I'd like to call the get_dump_level() to inform users whether the "ccat"
>> command is available or not with their vmcore when the module is loaded.
>> If they are exported, I will remove the "#define NOT_EXPORTED" and #ifdef
>> sections in it.
>>
>> * Is the CRASHDEBUG(0) in do_xarray_dump_cb() function on purpose?
>>
>> This module uses the function and it sometimes prints the following messages
>> without crash -d option. The similar message for radix tree is suppressed by
>> CRASHDEBUG(1), but this has CRASHDEBUG(0), so I'm wondering about it.
>>
>>   crash> ccat /var/log/messages
>>   ccat: entry has XARRAY_TAG_MASK bits set: 239ab0024001
>>   ccat: entry has XARRAY_TAG_MASK bits set: 239ae0024001
>>   ccat: entry has XARRAY_TAG_MASK bits set: 239af0024001
>>
>> static void do_xarray_dump_cb(ulong node, ulong slot, const char *path,
>>                                   ulong index, void *private)
>> {
>> ...
>>         if (!cb(slot)) {
>>                 if (slot & XARRAY_TAG_MASK) {
>>                         if (CRASHDEBUG(0))
>>                                 error(INFO, "entry has XARRAY_TAG_MASK bits
>>                                 set: %lx\n", slot);
>>                         return;
>>
>> * Is it possible to add this module to your crash extension modules page?
>> I'm planning to put it on GitHub, so I'd like you to add the link to the
>> page.
>>
>> Thanks,
>> Kazu
>>
>> Signed-off-by: Kazuhito Hagio <k-hagio at ab.jp.nec.com>
>> ---
>>  defs.h     | 2 ++
>>  diskdump.c | 3 +--
>>  filesys.c  | 3 +--
>>  3 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/defs.h b/defs.h
>> index 912037fcc762..42e381e6d9c1 100644
>> --- a/defs.h
>> +++ b/defs.h
>> @@ -5298,6 +5298,7 @@ void set_tmpfile2(FILE *);
>>  void close_tmpfile2(void);
>>  void open_files_dump(ulong, int, struct reference *);
>>  void get_pathname(ulong, char *, int, int, ulong);
>> +ulong *get_mount_list(int *, struct task_context *);
>>  char *vfsmount_devname(ulong, char *, int);
>>  ulong file_to_dentry(ulong);
>>  ulong file_to_vfsmnt(ulong);
>> @@ -6440,6 +6441,7 @@ int diskdump_phys_base(unsigned long *);
>>  int diskdump_set_phys_base(unsigned long);
>>  ulong *diskdump_flags;
>>  int is_partial_diskdump(void);
>> +int get_dump_level(void);
>>  int dumpfile_is_split(void);
>>  void show_split_dumpfiles(void);
>>  void x86_process_elf_notes(void *, unsigned long);
>> diff --git a/diskdump.c b/diskdump.c
>> index 694339fbb713..e88243e616cc 100644
>> --- a/diskdump.c
>> +++ b/diskdump.c
>> @@ -80,7 +80,6 @@ struct diskdump_data {
>>  
>>  static struct diskdump_data diskdump_data = { 0 };
>>  static struct diskdump_data *dd = &diskdump_data;
>> -static int get_dump_level(void);
>>  
>>  ulong *diskdump_flags = &diskdump_data.flags;
>>  
>> @@ -2114,7 +2113,7 @@ get_diskdump_switch_stack(ulong task)
>>   *  Version 1 and later compressed kdump dumpfiles contain the dump level
>>   *  in an additional field of the sub_header_kdump structure.
>>   */
>> -static int
>> +int
>>  get_dump_level(void)
>>  {
>>  	int dump_level;
>> diff --git a/filesys.c b/filesys.c
>> index 037704126840..d88ea28ebe7a 100644
>> --- a/filesys.c
>> +++ b/filesys.c
>> @@ -37,7 +37,6 @@ static int mount_point(char *);
>>  static int open_file_reference(struct reference *);
>>  static void memory_source_init(void);
>>  static int get_pathname_component(ulong, ulong, int, char *, char *);
>> -static ulong *get_mount_list(int *, struct task_context *);
>>  char *inode_type(char *, char *);
>>  static void match_proc_version(void);
>>  static void get_live_memory_source(void);
>> @@ -1600,7 +1599,7 @@ show_mounts(ulong one_vfsmount, int flags, struct
>> task_context *namespace_contex
>>  /*
>>   *  Allocate and fill a list of the currently-mounted vfsmount pointers.
>>   */
>> -static ulong *
>> +ulong *
>>  get_mount_list(int *cntptr, struct task_context *namespace_context)
>>  {
>>  	struct list_data list_data, *ld;
>> --
>> 2.18.1
>>
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
> 




More information about the Crash-utility mailing list