all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64
@ 2019-01-21 19:48 Vagrant Cascadian
  2019-01-23 10:54 ` Ludovic Courtès
  2019-01-23 20:58 ` Mark H Weaver
  0 siblings, 2 replies; 19+ messages in thread
From: Vagrant Cascadian @ 2019-01-21 19:48 UTC (permalink / raw)
  To: 34162

[-- Attachment #1: Type: text/plain, Size: 1416 bytes --]

After upgrading to linux-libre 4.20, and again tested with 4.20.3, an
aarch64 system failed to boot (using 4.19.10 worked fine):

[    3.692351] device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com
ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /dev/sda6 is mounted.
/dev/sda6: clean, 596262/6553600 files, 7663147/26214400 blocks
[    3.948786] EXT4-fs (sda6): Cannot load crc32c driver.
ERROR: In procedure mount:
In procedure mount: No such file or directory

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
GNU Guile 2.2.4
Copyright (C) 1995-2017 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)>

Workaround or fix was to add to config.scm:

(initrd (append (list "crc32c_generic" ... ) %base-initrd-modules))


4.19.10 and earlier worked fine without this addition; as far as I can
see the relevent kernel configurations are all present; but some
behavior changed with the ext4 driver; Is the initrd no longer including
soft module dependencies? (e.g. for optional ext4 features)


This seems similar to Debian bug:

  https://bugs.debian.org/819725


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64
  2019-01-21 19:48 bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64 Vagrant Cascadian
@ 2019-01-23 10:54 ` Ludovic Courtès
  2019-01-23 17:48   ` Vagrant Cascadian
  2019-01-23 17:54   ` bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64 Efraim Flashner
  2019-01-23 20:58 ` Mark H Weaver
  1 sibling, 2 replies; 19+ messages in thread
From: Ludovic Courtès @ 2019-01-23 10:54 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 34162

Hi Vagrant,

Vagrant Cascadian <vagrant@debian.org> skribis:

> After upgrading to linux-libre 4.20, and again tested with 4.20.3, an
> aarch64 system failed to boot (using 4.19.10 worked fine):
>
> [    3.692351] device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com
> ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /dev/sda6 is mounted.
> /dev/sda6: clean, 596262/6553600 files, 7663147/26214400 blocks
> [    3.948786] EXT4-fs (sda6): Cannot load crc32c driver.
> ERROR: In procedure mount:
> In procedure mount: No such file or directory
>
> Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
> GNU Guile 2.2.4
> Copyright (C) 1995-2017 Free Software Foundation, Inc.
>
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
>
> Enter `,help' for help.
> scheme@(guile-user)>
>
> Workaround or fix was to add to config.scm:
>
> (initrd (append (list "crc32c_generic" ... ) %base-initrd-modules))

There are potentially two issues here:

  1. Why wasn’t crc32c_generic.ko automatically pulled in by the initrd
     build code?  Isn’t it a dependency of ext4.ko?

  2. Is crc32c_generic built-in in our x86_64 kernel config?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64
  2019-01-23 10:54 ` Ludovic Courtès
@ 2019-01-23 17:48   ` Vagrant Cascadian
  2019-01-25  8:59     ` Ludovic Courtès
  2019-01-23 17:54   ` bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64 Efraim Flashner
  1 sibling, 1 reply; 19+ messages in thread
From: Vagrant Cascadian @ 2019-01-23 17:48 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 34162

[-- Attachment #1: Type: text/plain, Size: 2325 bytes --]

On 2019-01-23, Ludovic Courtès wrote:
> Vagrant Cascadian <vagrant@debian.org> skribis:
>> After upgrading to linux-libre 4.20, and again tested with 4.20.3, an
>> aarch64 system failed to boot (using 4.19.10 worked fine):
>>
>> [    3.692351] device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com
>> ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /dev/sda6 is mounted.
>> /dev/sda6: clean, 596262/6553600 files, 7663147/26214400 blocks
>> [    3.948786] EXT4-fs (sda6): Cannot load crc32c driver.
>> ERROR: In procedure mount:
>> In procedure mount: No such file or directory
...
>> Workaround or fix was to add to config.scm:
>>
>> (initrd (append (list "crc32c_generic" ... ) %base-initrd-modules))
>
> There are potentially two issues here:
>
>   1. Why wasn’t crc32c_generic.ko automatically pulled in by the initrd
>      build code?  Isn’t it a dependency of ext4.ko?

It is not a hard dependency, no. It's an optional feature only needed if
certain ext4 features are enabled on the filesystem (maybe metadata_csum
in this case?). So it's listed as a MODULE_SOFTDEP of ext4:

  fs/ext4/super.c:MODULE_SOFTDEP("pre: crc32c");


>   2. Is crc32c_generic built-in in our x86_64 kernel config?

On x86_64:

$ grep CRC32 /gnu/store/*linux-libre*4.20.4*/.config
CONFIG_CRYPTO_CRC32C=y
CONFIG_CRYPTO_CRC32C_INTEL=y
CONFIG_CRYPTO_CRC32=m
CONFIG_CRYPTO_CRC32_PCLMUL=m
CONFIG_CRC32=y
# CONFIG_CRC32_SELFTEST is not set
CONFIG_CRC32_SLICEBY8=y
# CONFIG_CRC32_SLICEBY4 is not set
# CONFIG_CRC32_SARWATE is not set
# CONFIG_CRC32_BIT is not set
CONFIG_LIBCRC32C=m

On aarch64:

$ grep CRC32 /gnu/store/*linux-libre*4.20.3*/.config
CONFIG_CRYPTO_CRC32C=m
CONFIG_CRYPTO_CRC32=m
CONFIG_CRC32=y
# CONFIG_CRC32_SELFTEST is not set
CONFIG_CRC32_SLICEBY8=y
# CONFIG_CRC32_SLICEBY4 is not set
# CONFIG_CRC32_SARWATE is not set
# CONFIG_CRC32_BIT is not set
CONFIG_LIBCRC32C=m

on aarch64 4.19.10 also contained:

CONFIG_CRYPTO_CRC32_ARM64_CE=y

Which is no longer available in 4.20.x upstream in commit
598b7d41e544322c8c4f3737ee8ddf905a44175e.

So my hunch is that crc32c-ce was used in 4.19.x, but 4.20.x needed the
generic crc32c implementation.


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64
  2019-01-23 10:54 ` Ludovic Courtès
  2019-01-23 17:48   ` Vagrant Cascadian
@ 2019-01-23 17:54   ` Efraim Flashner
  2019-01-23 17:57     ` Efraim Flashner
  1 sibling, 1 reply; 19+ messages in thread
From: Efraim Flashner @ 2019-01-23 17:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Vagrant Cascadian, 34162

[-- Attachment #1: Type: text/plain, Size: 5094 bytes --]

On Wed, Jan 23, 2019 at 11:54:31AM +0100, Ludovic Courtès wrote:
> Hi Vagrant,
> 
> Vagrant Cascadian <vagrant@debian.org> skribis:
> 
> > After upgrading to linux-libre 4.20, and again tested with 4.20.3, an
> > aarch64 system failed to boot (using 4.19.10 worked fine):
> >
> > [    3.692351] device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com
> > ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /dev/sda6 is mounted.
> > /dev/sda6: clean, 596262/6553600 files, 7663147/26214400 blocks
> > [    3.948786] EXT4-fs (sda6): Cannot load crc32c driver.
> > ERROR: In procedure mount:
> > In procedure mount: No such file or directory
> >
> > Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
> > GNU Guile 2.2.4
> > Copyright (C) 1995-2017 Free Software Foundation, Inc.
> >
> > Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> > This program is free software, and you are welcome to redistribute it
> > under certain conditions; type `,show c' for details.
> >
> > Enter `,help' for help.
> > scheme@(guile-user)>
> >
> > Workaround or fix was to add to config.scm:
> >
> > (initrd (append (list "crc32c_generic" ... ) %base-initrd-modules))
> 
> There are potentially two issues here:
> 
>   1. Why wasn’t crc32c_generic.ko automatically pulled in by the initrd
>      build code?  Isn’t it a dependency of ext4.ko?
> 
>   2. Is crc32c_generic built-in in our x86_64 kernel config?
> 
$ grep _CRC gnu/packages/aux-files/linux-libre/4.20-{x86_,arm}64.conf
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:# CONFIG_W1_SLAVE_DS2433_CRC is not set
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_PWM_CRC=y
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRC32C=y
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRC32C_INTEL=y
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRC32=m
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRC32_PCLMUL=m
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRCT10DIF=y
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRCT10DIF_PCLMUL=m
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC_CCITT=y
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC16=y
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC_T10DIF=y
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC_ITU_T=m
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC32=y
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:# CONFIG_CRC32_SELFTEST is not set
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC32_SLICEBY8=y
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:# CONFIG_CRC32_SLICEBY4 is not set
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:# CONFIG_CRC32_SARWATE is not set
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:# CONFIG_CRC32_BIT is not set
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC64=m
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:# CONFIG_CRC4 is not set
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC7=m
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC8=m
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_CRYPTO_CRCT10DIF_ARM64_CE is not set
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_W1_SLAVE_DS2433_CRC is not set
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRYPTO_CRC32C=m
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRYPTO_CRC32=m
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRYPTO_CRCT10DIF=y
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC_CCITT=m
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC16=m
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC_T10DIF=y
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC_ITU_T=m
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC32=y
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_CRC32_SELFTEST is not set
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC32_SLICEBY8=y
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_CRC32_SLICEBY4 is not set
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_CRC32_SARWATE is not set
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_CRC32_BIT is not set
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC64=m
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_CRC4 is not set
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC7=m
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC8=m

It looks like the only one that they share that is different is
CONFIG_CRYPTO_CRC32C

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64
  2019-01-23 17:54   ` bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64 Efraim Flashner
@ 2019-01-23 17:57     ` Efraim Flashner
  2019-01-25  8:49       ` Ludovic Courtès
  0 siblings, 1 reply; 19+ messages in thread
From: Efraim Flashner @ 2019-01-23 17:57 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Vagrant Cascadian, 34162

[-- Attachment #1: Type: text/plain, Size: 5912 bytes --]

On Wed, Jan 23, 2019 at 07:54:24PM +0200, Efraim Flashner wrote:
> On Wed, Jan 23, 2019 at 11:54:31AM +0100, Ludovic Courtès wrote:
> > Hi Vagrant,
> > 
> > Vagrant Cascadian <vagrant@debian.org> skribis:
> > 
> > > After upgrading to linux-libre 4.20, and again tested with 4.20.3, an
> > > aarch64 system failed to boot (using 4.19.10 worked fine):
> > >
> > > [    3.692351] device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com
> > > ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /dev/sda6 is mounted.
> > > /dev/sda6: clean, 596262/6553600 files, 7663147/26214400 blocks
> > > [    3.948786] EXT4-fs (sda6): Cannot load crc32c driver.
> > > ERROR: In procedure mount:
> > > In procedure mount: No such file or directory
> > >
> > > Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
> > > GNU Guile 2.2.4
> > > Copyright (C) 1995-2017 Free Software Foundation, Inc.
> > >
> > > Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> > > This program is free software, and you are welcome to redistribute it
> > > under certain conditions; type `,show c' for details.
> > >
> > > Enter `,help' for help.
> > > scheme@(guile-user)>
> > >
> > > Workaround or fix was to add to config.scm:
> > >
> > > (initrd (append (list "crc32c_generic" ... ) %base-initrd-modules))
> > 
> > There are potentially two issues here:
> > 
> >   1. Why wasn’t crc32c_generic.ko automatically pulled in by the initrd
> >      build code?  Isn’t it a dependency of ext4.ko?
> > 
> >   2. Is crc32c_generic built-in in our x86_64 kernel config?
> > 
> $ grep _CRC gnu/packages/aux-files/linux-libre/4.20-{x86_,arm}64.conf
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:# CONFIG_W1_SLAVE_DS2433_CRC is not set
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_PWM_CRC=y
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRC32C=y
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRC32C_INTEL=y
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRC32=m
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRC32_PCLMUL=m
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRCT10DIF=y
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRCT10DIF_PCLMUL=m
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC_CCITT=y
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC16=y
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC_T10DIF=y
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC_ITU_T=m
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC32=y
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:# CONFIG_CRC32_SELFTEST is not set
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC32_SLICEBY8=y
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:# CONFIG_CRC32_SLICEBY4 is not set
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:# CONFIG_CRC32_SARWATE is not set
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:# CONFIG_CRC32_BIT is not set
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC64=m
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:# CONFIG_CRC4 is not set
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC7=m
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRC8=m
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_CRYPTO_CRCT10DIF_ARM64_CE is not set
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_W1_SLAVE_DS2433_CRC is not set
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRYPTO_CRC32C=m
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRYPTO_CRC32=m
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRYPTO_CRCT10DIF=y
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC_CCITT=m
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC16=m
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC_T10DIF=y
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC_ITU_T=m
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC32=y
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_CRC32_SELFTEST is not set
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC32_SLICEBY8=y
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_CRC32_SLICEBY4 is not set
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_CRC32_SARWATE is not set
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_CRC32_BIT is not set
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC64=m
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:# CONFIG_CRC4 is not set
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC7=m
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRC8=m
> 
> It looks like the only one that they share that is different is
> CONFIG_CRYPTO_CRC32C
> 
Checked the others right after I sent the previous email:
$ grep _CRC32C gnu/packages/aux-files/linux-libre/4.20-*.conf
gnu/packages/aux-files/linux-libre/4.20-arm.conf:CONFIG_CRYPTO_CRC32C=y
gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRYPTO_CRC32C=m
gnu/packages/aux-files/linux-libre/4.20-i686.conf:CONFIG_CRYPTO_CRC32C=y
gnu/packages/aux-files/linux-libre/4.20-i686.conf:CONFIG_CRYPTO_CRC32C_INTEL=y
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRC32C=y
gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRC32C_INTEL=y


-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64
  2019-01-21 19:48 bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64 Vagrant Cascadian
  2019-01-23 10:54 ` Ludovic Courtès
@ 2019-01-23 20:58 ` Mark H Weaver
  2019-01-24  0:44   ` Vagrant Cascadian
  1 sibling, 1 reply; 19+ messages in thread
From: Mark H Weaver @ 2019-01-23 20:58 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 34162

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

Hi,

Vagrant Cascadian <vagrant@debian.org> writes:

> After upgrading to linux-libre 4.20, and again tested with 4.20.3, an
> aarch64 system failed to boot (using 4.19.10 worked fine):

[...]

> Workaround or fix was to add to config.scm:
>
> (initrd (append (list "crc32c_generic" ... ) %base-initrd-modules))

Here's a proposed (untested) patch.  Would you like to test it and see
if it eliminates the need for this workaround?

       Mark



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] gnu: linux-libre: Make CRYPTO_CRC32C a built-in on arm64 --]
[-- Type: text/x-patch, Size: 1634 bytes --]

From 20a57e861cff4dce40c4eb6c7344f12d1f283cf8 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Wed, 23 Jan 2019 01:20:30 -0500
Subject: [PATCH] gnu: linux-libre: Make CRYPTO_CRC32C a built-in on arm64.

Fixes <https://bugs.gnu.org/34162>
Reported by Vagrant Cascadian <vagrant@debian.org>

Note that CRYPTO_CRC32C was already a built-in in our default
configurations for other systems.

* gnu/packages/aux-files/linux-libre/4.20-arm64.conf,
gnu/packages/aux-files/linux-libre/4.19-arm64.conf
(CONFIG_CRYPTO_CRC32C): Change from 'm' to 'y'.
---
 gnu/packages/aux-files/linux-libre/4.19-arm64.conf | 2 +-
 gnu/packages/aux-files/linux-libre/4.20-arm64.conf | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/aux-files/linux-libre/4.19-arm64.conf b/gnu/packages/aux-files/linux-libre/4.19-arm64.conf
index ba6fa177b..73cd300c1 100644
--- a/gnu/packages/aux-files/linux-libre/4.19-arm64.conf
+++ b/gnu/packages/aux-files/linux-libre/4.19-arm64.conf
@@ -7860,7 +7860,7 @@ CONFIG_CRYPTO_VMAC=m
 #
 # Digest
 #
-CONFIG_CRYPTO_CRC32C=m
+CONFIG_CRYPTO_CRC32C=y
 CONFIG_CRYPTO_CRC32=m
 CONFIG_CRYPTO_CRCT10DIF=y
 CONFIG_CRYPTO_GHASH=m
diff --git a/gnu/packages/aux-files/linux-libre/4.20-arm64.conf b/gnu/packages/aux-files/linux-libre/4.20-arm64.conf
index 9e71cadf0..3833e3e36 100644
--- a/gnu/packages/aux-files/linux-libre/4.20-arm64.conf
+++ b/gnu/packages/aux-files/linux-libre/4.20-arm64.conf
@@ -7932,7 +7932,7 @@ CONFIG_CRYPTO_VMAC=m
 #
 # Digest
 #
-CONFIG_CRYPTO_CRC32C=m
+CONFIG_CRYPTO_CRC32C=y
 CONFIG_CRYPTO_CRC32=m
 CONFIG_CRYPTO_CRCT10DIF=y
 CONFIG_CRYPTO_GHASH=m
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64
  2019-01-23 20:58 ` Mark H Weaver
@ 2019-01-24  0:44   ` Vagrant Cascadian
  2019-01-24  4:02     ` Mark H Weaver
  0 siblings, 1 reply; 19+ messages in thread
From: Vagrant Cascadian @ 2019-01-24  0:44 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: 34162

[-- Attachment #1: Type: text/plain, Size: 2309 bytes --]

On 2019-01-23, Mark H Weaver wrote:
> Vagrant Cascadian <vagrant@debian.org> writes:
>
>> After upgrading to linux-libre 4.20, and again tested with 4.20.3, an
>> aarch64 system failed to boot (using 4.19.10 worked fine):
>
> [...]
>
>> Workaround or fix was to add to config.scm:
>>
>> (initrd (append (list "crc32c_generic" ... ) %base-initrd-modules))
>
> Here's a proposed (untested) patch.  Would you like to test it and see
> if it eliminates the need for this workaround?

It did, thanks!

live well,
  vagrant

> From 20a57e861cff4dce40c4eb6c7344f12d1f283cf8 Mon Sep 17 00:00:00 2001
> From: Mark H Weaver <mhw@netris.org>
> Date: Wed, 23 Jan 2019 01:20:30 -0500
> Subject: [PATCH] gnu: linux-libre: Make CRYPTO_CRC32C a built-in on arm64.
>
> Fixes <https://bugs.gnu.org/34162>
> Reported by Vagrant Cascadian <vagrant@debian.org>
>
> Note that CRYPTO_CRC32C was already a built-in in our default
> configurations for other systems.
>
> * gnu/packages/aux-files/linux-libre/4.20-arm64.conf,
> gnu/packages/aux-files/linux-libre/4.19-arm64.conf
> (CONFIG_CRYPTO_CRC32C): Change from 'm' to 'y'.
> ---
>  gnu/packages/aux-files/linux-libre/4.19-arm64.conf | 2 +-
>  gnu/packages/aux-files/linux-libre/4.20-arm64.conf | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/aux-files/linux-libre/4.19-arm64.conf b/gnu/packages/aux-files/linux-libre/4.19-arm64.conf
> index ba6fa177b..73cd300c1 100644
> --- a/gnu/packages/aux-files/linux-libre/4.19-arm64.conf
> +++ b/gnu/packages/aux-files/linux-libre/4.19-arm64.conf
> @@ -7860,7 +7860,7 @@ CONFIG_CRYPTO_VMAC=m
>  #
>  # Digest
>  #
> -CONFIG_CRYPTO_CRC32C=m
> +CONFIG_CRYPTO_CRC32C=y
>  CONFIG_CRYPTO_CRC32=m
>  CONFIG_CRYPTO_CRCT10DIF=y
>  CONFIG_CRYPTO_GHASH=m
> diff --git a/gnu/packages/aux-files/linux-libre/4.20-arm64.conf b/gnu/packages/aux-files/linux-libre/4.20-arm64.conf
> index 9e71cadf0..3833e3e36 100644
> --- a/gnu/packages/aux-files/linux-libre/4.20-arm64.conf
> +++ b/gnu/packages/aux-files/linux-libre/4.20-arm64.conf
> @@ -7932,7 +7932,7 @@ CONFIG_CRYPTO_VMAC=m
>  #
>  # Digest
>  #
> -CONFIG_CRYPTO_CRC32C=m
> +CONFIG_CRYPTO_CRC32C=y
>  CONFIG_CRYPTO_CRC32=m
>  CONFIG_CRYPTO_CRCT10DIF=y
>  CONFIG_CRYPTO_GHASH=m
> -- 
> 2.20.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64
  2019-01-24  0:44   ` Vagrant Cascadian
@ 2019-01-24  4:02     ` Mark H Weaver
  0 siblings, 0 replies; 19+ messages in thread
From: Mark H Weaver @ 2019-01-24  4:02 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 34162-done

Vagrant Cascadian <vagrant@debian.org> writes:

> On 2019-01-23, Mark H Weaver wrote:
>> Here's a proposed (untested) patch.  Would you like to test it and see
>> if it eliminates the need for this workaround?
>
> It did, thanks!

Okay, I pushed it to master, commit
ff0b73028c0bbbcbf352989ed3863947357c3bce.

I'm closing this bug report.

    Thanks!
      Mark

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64
  2019-01-23 17:57     ` Efraim Flashner
@ 2019-01-25  8:49       ` Ludovic Courtès
  0 siblings, 0 replies; 19+ messages in thread
From: Ludovic Courtès @ 2019-01-25  8:49 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: Vagrant Cascadian, 34162

Hello!

Efraim Flashner <efraim@flashner.co.il> skribis:

> Checked the others right after I sent the previous email:
> $ grep _CRC32C gnu/packages/aux-files/linux-libre/4.20-*.conf
> gnu/packages/aux-files/linux-libre/4.20-arm.conf:CONFIG_CRYPTO_CRC32C=y
> gnu/packages/aux-files/linux-libre/4.20-arm64.conf:CONFIG_CRYPTO_CRC32C=m
> gnu/packages/aux-files/linux-libre/4.20-i686.conf:CONFIG_CRYPTO_CRC32C=y
> gnu/packages/aux-files/linux-libre/4.20-i686.conf:CONFIG_CRYPTO_CRC32C_INTEL=y
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRC32C=y
> gnu/packages/aux-files/linux-libre/4.20-x86_64.conf:CONFIG_CRYPTO_CRC32C_INTEL=y

Oh, could this one be the culprit, Vagrant?

Ludo’.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64
  2019-01-23 17:48   ` Vagrant Cascadian
@ 2019-01-25  8:59     ` Ludovic Courtès
  2019-01-25 11:30       ` [bug#34195] [PATCH] linux-modules: Add module-soft-dependencies Danny Milosavljevic
  0 siblings, 1 reply; 19+ messages in thread
From: Ludovic Courtès @ 2019-01-25  8:59 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 34162

Hi,

Vagrant Cascadian <vagrant@debian.org> skribis:

> On 2019-01-23, Ludovic Courtès wrote:
>> Vagrant Cascadian <vagrant@debian.org> skribis:
>>> After upgrading to linux-libre 4.20, and again tested with 4.20.3, an
>>> aarch64 system failed to boot (using 4.19.10 worked fine):
>>>
>>> [    3.692351] device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com
>>> ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /dev/sda6 is mounted.
>>> /dev/sda6: clean, 596262/6553600 files, 7663147/26214400 blocks
>>> [    3.948786] EXT4-fs (sda6): Cannot load crc32c driver.
>>> ERROR: In procedure mount:
>>> In procedure mount: No such file or directory
> ...
>>> Workaround or fix was to add to config.scm:
>>>
>>> (initrd (append (list "crc32c_generic" ... ) %base-initrd-modules))
>>
>> There are potentially two issues here:
>>
>>   1. Why wasn’t crc32c_generic.ko automatically pulled in by the initrd
>>      build code?  Isn’t it a dependency of ext4.ko?
>
> It is not a hard dependency, no. It's an optional feature only needed if
> certain ext4 features are enabled on the filesystem (maybe metadata_csum
> in this case?). So it's listed as a MODULE_SOFTDEP of ext4:
>
>   fs/ext4/super.c:MODULE_SOFTDEP("pre: crc32c");

Interesting.  Should we add support for soft dependencies in (gnu build
linux-modules), and pull in soft dependencies in the initrd?  Currently
we only do that for hard dependencies.

That wouldn’t help in this case since ext4 is built-in.  So my guess is
that for this particular case we should probably just change the AArch64
kernel config so it matches the x86 ones.

Thoughts?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#34195] [PATCH] linux-modules: Add module-soft-dependencies.
  2019-01-25  8:59     ` Ludovic Courtès
@ 2019-01-25 11:30       ` Danny Milosavljevic
  2019-01-25 11:48         ` [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies Danny Milosavljevic
  0 siblings, 1 reply; 19+ messages in thread
From: Danny Milosavljevic @ 2019-01-25 11:30 UTC (permalink / raw)
  To: 34195, ludo

* gnu/build/linux-modules.scm (not-softdep-whitespace): New variable.
(module-soft-dependencies): New procedure.
---
 gnu/build/linux-modules.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 2d8117504..631c5f577 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -33,6 +33,7 @@
             ensure-dot-ko
             module-aliases
             module-dependencies
+            module-soft-dependencies
             normalize-module-name
             file-name->module-name
             find-module-file
@@ -100,6 +101,42 @@ contains module names, not actual file names."
       (('depends . what)
        (string-tokenize what %not-comma)))))
 
+(define not-softdep-whitespace
+  (char-set-complement (char-set #\space #\tab)))
+
+(define (module-soft-dependencies file)
+  "Return the list of soft dependencies of module FILE."
+  (define (add-to-first-acons value alist)
+    (match alist
+      (((k . v) . b)
+       (cons (cons k (cons value v)) b))))
+
+  ;; TEXT: "pre: baz blubb foo post: bax bar"
+  (define (parse-softdep text)
+    (let loop ((value '())
+               (tokens (string-tokenize text not-softdep-whitespace))
+               (section #f))
+      (match tokens
+       ((token _ ...)
+        (if (string=? (string-take-right token 1) ":") ; section
+            (loop value
+                  (cdr tokens)
+                  (string-trim-both token))
+            (loop (cons (cons section token) value)
+                  (cdr tokens)
+                  section)))
+       (()
+        value))))
+
+  ;; Note: Multiple 'softdep sections are allowed.
+  (let ((info (modinfo-section-contents file)))
+    (apply append
+     (filter-map (match-lambda
+                  (('softdep . value)
+                   (parse-softdep value))
+                  (_ #f))
+                 (modinfo-section-contents file)))))
+
 (define (module-aliases file)
   "Return the list of aliases of module FILE."
   (let ((info (modinfo-section-contents file)))

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies.
  2019-01-25 11:30       ` [bug#34195] [PATCH] linux-modules: Add module-soft-dependencies Danny Milosavljevic
@ 2019-01-25 11:48         ` Danny Milosavljevic
  2019-01-25 17:07           ` Ludovic Courtès
  0 siblings, 1 reply; 19+ messages in thread
From: Danny Milosavljevic @ 2019-01-25 11:48 UTC (permalink / raw)
  To: 34195, ludo

* gnu/build/linux-modules.scm (not-softdep-whitespace): New variable.
(module-soft-dependencies): New procedure.
---
 gnu/build/linux-modules.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 2d8117504..1632f20d5 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -33,6 +33,7 @@
             ensure-dot-ko
             module-aliases
             module-dependencies
+            module-soft-dependencies
             normalize-module-name
             file-name->module-name
             find-module-file
@@ -100,6 +101,37 @@ contains module names, not actual file names."
       (('depends . what)
        (string-tokenize what %not-comma)))))
 
+(define not-softdep-whitespace
+  (char-set-complement (char-set #\space #\tab)))
+
+(define (module-soft-dependencies file)
+  "Return a list of (cons mode soft-dependency) of module FILE."
+  ;; TEXT: "pre: baz blubb foo post: bax bar"
+  (define (parse-softdep text)
+    (let loop ((value '())
+               (tokens (string-tokenize text not-softdep-whitespace))
+               (section #f))
+      (match tokens
+       ((token _ ...)
+        (if (string=? (string-take-right token 1) ":") ; section
+            (loop value
+                  (cdr tokens)
+                  (string-trim-both token))
+            (loop (cons (cons section token) value)
+                  (cdr tokens)
+                  section)))
+       (()
+        value))))
+
+  ;; Note: Multiple 'softdep sections are allowed.
+  (let ((info (modinfo-section-contents file)))
+    (apply append
+     (filter-map (match-lambda
+                  (('softdep . value)
+                   (parse-softdep value))
+                  (_ #f))
+                 (modinfo-section-contents file)))))
+
 (define (module-aliases file)
   "Return the list of aliases of module FILE."
   (let ((info (modinfo-section-contents file)))

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies.
  2019-01-25 11:48         ` [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies Danny Milosavljevic
@ 2019-01-25 17:07           ` Ludovic Courtès
  2019-01-25 17:25             ` bug#34195: " Danny Milosavljevic
  0 siblings, 1 reply; 19+ messages in thread
From: Ludovic Courtès @ 2019-01-25 17:07 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 34195

Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> * gnu/build/linux-modules.scm (not-softdep-whitespace): New variable.
> (module-soft-dependencies): New procedure.

That was fast!  :-)


[...]

> +(define (module-soft-dependencies file)
> +  "Return a list of (cons mode soft-dependency) of module FILE."
> +  ;; TEXT: "pre: baz blubb foo post: bax bar"
> +  (define (parse-softdep text)
> +    (let loop ((value '())
> +               (tokens (string-tokenize text not-softdep-whitespace))
> +               (section #f))
> +      (match tokens
> +       ((token _ ...)
> +        (if (string=? (string-take-right token 1) ":") ; section
> +            (loop value
> +                  (cdr tokens)
> +                  (string-trim-both token))

You can use the pattern (token rest ...) and then:

  (loop value rest (string-trim-both token))

instead of the not-so-nice ‘cdr’.  :-)

> +  (let ((info (modinfo-section-contents file)))
> +    (apply append
> +     (filter-map (match-lambda
> +                  (('softdep . value)
> +                   (parse-softdep value))
> +                  (_ #f))
> +                 (modinfo-section-contents file)))))

Replace ‘apply append’ with ‘concatenate’.

OK with these changes, thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#34195: [PATCH v2] linux-modules: Add modules-soft-dependencies.
  2019-01-25 17:07           ` Ludovic Courtès
@ 2019-01-25 17:25             ` Danny Milosavljevic
  2019-01-26 14:10               ` [bug#34195] " Ludovic Courtès
  0 siblings, 1 reply; 19+ messages in thread
From: Danny Milosavljevic @ 2019-01-25 17:25 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 34195-done

[-- Attachment #1: Type: text/plain, Size: 757 bytes --]

Hi Ludo,

>That was fast!  :-)

Yeah, I dislike ticking boot time bombs ;-)

Thanks for the review!

Pushed as 1a5f46621b44aa1458ad7acd4eca5fe1d4574f92 
and 519be98c3536b5113cde368f9dc6db2e1ebe073e (tiny fix)
to guix master.

Note that it returns something like

(("pre" . "module-1") ("pre" . "module-2"))

So the user might want to

(1) map cdr (or match ;) ) it
(2) replace dashes by underscores if a filename is desired (normalize-module-name)
(although in practise nobody in the mainline Linux seems to use dashes there
right now, their example in include/linux/module.h has dashes :P)

Example result:

scheme> (module-soft-dependencies "/tmp/vfio.ko")
$2 = (("post" . "vfio_iommu_spapr_tce") ("post" . "vfio_iommu_type1"))

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies.
  2019-01-25 17:25             ` bug#34195: " Danny Milosavljevic
@ 2019-01-26 14:10               ` Ludovic Courtès
  2019-01-26 15:00                 ` Danny Milosavljevic
  0 siblings, 1 reply; 19+ messages in thread
From: Ludovic Courtès @ 2019-01-26 14:10 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 34195-done

Hello,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> scheme> (module-soft-dependencies "/tmp/vfio.ko")
> $2 = (("post" . "vfio_iommu_spapr_tce") ("post" . "vfio_iommu_type1"))

That’s probably not the best interface.  :-)

Perhaps it should return two values: the list of modules to be loaded
before (“pre”), followed by the list of modules to be loaded after
(“post”).

WDYT?

Ludo’.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies.
  2019-01-26 14:10               ` [bug#34195] " Ludovic Courtès
@ 2019-01-26 15:00                 ` Danny Milosavljevic
  2019-01-26 15:19                   ` Ludovic Courtès
  0 siblings, 1 reply; 19+ messages in thread
From: Danny Milosavljevic @ 2019-01-26 15:00 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 34195-done

[-- Attachment #1: Type: text/plain, Size: 2207 bytes --]

Hi Ludo,

On Sat, 26 Jan 2019 15:10:27 +0100
Ludovic Courtès <ludo@gnu.org> wrote:

> Danny Milosavljevic <dannym@scratchpost.org> skribis:
> 
> > scheme> (module-soft-dependencies "/tmp/vfio.ko")  
> > $2 = (("post" . "vfio_iommu_spapr_tce") ("post" . "vfio_iommu_type1"))  
> 
> That’s probably not the best interface.  :-)
> 
> Perhaps it should return two values: the list of modules to be loaded
> before (“pre”), followed by the list of modules to be loaded after
> (“post”).

I had thought about it - but for our use case it makes it slower and more
complicated.

I still have the previous version (see below).

Moreover, it did the wrong thing for multiple 'softdep sections.

I guess I can use an external grouper routine (something like a hypothetical
group-by-first - does it exist?) on the result of module-soft-dependencies.

But at that point the caller can call it himself :->

We could hard-code "pre" and "post" as the two only possible sections (and
kmod does), but that would make it break in the future even though we don't
care about the sections, just the module names.

Complicated version:

(define (module-soft-dependencies file)
  "Return the list of soft dependencies of module FILE."
  (define (add-to-first-acons value alist)
    (match alist
      (((k . v) . b)
       (cons (cons k (cons value v)) b))))

  (define (parse-softdep text)
    (let loop ((value '())
               (tokens (string-tokenize text not-softdep-whitespace))
               (section #f))
      (write tokens)
      (newline)
      (match tokens
       ((token _ ...)
        (if (string=? (string-take-right token 1) ":") ; section
            (loop (acons (string-drop-right token 1) '() value)
                  (cdr tokens)
                  (string-trim-both token))
            (loop (add-to-first-acons token value)
                  (cdr tokens) section)))
       (()
        value))))

  (let ((info (modinfo-section-contents file)))
    (filter-map (match-lambda
                 (('softdep . value)
                  (parse-softdep value))
                 (_ #f))
                (modinfo-section-contents file))))

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies.
  2019-01-26 15:00                 ` Danny Milosavljevic
@ 2019-01-26 15:19                   ` Ludovic Courtès
  2019-01-26 16:19                     ` [bug#34195] [PATCH] linux-modules: module-soft-dependencies: Partition the result and return it as two lists Danny Milosavljevic
  0 siblings, 1 reply; 19+ messages in thread
From: Ludovic Courtès @ 2019-01-26 15:19 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 34195-done

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> On Sat, 26 Jan 2019 15:10:27 +0100
> Ludovic Courtès <ludo@gnu.org> wrote:
>
>> Danny Milosavljevic <dannym@scratchpost.org> skribis:
>> 
>> > scheme> (module-soft-dependencies "/tmp/vfio.ko")  
>> > $2 = (("post" . "vfio_iommu_spapr_tce") ("post" . "vfio_iommu_type1"))  
>> 
>> That’s probably not the best interface.  :-)
>> 
>> Perhaps it should return two values: the list of modules to be loaded
>> before (“pre”), followed by the list of modules to be loaded after
>> (“post”).
>
> I had thought about it - but for our use case it makes it slower and more
> complicated.

Once you have the result above, you can simply do:

  (partition (match-lambda
               (("pre" . _) #t)
               (("post" . _) #f))
             $2)

and then remove the cars.  Or you can fold over the elements instead of
constructing the alist in the first place.

Anyway it should be a few more lines at most, I think.

Ludo’.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#34195] [PATCH] linux-modules: module-soft-dependencies: Partition the result and return it as two lists.
  2019-01-26 15:19                   ` Ludovic Courtès
@ 2019-01-26 16:19                     ` Danny Milosavljevic
  2019-01-26 16:23                       ` [bug#34195] [PATCH v2] " Danny Milosavljevic
  0 siblings, 1 reply; 19+ messages in thread
From: Danny Milosavljevic @ 2019-01-26 16:19 UTC (permalink / raw)
  To: 34195-done, ludo

* gnu/build/linux-modules.scm (module-soft-dependencies): Partition the
result and return it as two lists.
---
 gnu/build/linux-modules.scm | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index d69bcbf5a..16c8fad28 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -25,6 +25,7 @@
   #:use-module (rnrs io ports)
   #:use-module (rnrs bytevectors)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 vlist)
   #:use-module (ice-9 match)
@@ -105,7 +106,8 @@ contains module names, not actual file names."
   (char-set-complement (char-set #\space #\tab)))
 
 (define (module-soft-dependencies file)
-  "Return a list of (cons section soft-dependency) of module FILE."
+  "Return the list of modules that can be preloaded, and then the list of
+modules that can be postloaded, of the soft dependencies of module FILE."
   ;; TEXT: "pre: baz blubb foo post: bax bar"
   (define (parse-softdep text)
     (let loop ((value '())
@@ -120,13 +122,19 @@ contains module names, not actual file names."
         value))))
 
   ;; Note: Multiple 'softdep sections are allowed.
-  (let ((info (modinfo-section-contents file)))
-    (concatenate
-     (filter-map (match-lambda
-                  (('softdep . value)
-                   (parse-softdep value))
-                  (_ #f))
-                 (modinfo-section-contents file)))))
+  (let* ((info (modinfo-section-contents file))
+         (entries (concatenate
+                   (filter-map (match-lambda
+                                (('softdep . value)
+                                 (parse-softdep value))
+                                (_ #f))
+                               (modinfo-section-contents file)))))
+    (let-values (((pres posts)
+                  (partition (match-lambda
+                              (("pre" . _) #t)
+                              (("post" . _) #f))
+                             entries)))
+      (values (map cdr pres) (map cdr posts)))))
 
 (define (module-aliases file)
   "Return the list of aliases of module FILE."

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#34195] [PATCH v2] linux-modules: module-soft-dependencies: Partition the result and return it as two lists.
  2019-01-26 16:19                     ` [bug#34195] [PATCH] linux-modules: module-soft-dependencies: Partition the result and return it as two lists Danny Milosavljevic
@ 2019-01-26 16:23                       ` Danny Milosavljevic
  0 siblings, 0 replies; 19+ messages in thread
From: Danny Milosavljevic @ 2019-01-26 16:23 UTC (permalink / raw)
  To: 34195-done, ludo

* gnu/build/linux-modules.scm (module-soft-dependencies): Partition the
result and return it as two lists.
---
 gnu/build/linux-modules.scm | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index d69bcbf5a..d99d1f01a 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -25,6 +25,7 @@
   #:use-module (rnrs io ports)
   #:use-module (rnrs bytevectors)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 vlist)
   #:use-module (ice-9 match)
@@ -105,7 +106,8 @@ contains module names, not actual file names."
   (char-set-complement (char-set #\space #\tab)))
 
 (define (module-soft-dependencies file)
-  "Return a list of (cons section soft-dependency) of module FILE."
+  "Return the list of modules that can be preloaded, and then the list of
+modules that can be postloaded, of the soft dependencies of module FILE."
   ;; TEXT: "pre: baz blubb foo post: bax bar"
   (define (parse-softdep text)
     (let loop ((value '())
@@ -120,13 +122,24 @@ contains module names, not actual file names."
         value))))
 
   ;; Note: Multiple 'softdep sections are allowed.
-  (let ((info (modinfo-section-contents file)))
-    (concatenate
-     (filter-map (match-lambda
-                  (('softdep . value)
-                   (parse-softdep value))
-                  (_ #f))
-                 (modinfo-section-contents file)))))
+  (let* ((info (modinfo-section-contents file))
+         (entries (concatenate
+                   (filter-map (match-lambda
+                                (('softdep . value)
+                                 (parse-softdep value))
+                                (_ #f))
+                               (modinfo-section-contents file)))))
+    (let-values (((pres posts)
+                  (partition (match-lambda
+                              (("pre" . _) #t)
+                              (("post" . _) #f))
+                             entries)))
+      (values (map (match-lambda
+                    ((_ . value) value))
+                   pres)
+              (map (match-lambda
+                    ((_ . value) value))
+                   posts)))))
 
 (define (module-aliases file)
   "Return the list of aliases of module FILE."

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2019-01-26 16:24 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-21 19:48 bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64 Vagrant Cascadian
2019-01-23 10:54 ` Ludovic Courtès
2019-01-23 17:48   ` Vagrant Cascadian
2019-01-25  8:59     ` Ludovic Courtès
2019-01-25 11:30       ` [bug#34195] [PATCH] linux-modules: Add module-soft-dependencies Danny Milosavljevic
2019-01-25 11:48         ` [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies Danny Milosavljevic
2019-01-25 17:07           ` Ludovic Courtès
2019-01-25 17:25             ` bug#34195: " Danny Milosavljevic
2019-01-26 14:10               ` [bug#34195] " Ludovic Courtès
2019-01-26 15:00                 ` Danny Milosavljevic
2019-01-26 15:19                   ` Ludovic Courtès
2019-01-26 16:19                     ` [bug#34195] [PATCH] linux-modules: module-soft-dependencies: Partition the result and return it as two lists Danny Milosavljevic
2019-01-26 16:23                       ` [bug#34195] [PATCH v2] " Danny Milosavljevic
2019-01-23 17:54   ` bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64 Efraim Flashner
2019-01-23 17:57     ` Efraim Flashner
2019-01-25  8:49       ` Ludovic Courtès
2019-01-23 20:58 ` Mark H Weaver
2019-01-24  0:44   ` Vagrant Cascadian
2019-01-24  4:02     ` Mark H Weaver

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

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.