All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Terrell <terrelln@fb.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH] btrfs: disable zstd support for i386-pc
Date: Wed, 6 Nov 2019 18:53:45 +0000	[thread overview]
Message-ID: <BD3843EA-9670-462A-8D0C-95084D7CD1D7@fb.com> (raw)
In-Reply-To: <20191106124030.GB9344@twin.jikos.cz>


> On Nov 6, 2019, at 4:40 AM, David Sterba <dave@jikos.cz> wrote:
> 
> On Tue, Nov 05, 2019 at 09:19:59AM +0000, Michael Chang wrote:
>> The zstd support in btrfs has dependenciy to zstd module and core.img
>> grows its size significantly to 75KB on my system. The resulted image
>> cannot be installed into btrfs bootloader area in the size of 64KB and
>> eventually fails with following message.
>> 
>> /usr/sbin/grub-install: warning: your core.img is unusually large.  It
>> won't fit in the embedding area.
>> /usr/sbin/grub-install: error: filesystem `btrfs' doesn't support
>> blocklists.
>> 
>> The patch disabled the zstd support of btrfs in pc-bios platform to
>> avoid the regression. The resulting size is 56KB, albeit a bit too close
>> to the 64KB but works. This is simple workaround until a proper fix
>> landed upstream.
> 
> So combination zstd+btrfs+i386-pc never worked? Removing support for
> zstd could lead to unbootable system, but if that has never worked
> before it'd be ok to make the build conditional.
> 
> Looking at zstd code, does not seem to be easy to squeeze the asm to
> something like 64-56=8K.

Yeah, upstream zstd won’t get down to 8K. We recently did some work to
make the decompressor smaller for mobile reducing inlining and excluding
variants of some functions. On x86_64 the upstream library went from
84KB -> 63KB uncompressed, and 31KB -> 25KB compressed. If we update
GRUB to the latest zstd and define a few macros we can get that gain. But it
won’t be 8KB.

A custom zstd decompress optimized for size could be made much smaller
But that would be a large maintenance burden. For example, we have an
“educational decoder” that is 18 KB uncompressed and 8 KB compressed,
but it can’t be used in production, since it isn’t hardened against invalid inputs.
But, it shows the zstd format can be decompressed with a small library.
If we (upstream) add a smaller zstd decompressor, we will put a patch up to
use it in GRUB.

-Nick

  reply	other threads:[~2019-11-06 18:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05  9:19 [PATCH] btrfs: disable zstd support for i386-pc Michael Chang
2019-11-05 10:52 ` Paul Menzel
2019-11-07  4:22   ` Michael Chang
2019-11-06 12:40 ` David Sterba
2019-11-06 18:53   ` Nick Terrell [this message]
2019-11-07  6:34   ` Michael Chang
2019-11-06 19:15 ` Vladimir 'phcoder' Serbinenko
2019-11-07  4:55   ` Michael Chang
2019-11-07  5:08     ` Vladimir 'phcoder' Serbinenko
2019-11-07  6:59       ` Michael Chang
2020-06-11 22:58       ` Eli Schwartz
2020-06-21 18:26         ` Mike Gilbert
2020-06-21 18:56           ` Eli Schwartz
2020-06-23  1:59             ` Mike Gilbert
2020-06-23  2:16             ` Mike Gilbert
2020-06-23  6:32               ` Michael Chang
2020-06-23 17:50                 ` Mike Gilbert
2019-11-07 11:52   ` Daniel Kiper
2019-11-13 11:00     ` Daniel Kiper
2019-11-14  9:53       ` Michael Chang
2019-11-15 11:42         ` Daniel Kiper
2019-11-19  8:34           ` Michael Chang
2020-03-03 16:59             ` Daniel Kiper
2020-03-04  7:58               ` Michael Chang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BD3843EA-9670-462A-8D0C-95084D7CD1D7@fb.com \
    --to=terrelln@fb.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.