Discussion:
[Openipmi-developer] Shutdown behavior with IPMI enabled
Mandeep Sandhu
2015-04-29 17:39:42 UTC
Permalink
Hi All,

I'm facing an IPMI related problem. I don't know if this is the right
list to ask (as the problem is partially kernel related). If not, I'd
appreciate if you could direct me to the correct ML.

I'm seeing a certain behaviour on my server, which has a BMC, when
running the "shutdown" command, wherein the machine restarts after I
do a shutdown from Linux.

I noticed that I have the "ipmi_poweroff" module loaded on my setup.
So, when I invoke 'sudo shutdown now', the kernel shuts down the
machine and the ipmi_poweroff module ALSO sends an ipmi "chassis power
off" command to the BMC.

I have access to the BMC firmware and I saw that the way BMC handles
"chassis power off" is by emulating a power button press for 6
seconds. But since the host already shuts down in the meantime, the
button press ends up power up the system again!

My question is, why does the host power off itself when the
ipmi_poweroff module is loaded? Shouldn't just one of them be
responsible for powering off the system?

If the host can shut itself down, it should not ask the BMC to do a
power off or vice-versa.

Thanks,
-mandeep
Corey Minyard
2015-05-06 12:50:46 UTC
Permalink
Post by Mandeep Sandhu
Hi All,
I'm facing an IPMI related problem. I don't know if this is the right
list to ask (as the problem is partially kernel related). If not, I'd
appreciate if you could direct me to the correct ML.
Adding LKML, since this is a kernel related issue.
Post by Mandeep Sandhu
I'm seeing a certain behaviour on my server, which has a BMC, when
running the "shutdown" command, wherein the machine restarts after I
do a shutdown from Linux.
I noticed that I have the "ipmi_poweroff" module loaded on my setup.
So, when I invoke 'sudo shutdown now', the kernel shuts down the
machine and the ipmi_poweroff module ALSO sends an ipmi "chassis power
off" command to the BMC.
I have access to the BMC firmware and I saw that the way BMC handles
"chassis power off" is by emulating a power button press for 6
seconds. But since the host already shuts down in the meantime, the
button press ends up power up the system again!
Well that's a very unusual interpretation of "power off".
Post by Mandeep Sandhu
My question is, why does the host power off itself when the
ipmi_poweroff module is loaded? Shouldn't just one of them be
responsible for powering off the system?
Well, theoretically, if the power off function completes, the system
should be powered off and therefore nothing else should run. So there's
no real provision for not calling the other power off functions.
Post by Mandeep Sandhu
If the host can shut itself down, it should not ask the BMC to do a
power off or vice-versa.
I"m not sure I have a great solution. You can, of course, not use the
ipmi_poweroff module. I'm not sure of the utility of it in a modern
system. In the past, before reliable ACPI and such, some systems didn't
have reliable power off function and IPMI was the only way to accomplish
this in some cases. Which is why the function exists.

Another option would be to spin in the ipmi power off function forever.
I'm not sure I like that option, either.

It might be best to remove, or at least disable normally, the config
option in most systems. That way systems that really needed it could
have it, but it wouldn't affect most people.

-corey
Post by Mandeep Sandhu
Thanks,
-mandeep
Mandeep Sandhu
2015-05-06 17:23:40 UTC
Permalink
Post by Corey Minyard
Post by Mandeep Sandhu
I have access to the BMC firmware and I saw that the way BMC handles
"chassis power off" is by emulating a power button press for 6
seconds. But since the host already shuts down in the meantime, the
button press ends up power up the system again!
Well that's a very unusual interpretation of "power off".
How do you think power off should've been handled by the BMC? Should
it have requested the BIOS to put the CPU in the power off state (S5)?
Mine is an Intel system and I guess the kernel too requests the BIOS
for putting the CPU in S5 state (by writing to some BIOS register).
Post by Corey Minyard
Well, theoretically, if the power off function completes, the system
should be powered off and therefore nothing else should run. So there's
no real provision for not calling the other power off functions.
I went through the code of ipmi_poweroff module and it seems that the
driver ends up replacing the "pm_power_off" function with it's own
ipmi_poweroff_function. So I assume only the IPMI power action should
be performed. But it seems that there's some other path during the
shutdown sequence which also switches off the system. If I disable
ACPI (via kernel cmdline), then the kernel power off does not happen,
and only IPMI is used.
Post by Corey Minyard
Post by Mandeep Sandhu
If the host can shut itself down, it should not ask the BMC to do a
power off or vice-versa.
I"m not sure I have a great solution. You can, of course, not use the
ipmi_poweroff module. I'm not sure of the utility of it in a modern
system. In the past, before reliable ACPI and such, some systems didn't
have reliable power off function and IPMI was the only way to accomplish
this in some cases. Which is why the function exists.
Thanks for giving a background context to the poweroff module. I
wasn't sure why or when is it needed.
Post by Corey Minyard
Another option would be to spin in the ipmi power off function forever.
I'm not sure I like that option, either.
It might be best to remove, or at least disable normally, the config
option in most systems. That way systems that really needed it could
have it, but it wouldn't affect most people.
Which config option do you refer to here? Something that disables the
IPMI power off function?

Thanks for your time.

Regards,
-mandeep
Post by Corey Minyard
-corey
Post by Mandeep Sandhu
Thanks,
-mandeep
Corey Minyard
2015-05-06 19:33:03 UTC
Permalink
Post by Mandeep Sandhu
Post by Corey Minyard
Post by Mandeep Sandhu
I have access to the BMC firmware and I saw that the way BMC handles
"chassis power off" is by emulating a power button press for 6
seconds. But since the host already shuts down in the meantime, the
button press ends up power up the system again!
Well that's a very unusual interpretation of "power off".
How do you think power off should've been handled by the BMC? Should
it have requested the BIOS to put the CPU in the power off state (S5)?
Mine is an Intel system and I guess the kernel too requests the BIOS
for putting the CPU in S5 state (by writing to some BIOS register).
Certainly, it should just immediately power the system off. There is a
soft shutdown option if you want a graceful shutdown.

The spec says:

0 - power down. Force system into soft off (S4/S45) state. This is for
‘emergency’ management power down actions. The command
does not initiate a clean shut-down of the operating system prior to
powering down the system.

I would say the system in question is not compliant, to me, 6 seconds an
"force" are not the same thing :).
Post by Mandeep Sandhu
Post by Corey Minyard
Well, theoretically, if the power off function completes, the system
should be powered off and therefore nothing else should run. So there's
no real provision for not calling the other power off functions.
I went through the code of ipmi_poweroff module and it seems that the
driver ends up replacing the "pm_power_off" function with it's own
ipmi_poweroff_function. So I assume only the IPMI power action should
be performed. But it seems that there's some other path during the
shutdown sequence which also switches off the system. If I disable
ACPI (via kernel cmdline), then the kernel power off does not happen,
and only IPMI is used.
Yes, the ACPI power off ties in through a different mechanism.
Post by Mandeep Sandhu
Post by Corey Minyard
Post by Mandeep Sandhu
If the host can shut itself down, it should not ask the BMC to do a
power off or vice-versa.
I"m not sure I have a great solution. You can, of course, not use the
ipmi_poweroff module. I'm not sure of the utility of it in a modern
system. In the past, before reliable ACPI and such, some systems didn't
have reliable power off function and IPMI was the only way to accomplish
this in some cases. Which is why the function exists.
Thanks for giving a background context to the poweroff module. I
wasn't sure why or when is it needed.
Post by Corey Minyard
Another option would be to spin in the ipmi power off function forever.
I'm not sure I like that option, either.
It might be best to remove, or at least disable normally, the config
option in most systems. That way systems that really needed it could
have it, but it wouldn't affect most people.
Which config option do you refer to here? Something that disables the
IPMI power off function?
Yes, CONFIG_IPMI_POWEROFF

-corey
Post by Mandeep Sandhu
Thanks for your time.
Regards,
-mandeep
Post by Corey Minyard
-corey
Post by Mandeep Sandhu
Thanks,
-mandeep
Mandeep Sandhu
2015-05-06 20:34:18 UTC
Permalink
Post by Corey Minyard
Certainly, it should just immediately power the system off. There is a
soft shutdown option if you want a graceful shutdown.
0 - power down. Force system into soft off (S4/S45) state. This is for
‘emergency’ management power down actions. The command
does not initiate a clean shut-down of the operating system prior to
powering down the system.
I would say the system in question is not compliant, to me, 6 seconds an
"force" are not the same thing :).
You're right. The BMC firmware needs fixing!
Post by Corey Minyard
Post by Mandeep Sandhu
Post by Corey Minyard
It might be best to remove, or at least disable normally, the config
option in most systems. That way systems that really needed it could
have it, but it wouldn't affect most people.
Which config option do you refer to here? Something that disables the
IPMI power off function?
Yes, CONFIG_IPMI_POWEROFF
Ok. This is set as a module in my config. Maybe I should blacklist
this module from loading.

Thanks for your help.

-mandeep
Post by Corey Minyard
-corey
Post by Mandeep Sandhu
Thanks for your time.
Regards,
-mandeep
Post by Corey Minyard
-corey
Post by Mandeep Sandhu
Thanks,
-mandeep
Loading...