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


Groups > linux.kernel > #1335379

Re: About support XZ-compressed kernel on x86

From Baoquan He <bhe@redhat.com>
Newsgroups linux.kernel
Subject Re: About support XZ-compressed kernel on x86
Date 2016-02-16 14:30 +0100
Message-ID <r2NRv-8nd-5@gated-at.bofh.it> (permalink)
References <r1nZ8-q7-13@gated-at.bofh.it> <r1NJU-xX-9@gated-at.bofh.it> <r2547-3eR-7@gated-at.bofh.it> <r2xWq-643-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 02/15/16 at 10:26pm, Lasse Collin wrote:
> On 2016-02-14 Baoquan He wrote:
> > On 02/13/16 at 08:57pm, Lasse Collin wrote:
> > > The long comment in arch/x86/boot/compressed/misc.c explains the
> > > need for the offset for gzip/Deflate. A similar comment in
> > > lib/decompress_unxz.c explains it for XZ/LZMA2.  
> > 
> > Thank you so much, Lasse. You clearly pointed out my confusion.
> > Yeah, I didn't understand it well. Your description for xz in
> > lib/decompress_unxz.c is very helpful. The 64K is the maximum payload
> > in one chunk. Adding this 64K is to avoid the worst case that very
> > small payload can reprsent a 64K uncompressed output data. With my
> > understanding it could be  a chunk which contains complete duplicate
> > content. like all "0" or other stuff?
> 
> Yes, like all zeros. I wrote another explanation just in case it helps:

Yes, this is great and very helpful for people who want to understand
this details. I want to make some change to improve the readability of
the description in boot/compressed/misc.c, do you mind if I put these
there? Or you can post a patch to adjust it.

Thanks
Baoquan

> 
> In-place decompression puts the compressed data at the end of the
> buffer and decompresses it to the beginning of the buffer:
> 
>     F = free memory
>     K = uncompressed kernel
>     C = compressed input data
> 
>     Start:         FFFFFFFFFFFFFFCCCCCCCC
>     Decompressing: KKKKKKKKKKFFFFFFFFCCCC
>     Finished:      KKKKKKKKKKKKKKKKKKKKFF
> 
> The free memory (FF) at the end is the safety margin.
> 
> In the worst case the beginning of the uncompressed data compresses to
> almost nothing (like all zeros do), and the end of the data is
> incompressible. In the beginning the write position of the decompressor
> advances quickly while the read position moves very little, and thus
> the write position quickly approaches the read position:
> 
>     Start:         FFFFFFFFFFFFFFCCCCCCCC
>     Decompressing: KKKKKKKKKKKKKKFCCCCCCC
>     Finished:      KKKKKKKKKKKKKKKKKKKKFF
> 
> The safety margin ensures that the write position can never overtake
> the read position.
> 
> -- 
> Lasse Collin  |  IRC: Larhzu @ IRCnet & Freenode

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

About support XZ-compressed kernel on x86 Baoquan He <bhe@redhat.com> - 2016-02-12 16:40 +0100
  Re: About support XZ-compressed kernel on x86 Baoquan He <bhe@redhat.com> - 2016-02-12 16:50 +0100
  Re: About support XZ-compressed kernel on x86 Lasse Collin <lasse.collin@tukaani.org> - 2016-02-13 20:10 +0100
    Re: About support XZ-compressed kernel on x86 Baoquan He <bhe@redhat.com> - 2016-02-14 14:40 +0100
      Re: About support XZ-compressed kernel on x86 Lasse Collin <lasse.collin@tukaani.org> - 2016-02-15 21:30 +0100
        Re: About support XZ-compressed kernel on x86 Baoquan He <bhe@redhat.com> - 2016-02-16 14:30 +0100
          Re: About support XZ-compressed kernel on x86 Lasse Collin <lasse.collin@tukaani.org> - 2016-02-17 19:00 +0100
            Re: About support XZ-compressed kernel on x86 Baoquan He <bhe@redhat.com> - 2016-02-18 01:50 +0100
              Re: About support XZ-compressed kernel on x86 Lasse Collin <lasse.collin@tukaani.org> - 2016-02-19 21:20 +0100

csiph-web