Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dracut: add support for one only module groups #2309

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

airlied
Copy link

@airlied airlied commented Apr 19, 2023

This supports the case where only a single module from a group will be put into the initramfs to keep initramfs sizes down where firmware files are getting large.

The kernel will denote a group like this:

MODULE_FIRMWARE_GROUP_ONLY_ONE("ga106-gsp");
MODULE_FIRMWARE_GROUP_LIST("nvidia/ga106/gsp/gsp-5303002.bin,nvidia/ga106/gsp/gsp-5258902.bin")
MODULE_FIRMWARE("nvidia/ga106/gsp/gsp-5258902.bin");
MODULE_FIRMWARE("nvidia/ga106/gsp/gsp-5303002.bin");
MODULE_FIRMWARE_GROUP_ONLY_ONE("ga106-gsp");

dracut will then scan for these group tags. It will use the group list inside the group only tags to and ignore the legacy firmware lines (which will be left in place for old dracut). It will search for the first fw in the group list and work it's way down.

The kernel driver will then handle whatever it ends up finding.

This pull request changes...

Changes

Checklist

  • I have tested it locally
  • I have reviewed and updated any documentation if relevant
  • I am providing new code and test(s) for it

Fixes #

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this pull request Apr 19, 2023
…se one.

This adds a tag that will go into the module info, only one firmware from
the group given needs to be available for this driver to work. This allows
dracut to avoid adding in firmware that aren't needed.

This just brackets a module list in the modinfo, the modules in the list
will get entries in reversed order so the last module in the list is the
preferred one.

The corresponding dracut code it at:
dracutdevs/dracut#2309

Cc: Luis Chamberlain <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Dave Airlie <[email protected]>
@airlied
Copy link
Author

airlied commented Apr 19, 2023

The kernel patch is:
https://lore.kernel.org/all/[email protected]/T/#u

@mupuf
Copy link

mupuf commented Apr 19, 2023

The kernel patch is: https://lore.kernel.org/all/[email protected]/T/#u

Given that some firmwares may come with bug/security fixes, shouldn't the order of module firmwares inside a group be specified to mean something? As in, the first firmware specified would be the least wanted/oldest, and the newest one would be the preferred?

@airlied
Copy link
Author

airlied commented Apr 19, 2023

The kernel patch is: https://lore.kernel.org/all/[email protected]/T/#u

Given that some firmwares may come with bug/security fixes, shouldn't the order of module firmwares inside a group be specified to mean something? As in, the first firmware specified would be the least wanted/oldest, and the newest one would be the preferred?

It is defined by how the module info section is populated. It just happens that it's populated in reverse, so the last firmware you specify in the kernel is the first one dracut tries.

I can't think of anyway to define it better that would be backwards compatible.

@mupuf
Copy link

mupuf commented Apr 19, 2023

It is defined by how the module info section is populated. It just happens that it's populated in reverse, so the last firmware you specify in the kernel is the first one dracut tries.

I can't think of anyway to define it better that would be backwards compatible.

I think the code and the logic is sound. Sure, the interface is quirky, but what matters is that you document in what order the fw should be listed in the kernel drivers' source code, and the expected result in the module info section. As for dracut, please add a comment about the expected ordering from the module info, so that the interface is clear.

This should make it easier on both kernel and initramfs developers to know what's the expectation, reducing the chances of screwups on either sides that would silently lead to differences between drivers and distros. WDYT?

@mupuf
Copy link

mupuf commented Apr 19, 2023

Thanks @airlied!

@airlied
Copy link
Author

airlied commented Apr 20, 2023

I also assume the procedure would be to get sign off on the kernel side first before landing this.

Copy link
Member

@aafeijoo-suse aafeijoo-suse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also assume the procedure would be to get sign off on the kernel side first before landing this.

Yes, thanks for your patch.

Meanwhile, you can fix your commit message (https://github.com/dracutdevs/dracut/actions/runs/4740463846/jobs/8440368788?pr=2309) and some formatting issues (https://github.com/dracutdevs/dracut/actions/runs/4740463843/jobs/8440368768?pr=2309)

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this pull request Apr 26, 2023
…se one.

This adds a tag that will go into the module info, only one firmware from
the group given needs to be available for this driver to work. This allows
dracut to avoid adding in firmware that aren't needed.

This just brackets a module list in the modinfo, the modules in the list
will get entries in reversed order so the last module in the list is the
preferred one.

The corresponding dracut code it at:
dracutdevs/dracut#2309

Cc: Luis Chamberlain <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Dave Airlie <[email protected]>
@stale
Copy link

stale bot commented May 21, 2023

This issue is being marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. Thank you for your contributions.

@stale stale bot added the stale communication is stuck label May 21, 2023
@stale stale bot closed this Jun 9, 2023
@LaszloGombos LaszloGombos added enhancement Issue adding new functionality and removed stale communication is stuck labels Jun 10, 2023
@LaszloGombos LaszloGombos reopened this Jun 10, 2023
@LaszloGombos LaszloGombos removed the request for review from danimo June 10, 2023 01:37
This supports the case where only a single module from a group
will be put into the initramfs to keep initramfs sizes down where
firmware files are getting large.

The kernel will denote a group like this:

MODULE_FIRMWARE_GROUP_ONLY_ONE("ga106-gsp");
MODULE_FIRMWARE_GROUP_LIST("nvidia/ga106/gsp/gsp-5303002.bin,nvidia/ga106/gsp/gsp-5258902.bin")
MODULE_FIRMWARE("nvidia/ga106/gsp/gsp-5258902.bin");
MODULE_FIRMWARE("nvidia/ga106/gsp/gsp-5303002.bin");
MODULE_FIRMWARE_GROUP_ONLY_ONE("ga106-gsp");

dracut will see the group boundaries, and only install the first found firmware
from the group list.

There is no simple way to keep this forwards/backwards compatible that doesn't list the firmwares
twice. Old dracut should ignore the new directives, so will install all the firmwares,
new dracut will ignore MODULE_FIRMWARE's found between GROUP brackets.

This also avoids the problem of modinfo section ordering which it turns out isn't consistent
in direction.

Signed-off-by: Dave Airlie <[email protected]>
@airlied
Copy link
Author

airlied commented Jul 4, 2023

I've updated this, and new kernel patches are

https://lore.kernel.org/linux-modules/[email protected]/T/#t

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this pull request Jul 4, 2023
…se one.

This adds two tags that will go into the module info.

The first denotes a group of firmwares, when that tag is present all
MODULE_FIRMWARE lines between the tags will be ignored by new versions of
dracut.

The second makes an explicitly ordered group of firmwares to search for
inside a group setting. New dracut will pick the first available firmware
from this to put in the initramfs.

Old dracut will just ignore these tags and fallback to installing all
the firmwares.

The corresponding dracut code it at:
dracutdevs/dracut#2309

Cc: Luis Chamberlain <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Dave Airlie <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issue adding new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants