From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iVBqh-0000IZ-Lw for mharc-grub-devel@gnu.org; Thu, 14 Nov 2019 04:55:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39467) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVBqd-0000A5-84 for grub-devel@gnu.org; Thu, 14 Nov 2019 04:55:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iVBqa-0001tS-AL for grub-devel@gnu.org; Thu, 14 Nov 2019 04:55:30 -0500 Received: from m9a0001g.houston.softwaregrp.com ([15.124.64.66]:48139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iVBqa-0000w0-3f for grub-devel@gnu.org; Thu, 14 Nov 2019 04:55:28 -0500 Received: FROM m9a0001g.houston.softwaregrp.com (15.121.0.190) BY m9a0001g.houston.softwaregrp.com WITH ESMTP; Thu, 14 Nov 2019 09:54:47 +0000 Received: from M9W0067.microfocus.com (2002:f79:be::f79:be) by M9W0067.microfocus.com (2002:f79:be::f79:be) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Thu, 14 Nov 2019 09:53:55 +0000 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (15.124.72.13) by M9W0067.microfocus.com (15.121.0.190) 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, 14 Nov 2019 09:53:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F+y1leMH6KfTk6eRXB5APd/8fGEl3X2VVBiTHiFdC4sf9nEd44Mw4MjCHuDPT7ftqCTxbIj+PvPOROFzHn2vsdzKwXEkGqwENXzMSd4PWeOuQpRuS43vo8SCMiMxJ5GubL1eLJe0WqGbdcFvyOjNutSHzNoIgF+ozloXoY0a4eVSo0hP/wFZ2AdoJmEgxo2mMi1t3RWf/T1EV963LKfpArpfMIATSQC3kMXOJfZWnvvTDTBGcAmhgNOGyK1viJAGA95paoHueLfJX8KEBXvB4668eJiF5IoMETqtP3djIRagNEPTWxhyE4hJznkIlrcaTossTjC54COa/UP39dZIhg== 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=75vNykAi0U5QTMHDXlj1V7IinBek6h8g2ru2G3v9bKs=; b=oF2K9kQ1m98t4nazRg9UIGY3WeX6PDZFCT/NAm/CFUemLQzBkCJBAssn6SZZFSS76G7oqItpmoOM/u/hhI/GIiiMBiEVTCxZShewILhcwhJNiM9j5DmwTeqPLpNmRUVS6sLhw2Y2fPsV6h3AZ3EgSN+N61P6Dsa9knCSVAQ2R6+rG03enFa8GR1rY4ivM7Bj4uCU/kGt33d4V4RzNh5+lB+SZIY6EbuxQxOCnSsrWqSNR+QGce+zmuwfW6/nE0LQoW60tDDDUo+cPpkYfnjJgJ2Z0J009UKhJJZ+wEq/U+OGOW/cqosVDWnxiKvN9KvrhEL70nW99NQ/Z7PDZbdArA== 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 BY5PR18MB3154.namprd18.prod.outlook.com (10.255.137.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.26; Thu, 14 Nov 2019 09:53:54 +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.2451.023; Thu, 14 Nov 2019 09:53:54 +0000 From: Michael Chang To: The development of GNU GRUB CC: Vladimir 'phcoder' Serbinenko , "dave@jikos.cz" , "pmenzel@molgen.mpg.de" , "terrelln@fb.com" Subject: Re: [PATCH] btrfs: disable zstd support for i386-pc Thread-Topic: [PATCH] btrfs: disable zstd support for i386-pc Thread-Index: AQHVk7oyIbCUx3tbMUWvt7qXiTPxAKd+hYgAgAEWtICACV+HAIABf5eA Date: Thu, 14 Nov 2019 09:53:54 +0000 Message-ID: <20191114095345.GA3688@mazu> References: <20191105091949.29559-1-mchang@suse.com> <20191107115235.pxkvffcohbsho443@tomti.i.net-space.pl> <20191113110050.omph6xptgsc2ppe2@tomti.i.net-space.pl> In-Reply-To: <20191113110050.omph6xptgsc2ppe2@tomti.i.net-space.pl> Accept-Language: zh-TW, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK0PR03CA0106.apcprd03.prod.outlook.com (2603:1096:203:b0::22) 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: bd14d0cf-5077-4590-a305-08d768e88f34 x-ms-traffictypediagnostic: BY5PR18MB3154: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 02213C82F8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(7916004)(4636009)(39860400002)(346002)(136003)(376002)(366004)(396003)(189003)(199004)(186003)(25786009)(2906002)(66446008)(86362001)(33656002)(66946007)(66556008)(64756008)(66476007)(76176011)(102836004)(6486002)(55236004)(6436002)(81166006)(8936002)(52116002)(81156014)(80792005)(6506007)(386003)(229853002)(6246003)(4326008)(26005)(6306002)(8676002)(9686003)(6512007)(256004)(14444005)(6116002)(478600001)(3846002)(99286004)(7736002)(1076003)(305945005)(476003)(11346002)(486006)(446003)(71190400001)(71200400001)(6916009)(966005)(66066001)(14454004)(33716001)(54906003)(5660300002)(316002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY5PR18MB3154; H:BY5PR18MB3122.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: tUrXSuG/ObztNoN7MvkmG08dpLbkwBTi1oPayUEVxIYQn8HuFHVtNjaaNjNlJKgj4Ku3cNJZpRTslFzaPAd+axsFXvwXsXwtjiJ/Pmg6OTfzFzx9gJVMKyqNJQ8S+2wFQ0kvLmZXEj2VV0XNC33z6KmpKztip+UNtJfbFbsZ9/yHLiffXg/QPcFoV0jzo88HrAVsBqC1RzBI2iuuj65kpXLBhtVt9o9QixedtP5ATpzQN+j8ljQMU7ALQzHnZpch/TmrDzSB3V8ZKBMHmeav34KP7tkkuy5E9bdptocjfva4U2TA2mCaUug6d5wJ2F4Xd28dIl2NrbBLdnx5AYfm4825dWZgiB7cxGMDlsBcx3APYSJT3cRaRdbx3WyAZZZLG1wMKIghcxuuicug9JEWtMSrp4g0eqWF4++tfgCiJLQWC8mj6yid2SrPHfvodHhX Content-Type: text/plain; charset="us-ascii" Content-ID: <869337F3966C0347A5AB885FB38E7B27@namprd18.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: bd14d0cf-5077-4590-a305-08d768e88f34 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Nov 2019 09:53:54.3515 (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: kC+5G5gfpuitcacnyR8dZpIBu9mVjdlvYiMLOoNOHRpGDlI2hvx2+pH0fXB5Otmc X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR18MB3154 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.64.66 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, 14 Nov 2019 09:55:34 -0000 On Wed, Nov 13, 2019 at 12:00:50PM +0100, Daniel Kiper wrote: > On Thu, Nov 07, 2019 at 12:52:35PM +0100, Daniel Kiper wrote: > > 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. Not everybody uses btrfs > > > embedded area. I recommend not to use it. Using mbr gap or BBP is the > > > recommended way. > > > > I will put the cat among the pigeons. Maybe we should finally stop > > pretending that the GRUB supports small MBR gaps. Otherwise we will > > be fighting with such issues endlessly. >=20 > Bumping the thread... Nobody objects? Hmmm... I don't think we are able to give up MBR gap support, simply because no other way out in creating the area for bootloader embedding. However we should consider to correct this claim in manual. "You must ensure that the first partition starts at least 31 KiB (63 sectors) from the start of the disk" to reflect the fact that 31 KiB is no longer applicable and the ideal size should be above 1MB (or such). You should go check with your disk tools to find the suitable parameter to fulfill the requirement, for eg, the partition alignment would mostly affect this. Thanks, Michael >=20 > > Daniel > > > > > 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 v= endor > > > > 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 >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel