From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iSbn0-0001Ly-Vf for mharc-grub-devel@gnu.org; Thu, 07 Nov 2019 02:01:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41170) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iSbmw-0001Ln-QZ for grub-devel@gnu.org; Thu, 07 Nov 2019 02:01:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iSbmr-0004E3-4y for grub-devel@gnu.org; Thu, 07 Nov 2019 02:00:59 -0500 Received: from m4a0039g.houston.softwaregrp.com ([15.124.2.85]:49996) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iSbmq-0004Am-NK for grub-devel@gnu.org; Thu, 07 Nov 2019 02:00:56 -0500 Received: FROM m4a0039g.houston.softwaregrp.com (15.120.17.146) BY m4a0039g.houston.softwaregrp.com WITH ESMTP FOR grub-devel@gnu.org; Thu, 7 Nov 2019 06:59:48 +0000 Received: from M4W0334.microfocus.com (2002:f78:1192::f78:1192) by M4W0334.microfocus.com (2002:f78:1192::f78:1192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Thu, 7 Nov 2019 06:59:16 +0000 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (15.124.8.14) by M4W0334.microfocus.com (15.120.17.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10 via Frontend Transport; Thu, 7 Nov 2019 06:59:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CrZ4ewnFm8JBQ9+Xn0rE1hYv0CterLWriEbyHqkO6elvz1ArfUxiVj+fr0LeLAZbXdyLKEDxG6PFCCV++z8ZudJ4NCrFOcw4F5Yaswgo/t2CNrVyW9/937HEa7frV2fY1MKWFBEV2ylgSQQG/obyf6muSYfjR136bMEQVwARnEy/Ct4Obu6BzRB23NwdW23+luiR8s9JbiXTJK1XzQKBbqAEX2KG3gRak8d9tRPbH+OQzgIA8g5m/5uGvxbr83AHaUhyHp+PYLOnPhsBiAmaGO1opYn2IJgAaJ5PiG5Sr041yoOEtroycDSh7lRMuzOCn5OaTdcL6yff+Mirc3kHew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4u1D7/9kBYMgeT4yDf9taGtp5Q4l46e24rXLqT3X74k=; b=EB7bJ7eG4qeXtc7dC3rjIydOcUk9Q7k6sxr1OPyuUNi50dTpTJORygC34h/It8qKF1A66cLjpL7sKoMo9NiRiCjQay9zZQHgvW8O8SKMxsQxT9ay5+1c/iaGARCZq3y6kspP0i1eJAviecn70gfUQnU8S3ErgeQvWlBSqDKs3kGO3mj40k4gy5dWnPpKe8QkddrfEk0t7oEXVMfmufKHdOK1FybntKRkS4mFUcY+rv1Bp/J3UhQUyczNuh9PC4S0t7I1RmtWM2uHCKeVV9LMGRMJueLXh3Q9B9hgSEwJj/1qgXoBXOO06aVNSD0/UxVMd5Jqh7Vgf5wNQPnNQ8NV9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from BY5PR18MB3122.namprd18.prod.outlook.com (10.255.139.11) by BY5PR18MB3313.namprd18.prod.outlook.com (10.255.137.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.24; Thu, 7 Nov 2019 06:59:14 +0000 Received: from BY5PR18MB3122.namprd18.prod.outlook.com ([fe80::297d:fc41:ae2a:13d9]) by BY5PR18MB3122.namprd18.prod.outlook.com ([fe80::297d:fc41:ae2a:13d9%5]) with mapi id 15.20.2408.025; Thu, 7 Nov 2019 06:59:14 +0000 From: Michael Chang To: The development of GNU GRUB Subject: Re: [PATCH] btrfs: disable zstd support for i386-pc Thread-Topic: [PATCH] btrfs: disable zstd support for i386-pc Thread-Index: AQHVk7oyIbCUx3tbMUWvt7qXiTPxAKd+hYgAgACiDQCAAAPNgIAAHtuA Date: Thu, 7 Nov 2019 06:59:14 +0000 Message-ID: <20191107065907.GC4084@mazu> References: <20191105091949.29559-1-mchang@suse.com> <20191107045504.GA4084@mazu> In-Reply-To: Accept-Language: zh-TW, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK2PR02CA0181.apcprd02.prod.outlook.com (2603:1096:201:21::17) To BY5PR18MB3122.namprd18.prod.outlook.com (2603:10b6:a03:1af::11) authentication-results: spf=none (sender IP is ) smtp.mailfrom=MChang@suse.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [60.251.47.116] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e74d4391-d318-40e3-5a72-08d7634fffeb x-ms-traffictypediagnostic: BY5PR18MB3313: x-ms-exchange-purlcount: 2 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0214EB3F68 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(7916004)(4636009)(366004)(346002)(136003)(376002)(39860400002)(396003)(199004)(189003)(229853002)(25786009)(478600001)(966005)(99286004)(5660300002)(6246003)(66066001)(316002)(6306002)(6512007)(6436002)(9686003)(6486002)(14444005)(256004)(76176011)(52116002)(80792005)(7736002)(305945005)(6916009)(6116002)(14454004)(66946007)(1076003)(33716001)(476003)(64756008)(386003)(6506007)(66446008)(2906002)(66476007)(26005)(186003)(71190400001)(102836004)(55236004)(33656002)(81156014)(8676002)(81166006)(86362001)(71200400001)(8936002)(3846002)(486006)(446003)(11346002)(66556008); DIR:OUT; SFP:1102; SCL:1; SRVR:BY5PR18MB3313; H:BY5PR18MB3122.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: suse.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: kHWoAsR1mZIwsN6ti4ynat9AiCDls2JJVqwZGveC+SxaMeMz00I5k+5YCHG/zY9gTf5mK/S7BN71EUr5Z9tWYVpaJdbcq7eeAmj7r1GZiamXCjbdG8Zb7/xY4XFqGPwT4S/uREFB2o4dOO7CMChjUspDzrNooBKpzU47ce19SH32ifw0EPqJCIcjL45BMdPHjzVPSS/XcqBhGPhOZ2n611YCux0geWNkjN46VFIcXXrHfM4MbBHnlEde84KyPQGHqwTFBwoqhwcQgxdATx0XmlLDSj9fhuyRAKtgoyTLR2SAwkcIx6Q2GCWGOEFr0PgoPvXnRb82ODwfpWnI4ICixn4bwW2hRyRPmjEiolYyOnpjMUZGEEbP3yRrKcF0uI+4rYyQ1QDlOfqlPXOG7ioFN7lKhMa8ENFIn46GnChQR4DiOcATrTme/L8aXxuKM4ZXBNI2rfSEFu8yg5y7W3WiECVmz+dbESPG8uNEjmajkkE= Content-Type: text/plain; charset="us-ascii" Content-ID: <4C3A4F8E59DB9F408B79843B771EC0A6@namprd18.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: e74d4391-d318-40e3-5a72-08d7634fffeb X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Nov 2019 06:59:14.5963 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 856b813c-16e5-49a5-85ec-6f081e13b527 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: aed1FCCKptm3CNrA916VlI/cy03nfTOfP8FJ32qMUE2n7WDjuoeaOY9nFfehhF8B X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR18MB3313 X-OriginatorOrg: suse.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 15.124.2.85 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 07:01:05 -0000 On Wed, Nov 06, 2019 at 09:08:41PM -0800, Vladimir 'phcoder' Serbinenko wro= te: > On Wed, 6 Nov 2019, 20:55 Michael Chang, wrote: >=20 > > On Wed, Nov 06, 2019 at 11:15:04AM -0800, Vladimir 'phcoder' Serbinenko > > wrote: > > > Please don't do it this way. The right solution is to move it to sepa= rate > > > module and include zstd module when needed. > > > > I fully agree to work out a proper solution, but before that I think it > > is necessary to stop it from spread out going forward, as the running > > system upgrading to new version could be affected and the consequence i= s > > fatal - an unbootable system, qualified to be show stopper imho. > > > We don't do a release right now, so I don't think it's justified. Alright, then I'll keep it as downstream patch as it was found while we were doing a new release to latest stable grub. > Also > increase in size can easily come from a compiler. If an increase in size > can make system unbootable on upgrade, I'd rather be fixing this than jus= t > pepper over it. Here I'd like to share my thoughts to the unbootable issue. The increased size will casue the new boot image failure to install thus old/obseleted one still remains in place. We should detect such failure and abort the grub-install process earlier before new grub modules copied to preboot directory and avoiding the symbol lookup error as the consequence of mixture of old and new grub versions. Thanks, Michael >=20 > > > > > Not everybody uses btrfs > > > embedded area. I recommend not to use it. Using mbr gap or BBP is the > > > recommended way. > > > > The problem here is existing installation would fail to update to new > > grub version if it is using btrfs bootloader area. For new installation > > certainly we could recommend them to do so. or btrfs zstd support will > > be disabled if using a btrfs bootloader area. > > >=20 >=20 > > Thanks, > > Michael > > > > > > > > On Tue, 5 Nov 2019, 01:25 Michael Chang, wrote: > > > > > > > The zstd support in btrfs has dependenciy to zstd module and core.i= mg > > > > grows its size significantly to 75KB on my system. The resulted ima= ge > > > > 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. > > > > > > > > Signed-off-by: Michael Chang > > > > --- > > > > grub-core/fs/btrfs.c | 18 ++++++++++++++++++ > > > > 1 file changed, 18 insertions(+) > > > > > > > > diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c > > > > index 48bd3d04a..8f98892d3 100644 > > > > --- a/grub-core/fs/btrfs.c > > > > +++ b/grub-core/fs/btrfs.c > > > > @@ -17,6 +17,7 @@ > > > > * along with GRUB. If not, see . > > > > */ > > > > > > > > +#ifndef GRUB_MACHINE_PCBIOS > > > > /* > > > > * Tell zstd to expose functions that aren't part of the stable AP= I, > > which > > > > * aren't safe to use when linking against a dynamic library. We > > vendor > > > > in a > > > > @@ -24,6 +25,7 @@ > > > > * functions to provide our own allocator, which uses grub_malloc(= ), > > to > > > > zstd. > > > > */ > > > > #define ZSTD_STATIC_LINKING_ONLY > > > > +#endif > > > > > > > > #include > > > > #include > > > > @@ -35,7 +37,9 @@ > > > > #include > > > > #include > > > > #include > > > > +#ifndef GRUB_MACHINE_PCBIOS > > > > #include > > > > +#endif > > > > #include > > > > #include > > > > #include > > > > @@ -56,8 +60,10 @@ GRUB_MOD_LICENSE ("GPLv3+"); > > > > #define GRUB_BTRFS_LZO_BLOCK_MAX_CSIZE (GRUB_BTRFS_LZO_BLOCK_SIZE = + \ > > > > (GRUB_BTRFS_LZO_BLOCK_SIZE / 1= 6) > > + 64 > > > > + 3) > > > > > > > > +#ifndef GRUB_MACHINE_PCBIOS > > > > #define ZSTD_BTRFS_MAX_WINDOWLOG 17 > > > > #define ZSTD_BTRFS_MAX_INPUT (1 << ZSTD_BTRFS_MAX_WINDOWLOG) > > > > +#endif > > > > > > > > typedef grub_uint8_t grub_btrfs_checksum_t[0x20]; > > > > typedef grub_uint16_t grub_btrfs_uuid_t[8]; > > > > @@ -229,7 +235,9 @@ struct grub_btrfs_extent_data > > > > #define GRUB_BTRFS_COMPRESSION_NONE 0 > > > > #define GRUB_BTRFS_COMPRESSION_ZLIB 1 > > > > #define GRUB_BTRFS_COMPRESSION_LZO 2 > > > > +#ifndef GRUB_MACHINE_PCBIOS > > > > #define GRUB_BTRFS_COMPRESSION_ZSTD 3 > > > > +#endif > > > > > > > > #define GRUB_BTRFS_OBJECT_ID_CHUNK 0x100 > > > > > > > > @@ -1229,6 +1237,7 @@ grub_btrfs_read_inode (struct grub_btrfs_data > > *data, > > > > return grub_btrfs_read_logical (data, elemaddr, inode, sizeof > > (*inode), > > > > 0); > > > > } > > > > > > > > +#ifndef GRUB_MACHINE_PCBIOS > > > > static void *grub_zstd_malloc (void *state __attribute__((unused))= , > > > > size_t size) > > > > { > > > > return grub_malloc (size); > > > > @@ -1318,6 +1327,7 @@ err: > > > > > > > > return ret; > > > > } > > > > +#endif > > > > > > > > static grub_ssize_t > > > > grub_btrfs_lzo_decompress(char *ibuf, grub_size_t isize, grub_off_= t > > off, > > > > @@ -1494,8 +1504,12 @@ grub_btrfs_extent_read (struct grub_btrfs_da= ta > > > > *data, > > > > > > > > if (data->extent->compression !=3D GRUB_BTRFS_COMPRESSION_NO= NE > > > > && data->extent->compression !=3D GRUB_BTRFS_COMPRESSION_= ZLIB > > > > +#ifndef GRUB_MACHINE_PCBIOS > > > > && data->extent->compression !=3D GRUB_BTRFS_COMPRESSION_= LZO > > > > && data->extent->compression !=3D GRUB_BTRFS_COMPRESSION_= ZSTD) > > > > +#else > > > > + && data->extent->compression !=3D GRUB_BTRFS_COMPRESSION_= LZO) > > > > +#endif > > > > { > > > > grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, > > > > "compression type 0x%x not supported", > > > > @@ -1535,6 +1549,7 @@ grub_btrfs_extent_read (struct grub_btrfs_dat= a > > *data, > > > > !=3D (grub_ssize_t) csize) > > > > return -1; > > > > } > > > > +#ifndef GRUB_MACHINE_PCBIOS > > > > else if (data->extent->compression =3D=3D > > > > GRUB_BTRFS_COMPRESSION_ZSTD) > > > > { > > > > if (grub_btrfs_zstd_decompress (data->extent->inl, > > > > data->extsize - > > > > @@ -1544,6 +1559,7 @@ grub_btrfs_extent_read (struct grub_btrfs_dat= a > > *data, > > > > !=3D (grub_ssize_t) csize) > > > > return -1; > > > > } > > > > +#endif > > > > else > > > > grub_memcpy (buf, data->extent->inl + extoff, csize); > > > > break; > > > > @@ -1581,10 +1597,12 @@ grub_btrfs_extent_read (struct grub_btrfs_d= ata > > > > *data, > > > > ret =3D grub_btrfs_lzo_decompress (tmp, zsize, exto= ff > > > > + grub_le_to_cpu64 > > > > (data->extent->offset), > > > > buf, csize); > > > > +#ifndef GRUB_MACHINE_PCBIOS > > > > else if (data->extent->compression =3D=3D > > > > GRUB_BTRFS_COMPRESSION_ZSTD) > > > > ret =3D grub_btrfs_zstd_decompress (tmp, zsize, ext= off > > > > + grub_le_to_cpu64 > > > > (data->extent->offset), > > > > buf, csize); > > > > +#endif > > > > else > > > > ret =3D -1; > > > > > > > > -- > > > > 2.16.4 > > > > > > > > > > > > _______________________________________________ > > > > Grub-devel mailing list > > > > Grub-devel@gnu.org > > > > https://lists.gnu.org/mailman/listinfo/grub-devel > > > > > > > > > _______________________________________________ > > > Grub-devel mailing list > > > Grub-devel@gnu.org > > > https://lists.gnu.org/mailman/listinfo/grub-devel > > > > > > _______________________________________________ > > Grub-devel mailing list > > Grub-devel@gnu.org > > https://lists.gnu.org/mailman/listinfo/grub-devel > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel