On 2024/03/12 17:25, Yulong TANG 汤玉龙 wrote:
> In Linux 5.1, the ZRAM block driver has changed its default compressor
> from "lzo" to "lzo-rle" to enhance LZO compression support. However,
> crash does not support the improved LZO algorithm, resulting in failure
> when reading memory.
>
> change default compressor : ce82f19fd5809f0cf87ea9f753c5cc65ca0673d6
>
> The issue was discovered when using the extension 'gcore' to generate a
> process coredump, which was found to be incomplete and unable to be
> opened properly with gdb.
> This patch is for Crash-utility tool, it enables the Crash-utility to
> support decompression of the "lzo-rle" compression algorithm used in
> zram. The patch has been tested with vmcore files from kernel version
> 5.4, and successfully allows reading of memory compressed with the zram
> compression algorithm.
>
> Testing:
> ========
>
> before apply this patch :
> crash> gcore -v 0 1
> gcore: WARNING: only the lzo compressor is supported
> gcore: WARNING: only the lzo compressor is supported
> gcore: WARNING: only the lzo compressor is supported
> after:
> crash> gcore -v 0
> 1 Saved core.1.init
>
> Changelog:
> ==========
> v2: keep the "if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)"
> related code of the copied kernel code, but change the "if defined"
> macro into a runtime check .
> v3: set a default value of HAVE_EFFICIENT_UNALIGNED_ACCESS depending on
> architecture, for no ikconfig kernels.
Thanks for the update.
> + } else if (STREQ(name, "lzo-rle")) {
> +#ifdef LZO
why are this ifdef and lzo_init() etc. needed? I think we do not use
the lzo library for lzo-rle. maybe I'm missing something..
> + bool efficient_unaligned_access;
There is no need to check this every call, how about making this static?
for example:
static int efficient_unaligned_access = -1;
if (efficient_unaligned_access == -1) {
#if defined(ARM) || defined(ARM64) || defined(X86) || defined(X86_64) ||
defined(PPC) || defined(PPC64) || defined(S390)|| defined(S390X)
efficient_unaligned_access = TRUE;
#else
efficient_unaligned_access = FALSE;
#endif
if ((kt->ikconfig_flags & IKCONFIG_AVAIL) &&
(get_kernel_config("CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS", NULL)
== IKCONFIG_Y)
efficient_unaligned_access = TRUE;
}
Thanks,
Kazu
>
> Patch:
> ==========
>
> See attachment.
>
>
>
> Thanks and regards,
> Yulong
>
>
> --
> Crash-utility mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
> Contribution Guidelines: https://github.com/crash-utility/crash/wiki
--
Crash-utility mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki