From: Abel Wu <abel.w@icloud.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: rjw@rjwysocki.net, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, hewenliang4@huawei.com,
wuyun.wu@huawei.com
Subject: Re: [PATCH] PM: hibernate: add sanity check on power_kobj
Date: Tue, 2 Feb 2021 09:59:11 +0800 [thread overview]
Message-ID: <F87648CF-E5D6-41C7-9F4E-87A4BA2A4786@icloud.com> (raw)
In-Reply-To: <20210201105243.GA23135@duo.ucw.cz>
> On Feb 1, 2021, at 6:52 PM, Pavel Machek <pavel@ucw.cz> wrote:
>
> On Mon 2021-02-01 02:50:41, Abel Wu wrote:
>> 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.
>
> 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
>
>> Signed-off-by: Abel Wu <abel.w@icloud.com>
>> ---
>> kernel/power/hibernate.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
>> index da0b41914177..060089cc261d 100644
>> --- a/kernel/power/hibernate.c
>> +++ b/kernel/power/hibernate.c
>> @@ -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);
>> }
>>
>> --
>> 2.27.0
>
> --
> http://www.livejournal.com/~pavelmachek
next prev parent reply other threads:[~2021-02-02 2:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 7:50 Abel Wu
2021-02-01 10:52 ` Pavel Machek
2021-02-02 1:59 ` Abel Wu [this message]
2021-02-02 9:04 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=F87648CF-E5D6-41C7-9F4E-87A4BA2A4786@icloud.com \
--to=abel.w@icloud.com \
--cc=hewenliang4@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=wuyun.wu@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®