All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] pstore: Adjust buffer size for compression for smaller registered buffers
@ 2013-09-11 12:07 ` Aruna Balakrishnaiah
  0 siblings, 0 replies; 10+ messages in thread
From: Aruna Balakrishnaiah @ 2013-09-11 12:07 UTC (permalink / raw)
  To: linuxppc-dev, tony.luck, seiji.aguchi, linux-kernel, keescook
  Cc: jkenisto, mahesh, cbouatmailru, ananth, ccross

When backends (ex: efivars) have smaller registered buffers, the big_oops_buf
is quite too big for them as number of repeated occurences in the text captured
will be less. Patch takes care of adjusting the buffer size based on the
registered buffer size. cmpr values has been arrived after doing experiments with
plain text for buffers of size 1k - 4k (Smaller the buffer size repeated occurence
will be less) and with sample crash log for buffers ranging from 4k - 10k.

Reported-by: Seiji Aguchi <seiji.aguchi@hds.com>
Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
---
 fs/pstore/platform.c |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 4ffb7ab..4efaa75 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -195,8 +195,29 @@ error:
 static void allocate_buf_for_compression(void)
 {
 	size_t size;
+	size_t cmpr;
+
+	switch (psinfo->bufsize) {
+	/* buffer range for efivars */
+	case 1000 ... 2000:
+		cmpr = 56;
+		break;
+	case 2001 ... 3000:
+		cmpr = 54;
+		break;
+	case 3001 ... 3999:
+		cmpr = 52;
+		break;
+	/* buffer range for nvram, erst */
+	case 4000 ... 10000:
+		cmpr = 48;
+		break;
+	default:
+		cmpr = 60;
+		break;
+	}
 
-	big_oops_buf_sz = (psinfo->bufsize * 100) / 45;
+	big_oops_buf_sz = (psinfo->bufsize * 100) / cmpr;
 	big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL);
 	if (big_oops_buf) {
 		size = max(zlib_deflate_workspacesize(WINDOW_BITS, MEM_LEVEL),


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 1/3] pstore: Adjust buffer size for compression for smaller registered buffers
@ 2013-09-11 12:07 ` Aruna Balakrishnaiah
  0 siblings, 0 replies; 10+ messages in thread
From: Aruna Balakrishnaiah @ 2013-09-11 12:07 UTC (permalink / raw)
  To: linuxppc-dev, tony.luck, seiji.aguchi, linux-kernel, keescook
  Cc: jkenisto, mahesh, ccross, cbouatmailru

When backends (ex: efivars) have smaller registered buffers, the big_oops_buf
is quite too big for them as number of repeated occurences in the text captured
will be less. Patch takes care of adjusting the buffer size based on the
registered buffer size. cmpr values has been arrived after doing experiments with
plain text for buffers of size 1k - 4k (Smaller the buffer size repeated occurence
will be less) and with sample crash log for buffers ranging from 4k - 10k.

Reported-by: Seiji Aguchi <seiji.aguchi@hds.com>
Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
---
 fs/pstore/platform.c |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 4ffb7ab..4efaa75 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -195,8 +195,29 @@ error:
 static void allocate_buf_for_compression(void)
 {
 	size_t size;
+	size_t cmpr;
+
+	switch (psinfo->bufsize) {
+	/* buffer range for efivars */
+	case 1000 ... 2000:
+		cmpr = 56;
+		break;
+	case 2001 ... 3000:
+		cmpr = 54;
+		break;
+	case 3001 ... 3999:
+		cmpr = 52;
+		break;
+	/* buffer range for nvram, erst */
+	case 4000 ... 10000:
+		cmpr = 48;
+		break;
+	default:
+		cmpr = 60;
+		break;
+	}
 
-	big_oops_buf_sz = (psinfo->bufsize * 100) / 45;
+	big_oops_buf_sz = (psinfo->bufsize * 100) / cmpr;
 	big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL);
 	if (big_oops_buf) {
 		size = max(zlib_deflate_workspacesize(WINDOW_BITS, MEM_LEVEL),

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] pstore: Use zlib_inflateInit2 instead of zlib_inflateInit
  2013-09-11 12:07 ` Aruna Balakrishnaiah
@ 2013-09-11 12:07   ` Aruna Balakrishnaiah
  -1 siblings, 0 replies; 10+ messages in thread
From: Aruna Balakrishnaiah @ 2013-09-11 12:07 UTC (permalink / raw)
  To: linuxppc-dev, tony.luck, seiji.aguchi, linux-kernel, keescook
  Cc: jkenisto, mahesh, cbouatmailru, ananth, ccross

Since zlib_deflateInit2() is used for specifying window bit during compression,
zlib_inflateInit2() is appropriate for decompression.

Reported-by: Seiji Aguchi <seiji.aguchi@hds.com>
Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
---
 fs/pstore/platform.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 4efaa75..18924c7 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -168,7 +168,7 @@ static int pstore_decompress(void *in, void *out, size_t inlen, size_t outlen)
 	int err, ret;
 
 	ret = -EIO;
-	err = zlib_inflateInit(&stream);
+	err = zlib_inflateInit2(&stream, WINDOW_BITS);
 	if (err != Z_OK)
 		goto error;
 


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] pstore: Use zlib_inflateInit2 instead of zlib_inflateInit
@ 2013-09-11 12:07   ` Aruna Balakrishnaiah
  0 siblings, 0 replies; 10+ messages in thread
From: Aruna Balakrishnaiah @ 2013-09-11 12:07 UTC (permalink / raw)
  To: linuxppc-dev, tony.luck, seiji.aguchi, linux-kernel, keescook
  Cc: jkenisto, mahesh, ccross, cbouatmailru

Since zlib_deflateInit2() is used for specifying window bit during compression,
zlib_inflateInit2() is appropriate for decompression.

Reported-by: Seiji Aguchi <seiji.aguchi@hds.com>
Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
---
 fs/pstore/platform.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 4efaa75..18924c7 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -168,7 +168,7 @@ static int pstore_decompress(void *in, void *out, size_t inlen, size_t outlen)
 	int err, ret;
 
 	ret = -EIO;
-	err = zlib_inflateInit(&stream);
+	err = zlib_inflateInit2(&stream, WINDOW_BITS);
 	if (err != Z_OK)
 		goto error;
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] pstore: Remove the messages related to compression failure
  2013-09-11 12:07 ` Aruna Balakrishnaiah
@ 2013-09-11 12:07   ` Aruna Balakrishnaiah
  -1 siblings, 0 replies; 10+ messages in thread
From: Aruna Balakrishnaiah @ 2013-09-11 12:07 UTC (permalink / raw)
  To: linuxppc-dev, tony.luck, seiji.aguchi, linux-kernel, keescook
  Cc: jkenisto, mahesh, cbouatmailru, ananth, ccross

Remove the messages indicating compression failure as it will
add to the space during panic path.

Reported-by: Seiji Aguchi <seiji.aguchi@hds.com>
Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
---
 fs/pstore/platform.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 18924c7..4ad8c93 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -316,10 +316,6 @@ static void pstore_dump(struct kmsg_dumper *dumper,
 				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);
 				compressed = false;
 				total_len = copy_kmsg_to_buffer(hsize, len);
 			}


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] pstore: Remove the messages related to compression failure
@ 2013-09-11 12:07   ` Aruna Balakrishnaiah
  0 siblings, 0 replies; 10+ messages in thread
From: Aruna Balakrishnaiah @ 2013-09-11 12:07 UTC (permalink / raw)
  To: linuxppc-dev, tony.luck, seiji.aguchi, linux-kernel, keescook
  Cc: jkenisto, mahesh, ccross, cbouatmailru

Remove the messages indicating compression failure as it will
add to the space during panic path.

Reported-by: Seiji Aguchi <seiji.aguchi@hds.com>
Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
---
 fs/pstore/platform.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 18924c7..4ad8c93 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -316,10 +316,6 @@ static void pstore_dump(struct kmsg_dumper *dumper,
 				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);
 				compressed = false;
 				total_len = copy_kmsg_to_buffer(hsize, len);
 			}

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* RE: [PATCH 1/3] pstore: Adjust buffer size for compression for smaller registered buffers
  2013-09-11 12:07 ` Aruna Balakrishnaiah
@ 2013-09-11 18:34   ` Luck, Tony
  -1 siblings, 0 replies; 10+ messages in thread
From: Luck, Tony @ 2013-09-11 18:34 UTC (permalink / raw)
  To: Aruna Balakrishnaiah, linuxppc-dev, seiji.aguchi, linux-kernel, keescook
  Cc: jkenisto, mahesh, cbouatmailru, ananth, ccross

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 597 bytes --]

-	big_oops_buf_sz = (psinfo->bufsize * 100) / 45;
+	big_oops_buf_sz = (psinfo->bufsize * 100) / cmpr;

Tested on an ERST backed system.  Seems to be working (we save a little less information
per ERST record than before this change (uncompressed size goes down from ~17500 to
~16400 bytes) - but this patch switched the denominator from 45 to 48 (for ERST) - so that
seems plausible.

Seiji: let me know how the efivars tests go.

-Tony
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 1/3] pstore: Adjust buffer size for compression for smaller registered buffers
@ 2013-09-11 18:34   ` Luck, Tony
  0 siblings, 0 replies; 10+ messages in thread
From: Luck, Tony @ 2013-09-11 18:34 UTC (permalink / raw)
  To: Aruna Balakrishnaiah, linuxppc-dev, seiji.aguchi, linux-kernel, keescook
  Cc: jkenisto, mahesh, ccross, cbouatmailru

LQliaWdfb29wc19idWZfc3ogPSAocHNpbmZvLT5idWZzaXplICogMTAwKSAvIDQ1Ow0KKwliaWdf
b29wc19idWZfc3ogPSAocHNpbmZvLT5idWZzaXplICogMTAwKSAvIGNtcHI7DQoNClRlc3RlZCBv
biBhbiBFUlNUIGJhY2tlZCBzeXN0ZW0uICBTZWVtcyB0byBiZSB3b3JraW5nICh3ZSBzYXZlIGEg
bGl0dGxlIGxlc3MgaW5mb3JtYXRpb24NCnBlciBFUlNUIHJlY29yZCB0aGFuIGJlZm9yZSB0aGlz
IGNoYW5nZSAodW5jb21wcmVzc2VkIHNpemUgZ29lcyBkb3duIGZyb20gfjE3NTAwIHRvDQp+MTY0
MDAgYnl0ZXMpIC0gYnV0IHRoaXMgcGF0Y2ggc3dpdGNoZWQgdGhlIGRlbm9taW5hdG9yIGZyb20g
NDUgdG8gNDggKGZvciBFUlNUKSAtIHNvIHRoYXQNCnNlZW1zIHBsYXVzaWJsZS4NCg0KU2Vpamk6
IGxldCBtZSBrbm93IGhvdyB0aGUgZWZpdmFycyB0ZXN0cyBnby4NCg0KLVRvbnkNCg==

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 1/3] pstore: Adjust buffer size for compression for smaller registered buffers
  2013-09-11 18:34   ` Luck, Tony
@ 2013-09-11 18:57     ` Seiji Aguchi
  -1 siblings, 0 replies; 10+ messages in thread
From: Seiji Aguchi @ 2013-09-11 18:57 UTC (permalink / raw)
  To: Luck, Tony, Aruna Balakrishnaiah, linuxppc-dev, linux-kernel, keescook
  Cc: jkenisto, mahesh, cbouatmailru, ananth, ccross

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 494 bytes --]

>+	/* buffer range for efivars */
>+	case 1000 ... 2000:
>+		cmpr = 56;
>+		break;

> Seiji: let me know how the efivars tests go.

efivars works fine.
Uncompressed size about 1800 bytes. It matches the value of cmpr, 56. 

Please feel free to add my "Tested-by" to all three patches.

Tested-by: Seiji Aguchi <seiji.aguchi@hds.com>

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 1/3] pstore: Adjust buffer size for compression for smaller registered buffers
@ 2013-09-11 18:57     ` Seiji Aguchi
  0 siblings, 0 replies; 10+ messages in thread
From: Seiji Aguchi @ 2013-09-11 18:57 UTC (permalink / raw)
  To: Luck, Tony, Aruna Balakrishnaiah, linuxppc-dev, linux-kernel, keescook
  Cc: jkenisto, mahesh, ccross, cbouatmailru

PisJLyogYnVmZmVyIHJhbmdlIGZvciBlZml2YXJzICovDQo+KwljYXNlIDEwMDAgLi4uIDIwMDA6
DQo+KwkJY21wciA9IDU2Ow0KPisJCWJyZWFrOw0KDQo+IFNlaWppOiBsZXQgbWUga25vdyBob3cg
dGhlIGVmaXZhcnMgdGVzdHMgZ28uDQoNCmVmaXZhcnMgd29ya3MgZmluZS4NClVuY29tcHJlc3Nl
ZCBzaXplIGFib3V0IDE4MDAgYnl0ZXMuIEl0IG1hdGNoZXMgdGhlIHZhbHVlIG9mIGNtcHIsIDU2
LiANCg0KUGxlYXNlIGZlZWwgZnJlZSB0byBhZGQgbXkgIlRlc3RlZC1ieSIgdG8gYWxsIHRocmVl
IHBhdGNoZXMuDQoNClRlc3RlZC1ieTogU2VpamkgQWd1Y2hpIDxzZWlqaS5hZ3VjaGlAaGRzLmNv
bT4NCg0K

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-09-11 18:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-11 12:07 [PATCH 1/3] pstore: Adjust buffer size for compression for smaller registered buffers Aruna Balakrishnaiah
2013-09-11 12:07 ` Aruna Balakrishnaiah
2013-09-11 12:07 ` [PATCH 2/3] pstore: Use zlib_inflateInit2 instead of zlib_inflateInit Aruna Balakrishnaiah
2013-09-11 12:07   ` Aruna Balakrishnaiah
2013-09-11 12:07 ` [PATCH 3/3] pstore: Remove the messages related to compression failure Aruna Balakrishnaiah
2013-09-11 12:07   ` Aruna Balakrishnaiah
2013-09-11 18:34 ` [PATCH 1/3] pstore: Adjust buffer size for compression for smaller registered buffers Luck, Tony
2013-09-11 18:34   ` Luck, Tony
2013-09-11 18:57   ` Seiji Aguchi
2013-09-11 18:57     ` Seiji Aguchi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.