2021-06-10 05:25:20

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH] fs: btrfs: Disable BTRFS on platforms having 256K pages

With a config having PAGE_SIZE set to 256K, BTRFS build fails
with the following message

include/linux/compiler_types.h:326:38: error: call to '__compiletime_assert_791' declared with attribute error: BUILD_BUG_ON failed: (BTRFS_MAX_COMPRESSED % PAGE_SIZE) != 0

BTRFS_MAX_COMPRESSED being 128K, BTRFS cannot support platforms with
256K pages at the time being.

There are two platforms that can select 256K pages:
- hexagon
- powerpc

Disable BTRFS when 256K page size is selected.

Reported-by: kernel test robot <[email protected]>
Signed-off-by: Christophe Leroy <[email protected]>
---
fs/btrfs/Kconfig | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/btrfs/Kconfig b/fs/btrfs/Kconfig
index 68b95ad82126..520a0f6a7d9e 100644
--- a/fs/btrfs/Kconfig
+++ b/fs/btrfs/Kconfig
@@ -18,6 +18,8 @@ config BTRFS_FS
select RAID6_PQ
select XOR_BLOCKS
select SRCU
+ depends on !PPC_256K_PAGES # powerpc
+ depends on !PAGE_SIZE_256KB # hexagon

help
Btrfs is a general purpose copy-on-write filesystem with extents,
--
2.25.0


2021-06-10 13:56:45

by Chris Mason

[permalink] [raw]
Subject: Re: [PATCH] btrfs: Disable BTRFS on platforms having 256K pages


> On Jun 10, 2021, at 1:23 AM, Christophe Leroy <[email protected]> wrote:
>
> With a config having PAGE_SIZE set to 256K, BTRFS build fails
> with the following message
>
> include/linux/compiler_types.h:326:38: error: call to '__compiletime_assert_791' declared with attribute error: BUILD_BUG_ON failed: (BTRFS_MAX_COMPRESSED % PAGE_SIZE) != 0
>
> BTRFS_MAX_COMPRESSED being 128K, BTRFS cannot support platforms with
> 256K pages at the time being.
>
> There are two platforms that can select 256K pages:
> - hexagon
> - powerpc
>
> Disable BTRFS when 256K page size is selected.
>

We’ll have other subpage blocksize concerns with 256K pages, but this BTRFS_MAX_COMPRESSED #define is arbitrary. It’s just trying to have an upper bound on the amount of memory we’ll need to uncompress a single page’s worth of random reads.

We could change it to max(PAGE_SIZE, 128K) or just bump to 256K.

-chris

2021-06-10 14:54:52

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH] btrfs: Disable BTRFS on platforms having 256K pages



Le 10/06/2021 à 15:54, Chris Mason a écrit :
>
>> On Jun 10, 2021, at 1:23 AM, Christophe Leroy <[email protected]> wrote:
>>
>> With a config having PAGE_SIZE set to 256K, BTRFS build fails
>> with the following message
>>
>> include/linux/compiler_types.h:326:38: error: call to '__compiletime_assert_791' declared with attribute error: BUILD_BUG_ON failed: (BTRFS_MAX_COMPRESSED % PAGE_SIZE) != 0
>>
>> BTRFS_MAX_COMPRESSED being 128K, BTRFS cannot support platforms with
>> 256K pages at the time being.
>>
>> There are two platforms that can select 256K pages:
>> - hexagon
>> - powerpc
>>
>> Disable BTRFS when 256K page size is selected.
>>
>
> We’ll have other subpage blocksize concerns with 256K pages, but this BTRFS_MAX_COMPRESSED #define is arbitrary. It’s just trying to have an upper bound on the amount of memory we’ll need to uncompress a single page’s worth of random reads.
>
> We could change it to max(PAGE_SIZE, 128K) or just bump to 256K.
>

But if 256K is problematic in other ways, is it worth bumping BTRFS_MAX_COMPRESSED to 256K ?

David, in below mail, said that 256K support would require deaper changes. So disabling BTRFS
support seems the easiest solution for the time being, at least for Stable (I forgot the Fixes: tag
and the CC: to stable).

On powerpc, 256k pages is a corner case, it requires customised binutils, so I don't think disabling
BTRFS is a issue there. For hexagon I don't know.


https://lkml.org/lkml/2021/6/9/978

Le 09/06/2021 à 17:22, David Sterba a écrit :
> On Wed, Jun 09, 2021 at 04:01:20PM +0200, Christophe Leroy wrote:
>> Le 09/06/2021 à 15:55, kernel test robot a écrit :
>>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>> head: 368094df48e680fa51cedb68537408cfa64b788e
>>> commit: 4eeef098b43242ed145c83fba9989d586d707589 powerpc/44x: Remove STDBINUTILS kconfig option
>>> date: 4 months ago
>>> config: powerpc-randconfig-r012-20210609 (attached as .config)
>>> compiler: powerpc-linux-gcc (GCC) 9.3.0
>>
>> That's a BTRFS issue, and not directly linked to the above mentioned commit. Before that commit the
>> problem was already present.
>>
>> Problem is that with 256k PAGE_SIZE, following BUILD_BUG() pops up:
>>
>> BUILD_BUG_ON((BTRFS_MAX_COMPRESSED % PAGE_SIZE) != 0)
>
> A 256K page is a problem for btrfs, until now I was not even aware
> there's an architecture supporting that so. That the build fails is
> probably best thing. Maximum metadata nodesize supported is 64K and
> having that on a 256K page would need deeper changes, no top of the
> currently developed subpage changes (that do 4K blocks on 64K pages).
>

2021-06-10 16:25:23

by David Sterba

[permalink] [raw]
Subject: Re: [PATCH] btrfs: Disable BTRFS on platforms having 256K pages

On Thu, Jun 10, 2021 at 04:50:09PM +0200, Christophe Leroy wrote:
>
>
> Le 10/06/2021 à 15:54, Chris Mason a écrit :
> >
> >> On Jun 10, 2021, at 1:23 AM, Christophe Leroy <[email protected]> wrote:
> >>
> >> With a config having PAGE_SIZE set to 256K, BTRFS build fails
> >> with the following message
> >>
> >> include/linux/compiler_types.h:326:38: error: call to '__compiletime_assert_791' declared with attribute error: BUILD_BUG_ON failed: (BTRFS_MAX_COMPRESSED % PAGE_SIZE) != 0
> >>
> >> BTRFS_MAX_COMPRESSED being 128K, BTRFS cannot support platforms with
> >> 256K pages at the time being.
> >>
> >> There are two platforms that can select 256K pages:
> >> - hexagon
> >> - powerpc
> >>
> >> Disable BTRFS when 256K page size is selected.
> >>
> >
> > We’ll have other subpage blocksize concerns with 256K pages, but this BTRFS_MAX_COMPRESSED #define is arbitrary. It’s just trying to have an upper bound on the amount of memory we’ll need to uncompress a single page’s worth of random reads.
> >
> > We could change it to max(PAGE_SIZE, 128K) or just bump to 256K.
> >
>
> But if 256K is problematic in other ways, is it worth bumping BTRFS_MAX_COMPRESSED to 256K ?
>
> David, in below mail, said that 256K support would require deaper changes. So disabling BTRFS
> support seems the easiest solution for the time being, at least for Stable (I forgot the Fixes: tag
> and the CC: to stable).
>
> On powerpc, 256k pages is a corner case, it requires customised binutils, so I don't think disabling
> BTRFS is a issue there. For hexagon I don't know.

That it blew up due to the max compressed size is a coincidence. We
could have explicit BUILD_BUG_ONs for page size or other constraints
derived from the page size like INLINE_EXTENT_BUFFER_PAGES.

And there's no such thing like "just bump BTRFS_MAX_COMPRESSED to 256K".
The constant is part of on-disk format for lzo and otherwise changing it
would impact performance so this would need proper evaluation.

2021-06-11 12:39:05

by David Sterba

[permalink] [raw]
Subject: Re: [PATCH] fs: btrfs: Disable BTRFS on platforms having 256K pages

On Thu, Jun 10, 2021 at 05:23:02AM +0000, Christophe Leroy wrote:
> With a config having PAGE_SIZE set to 256K, BTRFS build fails
> with the following message
>
> include/linux/compiler_types.h:326:38: error: call to '__compiletime_assert_791' declared with attribute error: BUILD_BUG_ON failed: (BTRFS_MAX_COMPRESSED % PAGE_SIZE) != 0
>
> BTRFS_MAX_COMPRESSED being 128K, BTRFS cannot support platforms with
> 256K pages at the time being.
>
> There are two platforms that can select 256K pages:
> - hexagon
> - powerpc
>
> Disable BTRFS when 256K page size is selected.
>
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: Christophe Leroy <[email protected]>

With updated changelog added to misc-next, thanks.

2021-06-11 13:01:09

by Chris Mason

[permalink] [raw]
Subject: Re: [PATCH] btrfs: Disable BTRFS on platforms having 256K pages


> On Jun 10, 2021, at 12:20 PM, David Sterba <[email protected]> wrote:
>
> On Thu, Jun 10, 2021 at 04:50:09PM +0200, Christophe Leroy wrote:
>>
>>
>> Le 10/06/2021 à 15:54, Chris Mason a écrit :
>>>
>>>> On Jun 10, 2021, at 1:23 AM, Christophe Leroy <[email protected]> wrote:
>>>>
>>>> With a config having PAGE_SIZE set to 256K, BTRFS build fails
>>>> with the following message
>>>>
>>>> include/linux/compiler_types.h:326:38: error: call to '__compiletime_assert_791' declared with attribute error: BUILD_BUG_ON failed: (BTRFS_MAX_COMPRESSED % PAGE_SIZE) != 0
>>>>
>>>> BTRFS_MAX_COMPRESSED being 128K, BTRFS cannot support platforms with
>>>> 256K pages at the time being.
>>>>
>>>> There are two platforms that can select 256K pages:
>>>> - hexagon
>>>> - powerpc
>>>>
>>>> Disable BTRFS when 256K page size is selected.
>>>>
>>>
>>> We’ll have other subpage blocksize concerns with 256K pages, but this BTRFS_MAX_COMPRESSED #define is arbitrary. It’s just trying to have an upper bound on the amount of memory we’ll need to uncompress a single page’s worth of random reads.
>>>
>>> We could change it to max(PAGE_SIZE, 128K) or just bump to 256K.
>>>
>>
>> But if 256K is problematic in other ways, is it worth bumping BTRFS_MAX_COMPRESSED to 256K ?
>>
>> David, in below mail, said that 256K support would require deaper changes. So disabling BTRFS
>> support seems the easiest solution for the time being, at least for Stable (I forgot the Fixes: tag
>> and the CC: to stable).
>>
>> On powerpc, 256k pages is a corner case, it requires customised binutils, so I don't think disabling
>> BTRFS is a issue there. For hexagon I don't know.
>
> That it blew up due to the max compressed size is a coincidence. We
> could have explicit BUILD_BUG_ONs for page size or other constraints
> derived from the page size like INLINE_EXTENT_BUFFER_PAGES.
>

Right, the constraint is bigger and more complex than BTRFS_MAX_COMPRESSED.

> And there's no such thing like "just bump BTRFS_MAX_COMPRESSED to 256K".
> The constant is part of on-disk format for lzo and otherwise changing it
> would impact performance so this would need proper evaluation.

Sorry, how is it baked into LZO? It definitely will have performance implications, I agree there.

-chris

2021-06-11 13:25:50

by David Sterba

[permalink] [raw]
Subject: Re: [PATCH] btrfs: Disable BTRFS on platforms having 256K pages

On Fri, Jun 11, 2021 at 12:58:58PM +0000, Chris Mason wrote:
> > On Jun 10, 2021, at 12:20 PM, David Sterba <[email protected]> wrote:
> > On Thu, Jun 10, 2021 at 04:50:09PM +0200, Christophe Leroy wrote:
> >> Le 10/06/2021 ? 15:54, Chris Mason a ?crit :
> >>>> On Jun 10, 2021, at 1:23 AM, Christophe Leroy <[email protected]> wrote:
> > And there's no such thing like "just bump BTRFS_MAX_COMPRESSED to 256K".
> > The constant is part of on-disk format for lzo and otherwise changing it
> > would impact performance so this would need proper evaluation.
>
> Sorry, how is it baked into LZO? It definitely will have performance implications, I agree there.

lzo_decompress_bio:

309 /*
310 * Compressed data header check.
311 *
312 * The real compressed size can't exceed the maximum extent length, and
313 * all pages should be used (whole unused page with just the segment
314 * header is not possible). If this happens it means the compressed
315 * extent is corrupted.
316 */
317 if (tot_len > min_t(size_t, BTRFS_MAX_COMPRESSED, srclen) ||
318 tot_len < srclen - PAGE_SIZE) {
319 ret = -EUCLEAN;
320 goto done;
321 }

2021-06-11 13:49:24

by Qu Wenruo

[permalink] [raw]
Subject: Re: [PATCH] fs: btrfs: Disable BTRFS on platforms having 256K pages



On 2021/6/10 下午1:23, Christophe Leroy wrote:
> With a config having PAGE_SIZE set to 256K, BTRFS build fails
> with the following message
>
> include/linux/compiler_types.h:326:38: error: call to '__compiletime_assert_791' declared with attribute error: BUILD_BUG_ON failed: (BTRFS_MAX_COMPRESSED % PAGE_SIZE) != 0
>
> BTRFS_MAX_COMPRESSED being 128K, BTRFS cannot support platforms with
> 256K pages at the time being.
>
> There are two platforms that can select 256K pages:
> - hexagon
> - powerpc
>
> Disable BTRFS when 256K page size is selected.
>
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: Christophe Leroy <[email protected]>
> ---
> fs/btrfs/Kconfig | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/btrfs/Kconfig b/fs/btrfs/Kconfig
> index 68b95ad82126..520a0f6a7d9e 100644
> --- a/fs/btrfs/Kconfig
> +++ b/fs/btrfs/Kconfig
> @@ -18,6 +18,8 @@ config BTRFS_FS
> select RAID6_PQ
> select XOR_BLOCKS
> select SRCU
> + depends on !PPC_256K_PAGES # powerpc
> + depends on !PAGE_SIZE_256KB # hexagon

I'm OK to disable page size other than 4K, 16K, 32K, 64K for now.

Although for other reasons.

Not only for the BUILD_BUG_ON(), but for the fact that btrfs only
support 4K, 16K, 32K, 64K sectorsize, and requires PAGE_SIZE == sectorsize.

Although we're adding subpage support, the subpage support only comes
with 4K sectorsize on 64K page size.

Until variable length version is introduced, 256K/128K page size won't
be support.

Thus I'm fine to disable BTRFS for any arch outside of the supported
page sizes for now.

Thanks,
Qu
>
> help
> Btrfs is a general purpose copy-on-write filesystem with extents,
>

2021-06-11 17:00:32

by Chris Mason

[permalink] [raw]
Subject: Re: [PATCH] btrfs: Disable BTRFS on platforms having 256K pages


> On Jun 11, 2021, at 9:21 AM, David Sterba <[email protected]> wrote:
>
> On Fri, Jun 11, 2021 at 12:58:58PM +0000, Chris Mason wrote:
>>> On Jun 10, 2021, at 12:20 PM, David Sterba <[email protected]> wrote:
>>> On Thu, Jun 10, 2021 at 04:50:09PM +0200, Christophe Leroy wrote:
>>>> Le 10/06/2021 à 15:54, Chris Mason a écrit :
>>>>>> On Jun 10, 2021, at 1:23 AM, Christophe Leroy <[email protected]> wrote:
>>> And there's no such thing like "just bump BTRFS_MAX_COMPRESSED to 256K".
>>> The constant is part of on-disk format for lzo and otherwise changing it
>>> would impact performance so this would need proper evaluation.
>>
>> Sorry, how is it baked into LZO? It definitely will have performance implications, I agree there.
>
> lzo_decompress_bio:
>
> 309 /*
> 310 * Compressed data header check.
> 311 *
> 312 * The real compressed size can't exceed the maximum extent length, and
> 313 * all pages should be used (whole unused page with just the segment
> 314 * header is not possible). If this happens it means the compressed
> 315 * extent is corrupted.
> 316 */
> 317 if (tot_len > min_t(size_t, BTRFS_MAX_COMPRESSED, srclen) ||
> 318 tot_len < srclen - PAGE_SIZE) {
> 319 ret = -EUCLEAN;
> 320 goto done;
> 321 }

Ah I see, so going back to an old LZO kernel will get upset. Ok, fair enough. So if we want to bump this for other reasons, we’ll need to make an LZO max size to maintain compatibility.

-chris

2021-06-12 14:47:56

by Brian Cain

[permalink] [raw]
Subject: RE: [PATCH] btrfs: Disable BTRFS on platforms having 256K pages



> -----Original Message-----
> From: Christophe Leroy <[email protected]>
...
> Le 10/06/2021 à 15:54, Chris Mason a écrit :
> >
> >> On Jun 10, 2021, at 1:23 AM, Christophe Leroy
> <[email protected]> wrote:
> >>
> >> With a config having PAGE_SIZE set to 256K, BTRFS build fails
> >> with the following message
> >>
> >> include/linux/compiler_types.h:326:38: error: call to
> '__compiletime_assert_791' declared with attribute error: BUILD_BUG_ON
> failed: (BTRFS_MAX_COMPRESSED % PAGE_SIZE) != 0
> >>
> >> BTRFS_MAX_COMPRESSED being 128K, BTRFS cannot support platforms
> with
> >> 256K pages at the time being.
> >>
> >> There are two platforms that can select 256K pages:
> >> - hexagon
> >> - powerpc
> >>
> >> Disable BTRFS when 256K page size is selected.
> >>
> >
> > We’ll have other subpage blocksize concerns with 256K pages, but this
> BTRFS_MAX_COMPRESSED #define is arbitrary. It’s just trying to have an
> upper bound on the amount of memory we’ll need to uncompress a single
> page’s worth of random reads.
> >
> > We could change it to max(PAGE_SIZE, 128K) or just bump to 256K.
> >
>
> But if 256K is problematic in other ways, is it worth bumping
> BTRFS_MAX_COMPRESSED to 256K ?
>
> David, in below mail, said that 256K support would require deaper changes. So
> disabling BTRFS
> support seems the easiest solution for the time being, at least for Stable (I
> forgot the Fixes: tag
> and the CC: to stable).
>
> On powerpc, 256k pages is a corner case, it requires customised binutils, so I
> don't think disabling
> BTRFS is a issue there. For hexagon I don't know.

Larger page sizes like this are typical for hexagon. Disabling btrfs on hexagon seems appropriate.

-Brian