[RFC PATCH v2 04/11] pstore: Add compression support to pstore

Seiji Aguchi seiji.aguchi at hds.com
Fri Aug 23 09:07:57 EST 2013



>   * callback from kmsg_dump. (s2,l2) has the most recently
>   * written bytes, older bytes are in (s1,l1). Save as much
> @@ -148,23 +243,56 @@ static void pstore_dump(struct kmsg_dumper *dumper,
>  		char *dst;
>  		unsigned long size;
>  		int hsize;
> +		int zipped_len = -1;
>  		size_t len;
> -		bool compressed = false;
> +		bool compressed;
> +		size_t total_len;
> 
> -		dst = psinfo->buf;
> -		hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part);
> -		size = psinfo->bufsize - hsize;
> -		dst += hsize;
> +		if (big_oops_buf) {
> +			dst = big_oops_buf;
> +			hsize = sprintf(dst, "%s#%d Part%d\n", why,
> +							oopscount, part);
> +			size = big_oops_buf_sz - hsize;
> 
> -		if (!kmsg_dump_get_buffer(dumper, true, dst, size, &len))
> -			break;
> +			if (!kmsg_dump_get_buffer(dumper, true, dst + hsize,
> +								size, &len))
> +				break;
> +
> +			zipped_len = pstore_compress(dst, psinfo->buf,
> +						hsize + len, psinfo->bufsize);
> +
> +			if (zipped_len > 0) {
> +				compressed = true;
> +				total_len = zipped_len;
> +			} else {
> +				pr_err("pstore: compression failed for Part %d"
> +					" returned %d\n", part, zipped_len);
> +				pr_err("pstore: Capture uncompressed"
> +					" oops/panic report of Part %d\n", part);

Why did you add these messages in pstore_dump()?
In my test case, they are not needed....

<snip>
# cat dmesg-efi-1
Panic#2 Part1
<4>[  383.209057] RBP: ffff88006f551e80 R08: 0000000000000002 R09: 0000000000000000
<4>[  383.209057] R10: 0000000000000382 R11: 0000000000000000 R12: 0000000000000063
<4>[  383.209057] R13: 0000000000000286 R14: 000000000000000f R15: 0000000000000000
<4>[  383.209057] FS:  00007f53317cc740(0000) GS:ffff88007c400000(0000) knlGS:0000000000000000
<4>[  383.209057] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
<4>[  383.209057] CR2: 0000000000000000 CR3: 0000000078a73000 CR4: 00000000000006f0
<4>[  383.209057] Stack:
<4>[  383.209057]  ffff88006f551eb8 ffffffff813d40a2 0000000000000002 00007f53317db000
<4>[  383.209057]  ffff88006f551f50 0000000000000002 0000000000000000 ffff88006f551ed8
<4>[  383.209057]  ffffffff813d45aa 00007f53317db000 ffff88003f8c2b00 ffff88006f551ef8
<4>[  383.209057] Call Trace:
<4>[  383.209057]  [<ffffffff813d40a2>] __handle_sysrq+0xa2/0x170
<4>[  383.209057]  [<ffffffff813d45aa>] write_sysrq_trigger+0x4a/0x50
<4>[  383.209057]  [<ffffffff8121981d>] proc_reg_write+0x3d/0x80
<4>[  383.209057]  [<ffffffff811aeb20>] vfs_write+0xc0/0x1f0
<4>[  383.209057]  [<ffffffff811af59c>] SyS_write+0x4c/0xa0
<4>[  383.209057]  [<ffffffff8168be82>] system_call_fastpath+0x16/0x1b
<4>[  383.209057] Code: ef e8 ff f7 ff ff eb d8 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 0f 1f 44 00 00 55 c7 05 cc f3 c9 00 01 00 00 00 48 89 e5 0f ae f8 <c6> 04 25 00 00 00 00 01 5d c3 0f 1f 44 00 00 55 31 c0 c7 05 5e 
<1>[  383.209057] RIP  [<ffffffff813d3946>] sysrq_handle_crash+0x16/0x20
<4>[  383.209057]  RSP <ffff88006f551e80>
<4>[  383.209057] CR2: 0000000000000000
<4>[  383.209057] ---[ end trace 04a1cddad37b4b33 ]---
<3>[  383.209057] pstore: compression failed for Part 2 returned -5
<3>[  383.209057] pstore: Capture uncompressed oops/panic report of Part 2
<3>[  383.209057] pstore: compression failed for Part 5 returned -5
<3>[  383.209057] pstore: Capture uncompressed oops/panic report of Part 5
<3>[  383.209057] pstore: compression failed for Part 12 returned -5
<3>[  383.209057] pstore: Capture uncompressed oops/panic report of Part 12
<0>[  383.209057] Kernel panic - not syncing: Fatal exception
<3>[  383.209057] drm_kms_helper: panic occurred, switching back to text console
<snip>


In efi-pstore case, after rebooting a system,
we are able to know which entry failed to compress with 'C' or 'D' as below.

#ls /sys/firmware/efi/vars/ |grep dump
dump-type0-10-1-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-10-2-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-11-1-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-1-1-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-11-2-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-12-1-1377204734-D-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-1-2-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-12-2-1377204734-D-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-13-1-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-13-2-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-2-1-1377204734-D-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-2-2-1377204734-D-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-3-1-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-3-2-1377204734-D-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-4-1-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-4-2-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-5-1-1377204734-D-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-5-2-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-6-1-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-6-2-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-7-1-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-7-2-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-8-1-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-8-2-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-9-1-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
dump-type0-9-2-1377204734-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0

Seiji


More information about the Linuxppc-dev mailing list