openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Check on bypass phosphor-discover-system-state@.service if BMC not boot from A/C
@ 2022-02-18  7:36 Thang Nguyen OS
  2022-02-18 16:14 ` Andrew Geissler
  0 siblings, 1 reply; 3+ messages in thread
From: Thang Nguyen OS @ 2022-02-18  7:36 UTC (permalink / raw)
  To: openbmc

[-- Attachment #1: Type: text/plain, Size: 1559 bytes --]

Hi,

We have chassis power policy that users configure so that the Host power 
can be recovered via the setting. In phosphor-state-manager, there is 
phosphor-discover-system-state@.service service to check the power 
restore policy and recover the Host via the policy users configured 
(always-on, always-off, previous). The problem is that when BMC is 
rebooted, the service should not be executed as Host power status should 
not be changed in this case.

Previously, we added a patch in u-boot to add reboot cause to the 
command line, like:

    # cat /proc/cmdline
    console=ttyS4,115200n8 root=/dev/ram rw resetreason=power

Then, add condition to the service to just execute when resetreason=power:

    [Unit]
    ConditionKernelCommandLine=resetreason=power

as now no u-boot patch inside meta-<vendor> is permitted, this approach 
is no longer applicable.

Since the BMC reboot cause feature by Tim Lee at 
https://github.com/openbmc/phosphor-state-manager/commit/2bfb1efc4bc7e781224e19c05b51e6675f13a488 
and with the watchdog driver support, we have the reset cause 
information via both dbus and kernel /sys:

    # cat /sys/class/watchdog/watchdog0/bootstatus
    32

    # busctl get-property xyz.openbmc_project.State.BMC
    /xyz/openbmc_project/state/bmc0 xyz.openbmc_project.State.BMC
    LastRebootCause

    s "xyz.openbmc_project.State.BMC.RebootCause.POR"

I would like to check if you have any idea on how to use the above 
information to prevent the power restore policy executed in case of BMC 
reboot.


Thanks,

Thang Q. Nguyen

[-- Attachment #2: Type: text/html, Size: 2307 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Check on bypass phosphor-discover-system-state@.service if BMC not boot from A/C
  2022-02-18  7:36 Check on bypass phosphor-discover-system-state@.service if BMC not boot from A/C Thang Nguyen OS
@ 2022-02-18 16:14 ` Andrew Geissler
  2022-02-21  5:51   ` Thang Nguyen OS
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Geissler @ 2022-02-18 16:14 UTC (permalink / raw)
  To: Thang Nguyen OS; +Cc: openbmc



> On Feb 18, 2022, at 1:36 AM, Thang Nguyen OS <thang@amperemail.onmicrosoft.com> wrote:
< snip>
> # busctl get-property xyz.openbmc_project.State.BMC /xyz/openbmc_project/state/bmc0 xyz.openbmc_project.State.BMC LastRebootCause
> 
> s "xyz.openbmc_project.State.BMC.RebootCause.POR"
> 
> I would like to check if you have any idea on how to use the above information to prevent the power restore policy executed in case of BMC reboot.
> 
Sounds a lot like what I’m doing in https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-state-manager/+/50706. IBM has a requirement to not
start power restore policy when the system is reset due to a pinhole reset. I imagine you could just add a check like mine for yours as well.

> 
> 
> Thanks,
> 
> Thang Q. Nguyen 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Check on bypass phosphor-discover-system-state@.service if BMC not boot from A/C
  2022-02-18 16:14 ` Andrew Geissler
@ 2022-02-21  5:51   ` Thang Nguyen OS
  0 siblings, 0 replies; 3+ messages in thread
From: Thang Nguyen OS @ 2022-02-21  5:51 UTC (permalink / raw)
  To: Andrew Geissler; +Cc: openbmc


On 18/02/2022 23:14, Andrew Geissler wrote:
> [EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please be mindful of safe email handling and proprietary information protection practices.]
>
>
>> On Feb 18, 2022, at 1:36 AM, Thang Nguyen OS <thang@amperemail.onmicrosoft.com> wrote:
> < snip>
>> # busctl get-property xyz.openbmc_project.State.BMC /xyz/openbmc_project/state/bmc0 xyz.openbmc_project.State.BMC LastRebootCause
>>
>> s "xyz.openbmc_project.State.BMC.RebootCause.POR"
>>
>> I would like to check if you have any idea on how to use the above information to prevent the power restore policy executed in case of BMC reboot.
>>
> Sounds a lot like what I’m doing in https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-state-manager/+/50706. IBM has a requirement to not
> start power restore policy when the system is reset due to a pinhole reset. I imagine you could just add a check like mine for yours as well.

Thanks a lot for your information. It works for me. I tested on my 
Mt.Jade system with adding condition to bypass the policy when 
bmcRebootCause is xyz.openbmc_project.State.BMC.RebootCause.Watchdog

      } else if (bmcRebootCause ==
         "xyz.openbmc_project.State.BMC.RebootCause.Watchdog")
     {
         info(
             "BMC was reset due to soft reset, no power restore policy 
will be run");
         return 0;
     }

>
>>
>> Thanks,
>>
>> Thang Q. Nguyen
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-21  5:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18  7:36 Check on bypass phosphor-discover-system-state@.service if BMC not boot from A/C Thang Nguyen OS
2022-02-18 16:14 ` Andrew Geissler
2022-02-21  5:51   ` Thang Nguyen OS

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).