[Crash-utility] 答复: [External Mail]Re: zram decompress support for gcore/crash-utility

Dave Anderson anderson at redhat.com
Thu Apr 9 17:00:59 UTC 2020




----- Original Message -----
> Hi,Dave
> 
> I modified RETURN_ON_ERROR to FAULT_ON_ERROR in all readmem,patch has > attached.
> The reason for adding "decompress success"  is that i want indicate that zram
> address is different from the normal address,and calling zram_decompress not
> only readmem failures,but also decompression failures etc.i add "This page
> has swaped to zram"/"zram decompress success" as the signature log,and these
> log only printed when pc->debug >= 2.
> 
> When gcore read UVA address,there may be many page fault happened,we can only
> deal with zram swap,"not mapped" and other types of swap will not be
> processed.For debug request,we may need the signature log for zram.
> so i think it's better to keep this log.

OK fine, but please move the message out of readmem(), and put it at the end of 
try_zram_decompress() where it really belongs.  You'll have to replace the 
"PAGEOFFSET(addr)" argument with "ulonglong addr", and then do the PAGEOFFSET()
in try_zram_decompress().

Also, this doesn't compile cleanly on 32-bit architectures:

$ make warn
TARGET: X86
 CRASH: 7.2.9rc10
   GDB: 7.6

...
cc -c -g -DX86 -m32 -D_FILE_OFFSET_BITS=64 -DLZO -DSNAPPY -DGDB_7_6  diskdump.c -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -fstack-protector -Wformat-security 
diskdump.c: In function 'lookup_swap_cache':
diskdump.c:2657:2: warning: right shift count >= width of type [enabled by default]
  swp_type = __swp_type(pte_val);
  ^
diskdump.c:2659:3: warning: right shift count >= width of type [enabled by default]
   swp_offset = (ulonglong)__swp_offset(pte_val);
   ^
diskdump.c: In function 'try_zram_decompress':
diskdump.c:2709:3: warning: right shift count >= width of type [enabled by default]
   swap_info += (__swp_type(pte_val) * sizeof(void *));
   ^
diskdump.c:2713:3: warning: right shift count >= width of type [enabled by default]
   swap_info += (SIZE(swap_info_struct) * __swp_type(pte_val));
   ^
diskdump.c:2745:4: warning: right shift count >= width of type [enabled by default]
    swp_offset = (ulonglong)__swp_offset(pte_val);
...

Thanks,
  Dave




More information about the Crash-utility mailing list