From: Michael Ellerman <mpe@ellerman.id.au>
To: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v1] kernel/reboot: Change registration order of legacy power-off handler
Date: Mon, 06 Jun 2022 23:06:23 +1000 [thread overview]
Message-ID: <87r142ndps.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <e597fd8e-d0d1-dd1c-b889-86cfca60f0f6@collabora.com>
Dmitry Osipenko <dmitry.osipenko@collabora.com> writes:
> Hi Michael,
>
> On 6/5/22 05:01, Michael Ellerman wrote:
>> Dmitry Osipenko <dmitry.osipenko@collabora.com> writes:
>>> We're unconditionally registering sys-off handler for the legacy
>>> pm_power_off() callback, this causes problem for platforms that don't
>>> use power-off handlers at all and should be halted. Now reboot syscall
>>> assumes that there is a power-off handler installed and tries to power
>>> off system instead of halting it.
>>>
>>> To fix the trouble, move the handler's registration to the reboot syscall
>>> and check the pm_power_off() presence.
>>
>> I'm seeing a qemu virtual machine (ppce500) fail to power off using the
>> gpio-poweroff driver. I bisected it to this commit.
>>
>> I think the problem is that the machine is going via kernel_power_off(),
>> not sys_reboot(), and so legacy_pm_power_off() has not been registered.
>>
>> If I just put the core_initcall back then it works as before. Not sure
>> if that's a safe change in general though.
>
> Thank you very much for the testing and reporting the problem! I see now the two more cases that were missed previously:
>
> 1. There is the orderly_poweroff() used by some drivers.
> 2. PowerPC may invoke do_kernel_power_off() directly from xmon code.
>
> Could you please test this change:
That works, thanks.
I tested both sysrq-o and the xmon power off path.
I couldn't come up with an easy way to test the orderly_poweroff()
path, but it boils down to basically the same code in the end.
Tested-by: Michael Ellerman <mpe@ellerman.id.au>
cheers
next prev parent reply other threads:[~2022-06-06 13:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-24 21:21 Dmitry Osipenko
2022-05-25 12:56 ` Rafael J. Wysocki
2022-06-05 2:01 ` Michael Ellerman
2022-06-05 12:19 ` Dmitry Osipenko
2022-06-06 13:06 ` Michael Ellerman [this message]
2022-06-06 13:07 ` Dmitry Osipenko
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=87r142ndps.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=dmitry.osipenko@collabora.com \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=rafael@kernel.org \
/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®