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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



patch update
Found a better way translate pfn to page,PTOB.
Besides,fix a issue with low probability of decompression failure

________________________________________
From: 赵乾利
Sent: Saturday, April 4, 2020 14:46
To: Dave Anderson
Cc: d hatayama; Discussion list for crash utility usage, maintenance and development
Subject: Re: 答复: [External Mail]Re: [Crash-utility] zram decompress support for gcore/crash-utility

Hi,Dave

As you suggestion,i have made changes.
Calling pfn_to_map to get page address was a wrong use,it just work in SPARSEMEM
I'm looking for a interface like pfn_to_page,so i found two ways
1.pfn_to_map seems to work,and i didn't notice SPARSEMEM restriction
2.Combining pfn_to_phys and phy_to_page,but pfn_to_phys defined as a static function
i wrote this feature in gcore-command before,pfn_to_map not defined as static,so i can call directly....

Now,I use the following code to implement,this should work
+       phys_to_page((obj >> OBJ_INDEX_BITS) << PAGESHIFT(), &page);


Thanks

________________________________________
From: Dave Anderson <anderson@xxxxxxxxxx>
Sent: Saturday, April 4, 2020 4:14
To: 赵乾利
Cc: d hatayama; Discussion list for crash utility usage, maintenance and development
Subject: Re: 答复: [External Mail]Re: [Crash-utility] zram decompress support for gcore/crash-utility

----- 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

#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#

<<attachment: crash-zram0404-2.zip>>

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux