Skip to content

Support __kconfig macro for LINUX_KERNEL_VERSION#951

Merged
ti-mo merged 4 commits intocilium:masterfrom
eiffel-fl:tb/kconfig
Mar 3, 2023
Merged

Support __kconfig macro for LINUX_KERNEL_VERSION#951
ti-mo merged 4 commits intocilium:masterfrom
eiffel-fl:tb/kconfig

Conversation

@eiffel-fl
Copy link
Contributor

@eiffel-fl eiffel-fl commented Feb 28, 2023

Hi.

This supersedes #869.

This PR is a first step toward __kconfig support which is discussed in #698.
When a .kconfig data section is detected, a .kconfig map is created, its content will be initialized depending on the CONFIG_* values.
During relocation, variable inside the .kconfig data section will have their offset changed to reflect their value inside the .kconfig map.

For the moment, it only enables using LINUX_KERNEL_VERSION. The .kconfig map will be updated to contain the result of internal.KernelVersion().

If you see any way to improve this PR, feel free to share.

Best regards and thank you in advance.

@eiffel-fl eiffel-fl changed the title Tb/kconfig Support __kconfig macro for LINUX_KERNEL_VERSION Feb 28, 2023
@ti-mo ti-mo self-requested a review February 28, 2023 11:39
lmb
lmb previously requested changes Feb 28, 2023
Copy link
Contributor

@lmb lmb left a comment

Choose a reason for hiding this comment

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

Leaving some feedback for @ti-mo's part.

@ti-mo ti-mo force-pushed the tb/kconfig branch 2 times, most recently from 53d1826 to 06ff2c7 Compare March 2, 2023 14:24
Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
@ti-mo ti-mo requested a review from lmb March 2, 2023 14:34
Copy link
Contributor

@lmb lmb left a comment

Choose a reason for hiding this comment

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

LGTM!

ti-mo and others added 3 commits March 3, 2023 09:42
fixupDatasecLayout steps through Datasec.Vars to calculate the proper offsets
based on the Vars' sizes and populates Datasec.Size when done.

alignof() now returns an error if the size of the type it wants to calculate
is not a power of two.

Signed-off-by: Timo Beckers <timo@isovalent.com>
Simplify elfCode methods by moving maps from being an argument to being
a struct member. Avoids a BTF lookup in a subsequent commit.

Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
Co-authored-by: Timo Beckers <timo@isovalent.com>
This commit is a first step towards __kconfig support. When a .kconfig Datasec
is detected, a .kconfig map is created and emitted into the CollectionSpec.
Instructions referring to __kconfig variables will be rewritten to refer to
the .kconfig map during ELF load.

Its contents will only be initialized when loading the spec into the kernel.
All variables specified in the .kconfig Datasec are resolved based on their
names, and the results are written to .kconfig's Contents.

For the moment, it only enables using LINUX_KERNEL_VERSION.

Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
Co-authored-by: Timo Beckers <timo@isovalent.com>
@ti-mo ti-mo dismissed lmb’s stale review March 3, 2023 08:59

feedback addressed

@ti-mo ti-mo merged commit b673899 into cilium:master Mar 3, 2023
@eiffel-fl
Copy link
Contributor Author

Amazing! Thank you for the merge 🎉 🎉 🎉 🔥 🔥 🔥 😄 😄 😄!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants