PM: hibernate: add sanity check on power_kobj
Subsystems (2)
PATCH 1/1 PM: hibernate: add sanity check on power_kobj
The @power_kobj is initialized in pm_init() which is the same initcall level as pm_disk_init(). Although this dependency is guaranteed based on the current initcall serial execution model, it would still be better do a cost-less sanity check to avoid oops once the dependency is broken.
--- kernel/power/hibernate.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/power/hibernate.c +3 -0
@@ -1262,6 +1262,9 @@ static const struct attribute_group attr_group = {static int __init pm_disk_init (void ) { +if (!power_kobj) +return -EINVAL ; +return sysfs_create_group (power_kobj, &attr_group); }
Signature · 1 line
2.27.0
Quoted 5 lines · Abel Wu
The @power_kobj is initialized in
pm_init()which is the same initcall level aspm_disk_init(). Although this dependency is guaranteed based on the current initcall serial execution model, it would still be better do a cost-less sanity check to avoid oops once the dependency is broken.
I don't believe this is good idea. If the dependency is ever broken, this will make failure more subtle and harder to debug.
Quoted 21 lines
Signed-off-by Abel Wu <[email protected]>--- kernel/power/hibernate.c | 3 +++ 1 file changed, 3 insertions(+)kernel/power/hibernate.c +3
-0@@ -1262,6 +1262,9 @@ static const struct attribute_group attr_group = {static int __init pm_disk_init (void ) { +if (!power_kobj) +return -EINVAL ; +return sysfs_create_group (power_kobj, &attr_group); }Signature · 1 line
2.27.0
Signature · 1 line
http://www.livejournal.com/~pavelmachek
Quoted 13 lines · Pavel Machek
Quoted 5 lines · Abel Wu
The @power_kobj is initialized in
pm_init()which is the same initcall level aspm_disk_init(). Although this dependency is guaranteed based on the current initcall serial execution model, it would still be better do a cost-less sanity check to avoid oops once the dependency is broken.I don't believe this is good idea. If the dependency is ever broken, this will make failure more subtle and harder to debug.
Thanks for reviewing. I think the cmdline parameter initcall_debug will help in this case.
Actually we are trying to make initcalls being called asynchronously to reduce boot time which is crucial to our cloud-native business. And we resolve this kind of dependencies by retrying failed initcalls.
Best regards,
Abel
Quoted 25 lines
Quoted 22 lines
Signed-off-by Abel Wu <[email protected]>---
kernel/power/hibernate.c| 3 +++1 file changed, 3 insertions(+)kernel/power/hibernate.c +3
-0@@ -1262,6 +1262,9 @@ static const struct attribute_group attr_group = {static int __init pm_disk_init (void ) { +if (!power_kobj) +return -EINVAL ; +return sysfs_create_group (power_kobj, &attr_group); }Signature · 1 line
2.27.0Signature · 1 line
http://www.livejournal.com/~pavelmachek
Quoted 11 lines · Abel Wu
Quoted 11 lines · Pavel Machek
Quoted 5 lines · Abel Wu
The @power_kobj is initialized in
pm_init()which is the same initcall level aspm_disk_init(). Although this dependency is guaranteed based on the current initcall serial execution model, it would still be better do a cost-less sanity check to avoid oops once the dependency is broken.
Quoted 8 lines
Quoted 2 lines
I don't believe this is good idea. If the dependency is ever broken, this will make failure more subtle and harder to debug.
Thanks for reviewing. I think the cmdline parameter
initcall_debugwill help in this case.
Actually we are trying to make initcalls being called asynchronously to reduce boot time which is crucial to our cloud-native business. And we resolve this kind of dependencies by retrying failed initcalls.
And this patch is okay if that gets mainlined, but not before.
Best regards,
Pavel
Signature · 1 line
http://www.livejournal.com/~pavelmachek