Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1545381 > unrolled thread

[PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version

Started bySven Schmidt <4sschmid@informatik.uni-hamburg.de>
First post2016-12-20 20:10 +0100
Last post2016-12-22 14:30 +0100
Articles 7 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version Sven Schmidt <4sschmid@informatik.uni-hamburg.de> - 2016-12-20 20:10 +0100
    Re: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor  functions to work with new version kbuild test robot <lkp@intel.com> - 2016-12-21 06:20 +0100
    Re: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor  functions to work with new version kbuild test robot <lkp@intel.com> - 2016-12-21 06:20 +0100
    Re: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor  functions to work with new version Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-22 14:30 +0100
      Re: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor  functions to work with new version Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-22 16:40 +0100
      Re: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version Sven Schmidt <4sschmid@informatik.uni-hamburg.de> - 2016-12-22 16:40 +0100
    Re: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor  functions to work with new version Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-22 14:30 +0100

#1545381 — [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version

FromSven Schmidt <4sschmid@informatik.uni-hamburg.de>
Date2016-12-20 20:10 +0100
Subject[PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version
Message-ID<sQxXs-18O-45@gated-at.bofh.it>
This patch updates the fs/pstore and fs/squashfs to work with the
new LZ4 kernel module version.

Signed-off-by: Sven Schmidt <4sschmid@informatik.uni-hamburg.de>
---
 fs/pstore/platform.c      | 11 +++++------
 fs/squashfs/lz4_wrapper.c |  3 +--
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 729677e..037dc07 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -342,7 +342,7 @@ static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen)
 {
 	int ret;
 
-	ret = lz4_compress(in, inlen, out, &outlen, workspace);
+	ret = LZ4_compress_default(in, out, inlen, outlen, workspace);
 	if (ret) {
 		pr_err("lz4_compress error, ret = %d!\n", ret);
 		return -EIO;
@@ -355,7 +355,7 @@ static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen)
 {
 	int ret;
 
-	ret = lz4_decompress_unknownoutputsize(in, inlen, out, &outlen);
+	ret = LZ4_decompress_safe(in, out, inlen, outlen);
 	if (ret) {
 		pr_err("lz4_decompress error, ret = %d!\n", ret);
 		return -EIO;
@@ -366,7 +366,7 @@ static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen)
 
 static void allocate_lz4(void)
 {
-	big_oops_buf_sz = lz4_compressbound(psinfo->bufsize);
+	big_oops_buf_sz = LZ4_compressBound(psinfo->bufsize);
 	big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL);
 	if (big_oops_buf) {
 		workspace = kmalloc(LZ4_MEM_COMPRESS, GFP_KERNEL);
@@ -493,7 +493,6 @@ static void pstore_dump(struct kmsg_dumper *dumper,
 		if (!is_locked) {
 			pr_err("pstore dump routine blocked in %s path, may corrupt error record\n"
 				       , in_nmi() ? "NMI" : why);
-			return;
 		}
 	} else {
 		spin_lock_irqsave(&psinfo->buf_lock, flags);
@@ -585,8 +584,8 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
 		} else {
 			spin_lock_irqsave(&psinfo->buf_lock, flags);
 		}
-		psinfo->write_buf(PSTORE_TYPE_CONSOLE, 0, &id, 0,
-				  s, 0, c, psinfo);
+		memcpy(psinfo->buf, s, c);
+		psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, 0, c, psinfo);
 		spin_unlock_irqrestore(&psinfo->buf_lock, flags);
 		s += c;
 		c = e - s;
diff --git a/fs/squashfs/lz4_wrapper.c b/fs/squashfs/lz4_wrapper.c
index ff4468b..c087a63 100644
--- a/fs/squashfs/lz4_wrapper.c
+++ b/fs/squashfs/lz4_wrapper.c
@@ -108,8 +108,7 @@ static int lz4_uncompress(struct squashfs_sb_info *msblk, void *strm,
 		put_bh(bh[i]);
 	}
 
-	res = lz4_decompress_unknownoutputsize(stream->input, length,
-					stream->output, &dest_len);
+	res = LZ4_decompress_safe(stream->input, stream->output, length, (int)dest_len);
 	if (res)
 		return -EIO;
 
-- 
2.1.4

[toc] | [next] | [standalone]


#1545581 — Re: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version

Fromkbuild test robot <lkp@intel.com>
Date2016-12-21 06:20 +0100
SubjectRe: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version
Message-ID<sQHtL-7y7-3@gated-at.bofh.it>
In reply to#1545381

[Multipart message — attachments visible in raw view] — view raw

Hi Sven,

[auto build test ERROR on linus/master]
[also build test ERROR on next-20161221]
[cannot apply to v4.9]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Sven-Schmidt/Update-LZ4-compressor-module/20161221-130109
config: x86_64-randconfig-x006-201651 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

Note: the linux-review/Sven-Schmidt/Update-LZ4-compressor-module/20161221-130109 HEAD 08652114d6d8867d2e8b3545b5e9f8a2fe11a5d7 builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   fs/pstore/platform.c: In function 'compress_lz4':
>> fs/pstore/platform.c:345:8: error: implicit declaration of function 'LZ4_compress_default' [-Werror=implicit-function-declaration]
     ret = LZ4_compress_default(in, out, inlen, outlen, workspace);
           ^~~~~~~~~~~~~~~~~~~~
   fs/pstore/platform.c: In function 'decompress_lz4':
>> fs/pstore/platform.c:358:8: error: implicit declaration of function 'LZ4_decompress_safe' [-Werror=implicit-function-declaration]
     ret = LZ4_decompress_safe(in, out, inlen, outlen);
           ^~~~~~~~~~~~~~~~~~~
   fs/pstore/platform.c: In function 'allocate_lz4':
>> fs/pstore/platform.c:369:20: error: implicit declaration of function 'LZ4_compressBound' [-Werror=implicit-function-declaration]
     big_oops_buf_sz = LZ4_compressBound(psinfo->bufsize);
                       ^~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/LZ4_compress_default +345 fs/pstore/platform.c

   339	
   340	#ifdef CONFIG_PSTORE_LZ4_COMPRESS
   341	static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen)
   342	{
   343		int ret;
   344	
 > 345		ret = LZ4_compress_default(in, out, inlen, outlen, workspace);
   346		if (ret) {
   347			pr_err("lz4_compress error, ret = %d!\n", ret);
   348			return -EIO;
   349		}
   350	
   351		return outlen;
   352	}
   353	
   354	static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen)
   355	{
   356		int ret;
   357	
 > 358		ret = LZ4_decompress_safe(in, out, inlen, outlen);
   359		if (ret) {
   360			pr_err("lz4_decompress error, ret = %d!\n", ret);
   361			return -EIO;
   362		}
   363	
   364		return outlen;
   365	}
   366	
   367	static void allocate_lz4(void)
   368	{
 > 369		big_oops_buf_sz = LZ4_compressBound(psinfo->bufsize);
   370		big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL);
   371		if (big_oops_buf) {
   372			workspace = kmalloc(LZ4_MEM_COMPRESS, GFP_KERNEL);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1545582 — Re: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version

Fromkbuild test robot <lkp@intel.com>
Date2016-12-21 06:20 +0100
SubjectRe: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version
Message-ID<sQHtL-7y7-1@gated-at.bofh.it>
In reply to#1545381

[Multipart message — attachments visible in raw view] — view raw

Hi Sven,

[auto build test ERROR on linus/master]
[also build test ERROR on next-20161221]
[cannot apply to v4.9]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Sven-Schmidt/Update-LZ4-compressor-module/20161221-130109
config: x86_64-randconfig-x004-201651 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

Note: the linux-review/Sven-Schmidt/Update-LZ4-compressor-module/20161221-130109 HEAD 08652114d6d8867d2e8b3545b5e9f8a2fe11a5d7 builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   fs/squashfs/lz4_wrapper.c: In function 'lz4_uncompress':
>> fs/squashfs/lz4_wrapper.c:111:8: error: implicit declaration of function 'LZ4_decompress_safe' [-Werror=implicit-function-declaration]
     res = LZ4_decompress_safe(stream->input, stream->output, length, (int)dest_len);
           ^~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/LZ4_decompress_safe +111 fs/squashfs/lz4_wrapper.c

   105			buff += avail;
   106			bytes -= avail;
   107			offset = 0;
   108			put_bh(bh[i]);
   109		}
   110	
 > 111		res = LZ4_decompress_safe(stream->input, stream->output, length, (int)dest_len);
   112		if (res)
   113			return -EIO;
   114	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1546374 — Re: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version

FromSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Date2016-12-22 14:30 +0100
SubjectRe: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version
Message-ID<sRbBv-1B3-5@gated-at.bofh.it>
In reply to#1545381
On (12/20/16 19:53), Sven Schmidt wrote:
> @@ -366,7 +366,7 @@ static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen)
>  
>  static void allocate_lz4(void)
>  {
> -	big_oops_buf_sz = lz4_compressbound(psinfo->bufsize);
> +	big_oops_buf_sz = LZ4_compressBound(psinfo->bufsize);
>  	big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL);
>  	if (big_oops_buf) {
>  		workspace = kmalloc(LZ4_MEM_COMPRESS, GFP_KERNEL);
> @@ -493,7 +493,6 @@ static void pstore_dump(struct kmsg_dumper *dumper,
>  		if (!is_locked) {
>  			pr_err("pstore dump routine blocked in %s path, may corrupt error record\n"
>  				       , in_nmi() ? "NMI" : why);
> -			return;

why did you remove this "failed to lock buf in critical path" return?


>  		}
>  	} else {
>  		spin_lock_irqsave(&psinfo->buf_lock, flags);
> @@ -585,8 +584,8 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
>  		} else {
>  			spin_lock_irqsave(&psinfo->buf_lock, flags);
>  		}
> -		psinfo->write_buf(PSTORE_TYPE_CONSOLE, 0, &id, 0,
> -				  s, 0, c, psinfo);
> +		memcpy(psinfo->buf, s, c);
> +		psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, 0, c, psinfo);

why extra memcpy()?

	-ss

>  		spin_unlock_irqrestore(&psinfo->buf_lock, flags);
>  		s += c;
>  		c = e - s;
> diff --git a/fs/squashfs/lz4_wrapper.c b/fs/squashfs/lz4_wrapper.c
> index ff4468b..c087a63 100644
> --- a/fs/squashfs/lz4_wrapper.c
> +++ b/fs/squashfs/lz4_wrapper.c
> @@ -108,8 +108,7 @@ static int lz4_uncompress(struct squashfs_sb_info *msblk, void *strm,
>  		put_bh(bh[i]);
>  	}
>  
> -	res = lz4_decompress_unknownoutputsize(stream->input, length,
> -					stream->output, &dest_len);
> +	res = LZ4_decompress_safe(stream->input, stream->output, length, (int)dest_len);
>  	if (res)
>  		return -EIO;

[toc] | [prev] | [next] | [standalone]


#1546420 — Re: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version

FromSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Date2016-12-22 16:40 +0100
SubjectRe: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version
Message-ID<sRdDk-2MH-13@gated-at.bofh.it>
In reply to#1546374
On (12/22/16 16:31), Sven Schmidt wrote:
> Hey Sergey and thanks for your time. I'm afraid I messed up the diffstat on this.
> Actually I just replaced the function calls and corrected the use of return values.
> I will send an updated patchset later since there also have been errors
> reported from the buildbots.

and please use scripts/get_maintainer.pl so maintainers are in Cc list.

	-ss

[toc] | [prev] | [next] | [standalone]


#1546423

FromSven Schmidt <4sschmid@informatik.uni-hamburg.de>
Date2016-12-22 16:40 +0100
Message-ID<sRdDk-2MH-15@gated-at.bofh.it>
In reply to#1546374
On 12/22/2016 02:21 PM, Sergey Senozhatsky wrote:
> On (12/20/16 19:53), Sven Schmidt wrote:
>> @@ -366,7 +366,7 @@ static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen)
>>  
>>  static void allocate_lz4(void)
>>  {
>> -	big_oops_buf_sz = lz4_compressbound(psinfo->bufsize);
>> +	big_oops_buf_sz = LZ4_compressBound(psinfo->bufsize);
>>  	big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL);
>>  	if (big_oops_buf) {
>>  		workspace = kmalloc(LZ4_MEM_COMPRESS, GFP_KERNEL);
>> @@ -493,7 +493,6 @@ static void pstore_dump(struct kmsg_dumper *dumper,
>>  		if (!is_locked) {
>>  			pr_err("pstore dump routine blocked in %s path, may corrupt error record\n"
>>  				       , in_nmi() ? "NMI" : why);
>> -			return;
> 
> why did you remove this "failed to lock buf in critical path" return?
> 
> 
>>  		}
>>  	} else {
>>  		spin_lock_irqsave(&psinfo->buf_lock, flags);
>> @@ -585,8 +584,8 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
>>  		} else {
>>  			spin_lock_irqsave(&psinfo->buf_lock, flags);
>>  		}
>> -		psinfo->write_buf(PSTORE_TYPE_CONSOLE, 0, &id, 0,
>> -				  s, 0, c, psinfo);
>> +		memcpy(psinfo->buf, s, c);
>> +		psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, 0, c, psinfo);
> 
> why extra memcpy()?
> 
> 	-ss
> 
>>  		spin_unlock_irqrestore(&psinfo->buf_lock, flags);
>>  		s += c;
>>  		c = e - s;
>> diff --git a/fs/squashfs/lz4_wrapper.c b/fs/squashfs/lz4_wrapper.c
>> index ff4468b..c087a63 100644
>> --- a/fs/squashfs/lz4_wrapper.c
>> +++ b/fs/squashfs/lz4_wrapper.c
>> @@ -108,8 +108,7 @@ static int lz4_uncompress(struct squashfs_sb_info *msblk, void *strm,
>>  		put_bh(bh[i]);
>>  	}
>>  
>> -	res = lz4_decompress_unknownoutputsize(stream->input, length,
>> -					stream->output, &dest_len);
>> +	res = LZ4_decompress_safe(stream->input, stream->output, length, (int)dest_len);
>>  	if (res)
>>  		return -EIO;
>

Hey Sergey and thanks for your time. I'm afraid I messed up the diffstat on this.
Actually I just replaced the function calls and corrected the use of return values.
I will send an updated patchset later since there also have been errors
reported from the buildbots.

Sven

[toc] | [prev] | [next] | [standalone]


#1546378 — Re: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version

FromSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Date2016-12-22 14:30 +0100
SubjectRe: [PATCH 2/3] fs/pstore: fs/squashfs: Change lz4 compressor functions to work with new version
Message-ID<sRbBv-1B3-25@gated-at.bofh.it>
In reply to#1545381
Cc Anton, Colin, Kees, Tony on this

https://marc.info/?l=linux-kernel&m=148226086323932

On (12/20/16 19:53), Sven Schmidt wrote:
> 
> This patch updates the fs/pstore and fs/squashfs to work with the
> new LZ4 kernel module version.
> 
> Signed-off-by: Sven Schmidt <4sschmid@informatik.uni-hamburg.de>
> ---
>  fs/pstore/platform.c      | 11 +++++------
>  fs/squashfs/lz4_wrapper.c |  3 +--
>  2 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
> index 729677e..037dc07 100644
> --- a/fs/pstore/platform.c
> +++ b/fs/pstore/platform.c
> @@ -342,7 +342,7 @@ static int compress_lz4(const void *in, void *out, size_t inlen, size_t outlen)
>  {
>  	int ret;
>  
> -	ret = lz4_compress(in, inlen, out, &outlen, workspace);
> +	ret = LZ4_compress_default(in, out, inlen, outlen, workspace);
>  	if (ret) {
>  		pr_err("lz4_compress error, ret = %d!\n", ret);
>  		return -EIO;
> @@ -355,7 +355,7 @@ static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen)
>  {
>  	int ret;
>  
> -	ret = lz4_decompress_unknownoutputsize(in, inlen, out, &outlen);
> +	ret = LZ4_decompress_safe(in, out, inlen, outlen);
>  	if (ret) {
>  		pr_err("lz4_decompress error, ret = %d!\n", ret);
>  		return -EIO;
> @@ -366,7 +366,7 @@ static int decompress_lz4(void *in, void *out, size_t inlen, size_t outlen)
>  
>  static void allocate_lz4(void)
>  {
> -	big_oops_buf_sz = lz4_compressbound(psinfo->bufsize);
> +	big_oops_buf_sz = LZ4_compressBound(psinfo->bufsize);
>  	big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL);
>  	if (big_oops_buf) {
>  		workspace = kmalloc(LZ4_MEM_COMPRESS, GFP_KERNEL);
> @@ -493,7 +493,6 @@ static void pstore_dump(struct kmsg_dumper *dumper,
>  		if (!is_locked) {
>  			pr_err("pstore dump routine blocked in %s path, may corrupt error record\n"
>  				       , in_nmi() ? "NMI" : why);
> -			return;
>  		}
>  	} else {
>  		spin_lock_irqsave(&psinfo->buf_lock, flags);
> @@ -585,8 +584,8 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
>  		} else {
>  			spin_lock_irqsave(&psinfo->buf_lock, flags);
>  		}
> -		psinfo->write_buf(PSTORE_TYPE_CONSOLE, 0, &id, 0,
> -				  s, 0, c, psinfo);
> +		memcpy(psinfo->buf, s, c);
> +		psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, 0, c, psinfo);
>  		spin_unlock_irqrestore(&psinfo->buf_lock, flags);
>  		s += c;
>  		c = e - s;
> diff --git a/fs/squashfs/lz4_wrapper.c b/fs/squashfs/lz4_wrapper.c
> index ff4468b..c087a63 100644
> --- a/fs/squashfs/lz4_wrapper.c
> +++ b/fs/squashfs/lz4_wrapper.c
> @@ -108,8 +108,7 @@ static int lz4_uncompress(struct squashfs_sb_info *msblk, void *strm,
>  		put_bh(bh[i]);
>  	}
>  
> -	res = lz4_decompress_unknownoutputsize(stream->input, length,
> -					stream->output, &dest_len);
> +	res = LZ4_decompress_safe(stream->input, stream->output, length, (int)dest_len);
>  	if (res)
>  		return -EIO;
>  
> -- 
> 2.1.4
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web