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

Properly handle module_kboject creation #55

Open
wants to merge 3 commits into
base: modules-next_base
Choose a base branch
from

Conversation

modules-kpd-app[bot]
Copy link

Pull request for series with
subject: Properly handle module_kboject creation
version: 1
url: https://patchwork.kernel.org/project/linux-modules/list/?series=930305

@modules-kpd-app
Copy link
Author

Upstream branch: 48ecfdd
series: https://patchwork.kernel.org/project/linux-modules/list/?series=930305
version: 1

Shyam Saini added 3 commits February 4, 2025 12:18
locate_module_kobject() look up for existing module_kobject
For given module name locate_module_kobject() look up for
corresponding module_kobject if it exists. If it coudln't
find its corresponding module_kobject then it creates one
for the given name.
Rename locate_module_kobject() to lookup_or_create_module_kobject(),
to better describe its operations.

This doesn't change anything functionality wise.

Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Shyam Saini <shyamsaini@linux.microsoft.com>
Move the following to module.h to allow common usages:
 - lookup_or_create_module_kobject()
 - to_module_attr
 - to_module_kobject

This makes lookup_or_create_module_kobject() as inline.

Signed-off-by: Shyam Saini <shyamsaini@linux.microsoft.com>
module_add_driver() relies on module_kset list for
/sys/module/<built-in-module>/drivers directory creation.

Since,
commit 96a1a24 ("kernel/params.c: defer most of param_sysfs_init() to late_initcall time")
drivers which are initialized from subsys_initcall() or any other
higher precedence initcall couldn't find the related kobject entry
in the module_kset list because module_kset is not fully populated
by the time module_add_driver() refers it. As a consequence,
module_add_driver() returns early without calling make_driver_name().
Therefore, /sys/module/<built-in-module>/drivers is never created.

Fix this issue by letting module_add_driver() handle module_kobject
creation itself.

Fixes: 96a1a24 ("kernel/params.c: defer most of param_sysfs_init() to late_initcall time")
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Shyam Saini <shyamsaini@linux.microsoft.com>
@modules-kpd-app
Copy link
Author

Upstream branch: 053842e
series: https://patchwork.kernel.org/project/linux-modules/list/?series=930305
version: 1

@modules-kpd-app modules-kpd-app bot force-pushed the series/930305=>modules-next branch from d126463 to 322d5ea Compare February 4, 2025 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants