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

Dave Anderson anderson at redhat.com
Fri Apr 3 20:14:03 UTC 2020



----- Original Message -----
> Hi,Dave
> 
> As per your suggestion, I updated the patch,and compiled successfully on
> arm64, x86,ppc64 architecture
> 

The patch does compile cleanly, although I haven't tried compiling it on an s390x, but
I'll do that soon.

A couple issues with the patch:

  +               if (!strncmp(name, "lzo", strlen("lzo"))) {
  +                       lzo_init();
  +                       decompressor = (void *)lzo1x_decompress_safe;
  +               } else {//todo,support more compressor
  +                       error(WARNING, "Only support lzo compressor\n");
  +                       return 0;
  +               }

lzo_init() will have already been called by is_diskdump() here during session
initialization if the dumpfile is a compressed kdump:

  #ifdef LZO
          if (lzo_init() == LZO_E_OK)
                  dd->flags |= LZO_SUPPORTED;
  #endif

So try_zram_decompress() should check if (dd->flags & LZO_SUPPORTED) has been set before
calling lzo_init() again.

And while I don't object to exporting swap_info_init(), I do have a problem with pfn_to_map():

  +void swap_info_init(void);
  +ulong pfn_to_map(ulong);

  ...

  +       obj >>= OBJ_TAG_BITS;
  +       page = pfn_to_map(obj >> OBJ_INDEX_BITS);
  +       obj_idx = (obj & OBJ_INDEX_MASK);

The pfn_to_map() function is only relevant if the kernel is configured with SPARSEMEM.
I don't see why the exported phys_to_page() function could not be used here?

Thanks,
  Dave




More information about the Crash-utility mailing list