diff mbox series

[15/16] support/testing: update logical eraseblock and physical eraseblock size for qemu >= 2.9

Message ID 20210912141140.253778-13-romain.naour@gmail.com
State Accepted
Headers show
Series [01/16] support/testing: test_file_capabilities: bump to kernel 4.19.204 | expand

Commit Message

Romain Naour Sept. 12, 2021, 2:11 p.m. UTC
The current ubi/ubifs test (test_ubi.py) rely on a Qemu bug present in
2.8.0 that was fixed in Qemu 2.9.0 [1]. The ubi/ubifs settings is
updated to run with Qemu >= 2.9.0 using the new multiple chip handling.

If needed, the old behavior can be enabled using the pflash01 property
"old-multiple-chip-handling" [2].

The issue was not detected until now since we are sill using an old
qemu (2.8 from Debian stretch) for testing in gitlab (using the
Buildroot Docker image used by gitlab-ci.yml).

First the logical eraseblock size (LEB) must be updated to the value
0x3ff80 reported by the kernel when using qemu >= 2.9.0.

  UBIFS (ubi0:0): Mounting in unauthenticated mode
  UBIFS error (ubi0:0 pid 1): ubifs_read_superblock: LEB size mismatch: 524160 in superblock, 262016 real
  UBIFS error (ubi0:0 pid 1): ubifs_read_superblock: bad superblock, error 1

But the system is still failing to boot:

 UBIFS error (ubi0:0 pid 1): ubifs_scan: garbage
 UBIFS error (ubi0:0 pid 1): ubifs_recover_master_node: failed to recover master node

ubifs is reading garbage since Qemu >= 2.9.0 report a sector
length per device divided by the number of devices (see commit [1]).

The kernel detect two flash devices (dmesg):

  Concatenating MTD devices:
  (0): "40000000.flash"
  (1): "40000000.flash"
  into device "40000000.flash"

Divide the physical eraseblock (PEB) size by two.

Tested with qemu 2.9.0, 5.1.0.

Fixes:
https://gitlab.com/kubu93/buildroot/-/jobs/1543100932

[1] https://git.qemu.org/?p=qemu.git;a=commitdiff;h=feb0b1aa11f14ee71660aba46b46387d1f923c9e
[2] http://lists.busybox.net/pipermail/buildroot/2021-September/622069.html

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 support/testing/tests/fs/test_ubi.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Yann E. MORIN Oct. 17, 2021, 7:51 p.m. UTC | #1
Romain, All,

On 2021-09-12 16:11 +0200, Romain Naour spake thusly:
> The current ubi/ubifs test (test_ubi.py) rely on a Qemu bug present in
> 2.8.0 that was fixed in Qemu 2.9.0 [1]. The ubi/ubifs settings is
> updated to run with Qemu >= 2.9.0 using the new multiple chip handling.
> 
> If needed, the old behavior can be enabled using the pflash01 property
> "old-multiple-chip-handling" [2].
> 
> The issue was not detected until now since we are sill using an old
> qemu (2.8 from Debian stretch) for testing in gitlab (using the
> Buildroot Docker image used by gitlab-ci.yml).
> 
> First the logical eraseblock size (LEB) must be updated to the value
> 0x3ff80 reported by the kernel when using qemu >= 2.9.0.
> 
>   UBIFS (ubi0:0): Mounting in unauthenticated mode
>   UBIFS error (ubi0:0 pid 1): ubifs_read_superblock: LEB size mismatch: 524160 in superblock, 262016 real
>   UBIFS error (ubi0:0 pid 1): ubifs_read_superblock: bad superblock, error 1
> 
> But the system is still failing to boot:
> 
>  UBIFS error (ubi0:0 pid 1): ubifs_scan: garbage
>  UBIFS error (ubi0:0 pid 1): ubifs_recover_master_node: failed to recover master node
> 
> ubifs is reading garbage since Qemu >= 2.9.0 report a sector
> length per device divided by the number of devices (see commit [1]).
> 
> The kernel detect two flash devices (dmesg):
> 
>   Concatenating MTD devices:
>   (0): "40000000.flash"
>   (1): "40000000.flash"
>   into device "40000000.flash"
> 
> Divide the physical eraseblock (PEB) size by two.
> 
> Tested with qemu 2.9.0, 5.1.0.
> 
> Fixes:
> https://gitlab.com/kubu93/buildroot/-/jobs/1543100932
> 
> [1] https://git.qemu.org/?p=qemu.git;a=commitdiff;h=feb0b1aa11f14ee71660aba46b46387d1f923c9e
> [2] http://lists.busybox.net/pipermail/buildroot/2021-September/622069.html

I am not sure I understood that reference: the patch in [2] was never
applied, it is no longer present in patchwork, but I could not find a
discsuuion about it either... Did you withdraw that patch?

> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  support/testing/tests/fs/test_ubi.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/support/testing/tests/fs/test_ubi.py b/support/testing/tests/fs/test_ubi.py
> index eeb55b1d59..7c687c1982 100644
> --- a/support/testing/tests/fs/test_ubi.py
> +++ b/support/testing/tests/fs/test_ubi.py
> @@ -8,10 +8,10 @@ class TestUbi(infra.basetest.BRTest):
>      config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
>          """
>          BR2_TARGET_ROOTFS_UBIFS=y
> -        BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x7ff80
> +        BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x3ff80
>          BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x1
>          BR2_TARGET_ROOTFS_UBI=y
> -        BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x80000
> +        BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x40000
>          BR2_TARGET_ROOTFS_UBI_SUBSIZE=1
>          """
>  
> -- 
> 2.31.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@lists.buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Romain Naour Oct. 17, 2021, 8:05 p.m. UTC | #2
Hello Yann,

Le 17/10/2021 à 21:51, Yann E. MORIN a écrit :
> Romain, All,
> 
> On 2021-09-12 16:11 +0200, Romain Naour spake thusly:
>> The current ubi/ubifs test (test_ubi.py) rely on a Qemu bug present in
>> 2.8.0 that was fixed in Qemu 2.9.0 [1]. The ubi/ubifs settings is
>> updated to run with Qemu >= 2.9.0 using the new multiple chip handling.
>>
>> If needed, the old behavior can be enabled using the pflash01 property
>> "old-multiple-chip-handling" [2].
>>
>> The issue was not detected until now since we are sill using an old
>> qemu (2.8 from Debian stretch) for testing in gitlab (using the
>> Buildroot Docker image used by gitlab-ci.yml).
>>
>> First the logical eraseblock size (LEB) must be updated to the value
>> 0x3ff80 reported by the kernel when using qemu >= 2.9.0.
>>
>>   UBIFS (ubi0:0): Mounting in unauthenticated mode
>>   UBIFS error (ubi0:0 pid 1): ubifs_read_superblock: LEB size mismatch: 524160 in superblock, 262016 real
>>   UBIFS error (ubi0:0 pid 1): ubifs_read_superblock: bad superblock, error 1
>>
>> But the system is still failing to boot:
>>
>>  UBIFS error (ubi0:0 pid 1): ubifs_scan: garbage
>>  UBIFS error (ubi0:0 pid 1): ubifs_recover_master_node: failed to recover master node
>>
>> ubifs is reading garbage since Qemu >= 2.9.0 report a sector
>> length per device divided by the number of devices (see commit [1]).
>>
>> The kernel detect two flash devices (dmesg):
>>
>>   Concatenating MTD devices:
>>   (0): "40000000.flash"
>>   (1): "40000000.flash"
>>   into device "40000000.flash"
>>
>> Divide the physical eraseblock (PEB) size by two.
>>
>> Tested with qemu 2.9.0, 5.1.0.
>>
>> Fixes:
>> https://gitlab.com/kubu93/buildroot/-/jobs/1543100932
>>
>> [1] https://git.qemu.org/?p=qemu.git;a=commitdiff;h=feb0b1aa11f14ee71660aba46b46387d1f923c9e
>> [2] http://lists.busybox.net/pipermail/buildroot/2021-September/622069.html
> 
> I am not sure I understood that reference: the patch in [2] was never
> applied, it is no longer present in patchwork, but I could not find a
> discsuuion about it either... Did you withdraw that patch?

Yes, the patch [2] was a first attempt to fix the issue.
Thanks to this patch, it's not needed anymore.

Best regards,
Romain


> 
>> Signed-off-by: Romain Naour <romain.naour@gmail.com>
>> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> 
> Applied to master, thanks.
> 
> Regards,
> Yann E. MORIN.
> 
>> ---
>>  support/testing/tests/fs/test_ubi.py | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/support/testing/tests/fs/test_ubi.py b/support/testing/tests/fs/test_ubi.py
>> index eeb55b1d59..7c687c1982 100644
>> --- a/support/testing/tests/fs/test_ubi.py
>> +++ b/support/testing/tests/fs/test_ubi.py
>> @@ -8,10 +8,10 @@ class TestUbi(infra.basetest.BRTest):
>>      config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
>>          """
>>          BR2_TARGET_ROOTFS_UBIFS=y
>> -        BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x7ff80
>> +        BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x3ff80
>>          BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x1
>>          BR2_TARGET_ROOTFS_UBI=y
>> -        BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x80000
>> +        BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x40000
>>          BR2_TARGET_ROOTFS_UBI_SUBSIZE=1
>>          """
>>  
>> -- 
>> 2.31.1
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot@lists.buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot
>
diff mbox series

Patch

diff --git a/support/testing/tests/fs/test_ubi.py b/support/testing/tests/fs/test_ubi.py
index eeb55b1d59..7c687c1982 100644
--- a/support/testing/tests/fs/test_ubi.py
+++ b/support/testing/tests/fs/test_ubi.py
@@ -8,10 +8,10 @@  class TestUbi(infra.basetest.BRTest):
     config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
         """
         BR2_TARGET_ROOTFS_UBIFS=y
-        BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x7ff80
+        BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x3ff80
         BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x1
         BR2_TARGET_ROOTFS_UBI=y
-        BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x80000
+        BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x40000
         BR2_TARGET_ROOTFS_UBI_SUBSIZE=1
         """