openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Enable/Disable some sensors when Host On/Off
@ 2020-10-18 13:58 Thu Ba Nguyen
  2020-10-19 14:16 ` Matt Spinler
  2020-10-19 17:31 ` Ed Tanous
  0 siblings, 2 replies; 24+ messages in thread
From: Thu Ba Nguyen @ 2020-10-18 13:58 UTC (permalink / raw)
  To: openbmc

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

Dear,

I'm supporting the host sensors for Ampere Computing LLC platform.
We are using phosphor-hwmon to update values of sensors and monitoring
sensors warning/errors base on threshold setting.

There are some sensors which are turned off when host Off. It can be the
sensors reported by host or voltage/temperature/power sensors  which use
the same power source with host.

I researched in openBmc sensor-architecture documents but can't find any
option to enable/disable sensors base on one status or GPIO pins. I can't
use REMOVERCS.

Research in phosphor-hwmon code, I don't see the answer too.

Do we have any options/solution to Enable/Disable some sensors when Host
On/Off?

Thanks.
Thu Nguyen.

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-18 13:58 Enable/Disable some sensors when Host On/Off Thu Ba Nguyen
@ 2020-10-19 14:16 ` Matt Spinler
  2020-10-19 15:23   ` Thu Ba Nguyen
  2020-10-19 17:31 ` Ed Tanous
  1 sibling, 1 reply; 24+ messages in thread
From: Matt Spinler @ 2020-10-19 14:16 UTC (permalink / raw)
  To: Thu Ba Nguyen, openbmc



On 10/18/2020 8:58 AM, Thu Ba Nguyen wrote:
> Dear, I'm supporting the host sensors for Ampere Computing LLC 
> platform. We are...
> This Message Is From an External Sender
> This message came from outside your organization.
>
> Dear,
>
> I'm supporting the host sensors for Ampere Computing LLC platform.
> We are using phosphor-hwmon to update values of sensors and monitoring 
> sensors warning/errors base on threshold setting.
>
> There are some sensors which are turned off when host Off. It can be 
> the sensors reported by host or voltage/temperature/power sensors 
>  which use the same power source with host.
>
> I researched in openBmc sensor-architecture documents but can't find 
> any option to enable/disable sensors base on one status or GPIO pins. 
> I can't use REMOVERCS.
>
> Research in phosphor-hwmon code, I don't see the answer too.
>
> Do we have any options/solution to Enable/Disable some sensors when 
> Host On/Off?

Hi,
The phosphor-hwmon code doesn't support that yet.  It has been discussed 
before but nobody
has implemented it.

>
> Thanks.
> Thu Nguyen.


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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-19 14:16 ` Matt Spinler
@ 2020-10-19 15:23   ` Thu Ba Nguyen
  2020-10-20 13:46     ` Matt Spinler
  0 siblings, 1 reply; 24+ messages in thread
From: Thu Ba Nguyen @ 2020-10-19 15:23 UTC (permalink / raw)
  To: Matt Spinler; +Cc: openbmc

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

Thanks for your reply Matt Spinler,

Can you show me the discussion threads?

I also thought about the solution for that features:
In the current hwmon we support GPIOCHIP + GPIO option which used to enable
sensors to read. In the hwmon code, we just set that pin and wait before
reading.
I think we can support a similar option named GPIOENABLE + GPIOV. When the
status of Gpio pin defind in GPIOEANBLE match with GPIOV.
That sensors will be read and update to Dbus.
If not it will be removed from DBus until the GPIO pin math GPIOV.
Maybe we can have many different solutions.

If you don't mind, can you tell me how IBM supports that features?

Regards.
Thu Nguyen.

On Mon, Oct 19, 2020 at 9:16 PM Matt Spinler <mspinler@linux.ibm.com> wrote:

>
>
> On 10/18/2020 8:58 AM, Thu Ba Nguyen wrote:
> > Dear, I'm supporting the host sensors for Ampere Computing LLC
> > platform. We are...
> > This Message Is From an External Sender
> > This message came from outside your organization.
> >
> > Dear,
> >
> > I'm supporting the host sensors for Ampere Computing LLC platform.
> > We are using phosphor-hwmon to update values of sensors and monitoring
> > sensors warning/errors base on threshold setting.
> >
> > There are some sensors which are turned off when host Off. It can be
> > the sensors reported by host or voltage/temperature/power sensors
> >  which use the same power source with host.
> >
> > I researched in openBmc sensor-architecture documents but can't find
> > any option to enable/disable sensors base on one status or GPIO pins.
> > I can't use REMOVERCS.
> >
> > Research in phosphor-hwmon code, I don't see the answer too.
> >
> > Do we have any options/solution to Enable/Disable some sensors when
> > Host On/Off?
>
> Hi,
> The phosphor-hwmon code doesn't support that yet.  It has been discussed
> before but nobody
> has implemented it.
>
> >
> > Thanks.
> > Thu Nguyen.
>
>

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-18 13:58 Enable/Disable some sensors when Host On/Off Thu Ba Nguyen
  2020-10-19 14:16 ` Matt Spinler
@ 2020-10-19 17:31 ` Ed Tanous
  2020-10-19 18:22   ` Thu Ba Nguyen
  1 sibling, 1 reply; 24+ messages in thread
From: Ed Tanous @ 2020-10-19 17:31 UTC (permalink / raw)
  To: Thu Ba Nguyen; +Cc: OpenBMC Maillist

On Sun, Oct 18, 2020 at 7:00 AM Thu Ba Nguyen <tbnguyen1985@gmail.com> wrote:
>
> Do we have any options/solution to Enable/Disable some sensors when Host On/Off?

I believe this is already supported in the entity-manager/dbus-sensors
stack, with the "PowerState" parameter in the EM configuration;

example:
https://github.com/openbmc/entity-manager/blob/def29274907ef77187b02ae19d55bb9888413892/configurations/WFT%20Baseboard.json#L6

There's also mitigations for the common thresholding issues, like a
power state change coming in during the sensor read.

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-19 17:31 ` Ed Tanous
@ 2020-10-19 18:22   ` Thu Ba Nguyen
  2020-10-19 18:31     ` Ed Tanous
  2020-10-21  0:15     ` Vijay Khemka
  0 siblings, 2 replies; 24+ messages in thread
From: Thu Ba Nguyen @ 2020-10-19 18:22 UTC (permalink / raw)
  To: Ed Tanous; +Cc: OpenBMC Maillist

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

Hi Ed Tanous,

Thanks for your info,
But in your platform we are using phosphor-hwmon to manage sensors.
We don't use entity-manager.
As I knew we can't use both entity-manager and phosphor-hwmon for one
project.

Regards
Thu Nguyen.

On Tue, Oct 20, 2020 at 12:31 AM Ed Tanous <ed@tanous.net> wrote:

> On Sun, Oct 18, 2020 at 7:00 AM Thu Ba Nguyen <tbnguyen1985@gmail.com>
> wrote:
> >
> > Do we have any options/solution to Enable/Disable some sensors when Host
> On/Off?
>
> I believe this is already supported in the entity-manager/dbus-sensors
> stack, with the "PowerState" parameter in the EM configuration;
>
> example:
>
> https://github.com/openbmc/entity-manager/blob/def29274907ef77187b02ae19d55bb9888413892/configurations/WFT%20Baseboard.json#L6
>
> There's also mitigations for the common thresholding issues, like a
> power state change coming in during the sensor read.
>

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-19 18:22   ` Thu Ba Nguyen
@ 2020-10-19 18:31     ` Ed Tanous
  2020-10-20 23:05       ` Thu Ba Nguyen
  2020-10-21  0:15     ` Vijay Khemka
  1 sibling, 1 reply; 24+ messages in thread
From: Ed Tanous @ 2020-10-19 18:31 UTC (permalink / raw)
  To: Thu Ba Nguyen; +Cc: OpenBMC Maillist

On Mon, Oct 19, 2020 at 11:22 AM Thu Ba Nguyen <tbnguyen1985@gmail.com> wrote:
>
> Hi Ed Tanous,
>
> Thanks for your info,
> But in your platform we are using phosphor-hwmon to manage sensors.
> We don't use entity-manager.
> As I knew we can't use both entity-manager and phosphor-hwmon for one project.

Understood.  i was mostly just pointing out that there might be
logic/implementation details you can pull over into phosphor-hwmon.

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-19 15:23   ` Thu Ba Nguyen
@ 2020-10-20 13:46     ` Matt Spinler
  2020-10-20 14:18       ` Patrick Williams
  2020-10-20 23:16       ` Thu Ba Nguyen
  0 siblings, 2 replies; 24+ messages in thread
From: Matt Spinler @ 2020-10-20 13:46 UTC (permalink / raw)
  To: Thu Ba Nguyen; +Cc: openbmc



On 10/19/2020 10:23 AM, Thu Ba Nguyen wrote:
> Thanks for your reply Matt Spinler, Can you show me the discussion 
> threads? I also...
> This Message Is From an External Sender
> This message came from outside your organization.
>
> Thanks for your reply Matt Spinler,
>
> Can you show me the discussion threads?

Sure: https://lists.ozlabs.org/pipermail/openbmc/2019-October/018967.html

>
> I also thought about the solution for that features:
> In the current hwmon we support GPIOCHIP + GPIO option which used to 
> enable sensors to read. In the hwmon code, we just set that pin and 
> wait before reading.
> I think we can support a similar option named GPIOENABLE + GPIOV. When 
> the status of Gpio pin defind in GPIOEANBLE match with GPIOV.
> That sensors will be read and update to Dbus.
> If not it will be removed from DBus until the GPIO pin math GPIOV.
> Maybe we can have many different solutions.

As Ed mentioned, I think a good direction to start with is how 
dbus-sensors handles it, so we  can have
common behavior.  I believe they look at the host state D-Bus property 
and still keep the sensor
on D-Bus even when power is off.

>
> If you don't mind, can you tell me how IBM supports that features?

We lucked out out in that the driver was only loaded when power was on.

>
> Regards.
> Thu Nguyen.
>
> On Mon, Oct 19, 2020 at 9:16 PM Matt Spinler <mspinler@linux.ibm.com 
> <mailto:mspinler@linux.ibm.com>> wrote:
>
>
>
>     On 10/18/2020 8:58 AM, Thu Ba Nguyen wrote:
>     > Dear, I'm supporting the host sensors for Ampere Computing LLC
>     > platform. We are...
>     > This Message Is From an External Sender
>     > This message came from outside your organization.
>     >
>     > Dear,
>     >
>     > I'm supporting the host sensors for Ampere Computing LLC platform.
>     > We are using phosphor-hwmon to update values of sensors and
>     monitoring
>     > sensors warning/errors base on threshold setting.
>     >
>     > There are some sensors which are turned off when host Off. It
>     can be
>     > the sensors reported by host or voltage/temperature/power sensors
>     >  which use the same power source with host.
>     >
>     > I researched in openBmc sensor-architecture documents but can't
>     find
>     > any option to enable/disable sensors base on one status or GPIO
>     pins.
>     > I can't use REMOVERCS.
>     >
>     > Research in phosphor-hwmon code, I don't see the answer too.
>     >
>     > Do we have any options/solution to Enable/Disable some sensors when
>     > Host On/Off?
>
>     Hi,
>     The phosphor-hwmon code doesn't support that yet.  It has been
>     discussed
>     before but nobody
>     has implemented it.
>
>     >
>     > Thanks.
>     > Thu Nguyen.
>


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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-20 13:46     ` Matt Spinler
@ 2020-10-20 14:18       ` Patrick Williams
  2020-10-20 21:26         ` Matt Spinler
                           ` (2 more replies)
  2020-10-20 23:16       ` Thu Ba Nguyen
  1 sibling, 3 replies; 24+ messages in thread
From: Patrick Williams @ 2020-10-20 14:18 UTC (permalink / raw)
  To: Matt Spinler; +Cc: openbmc, Thu Ba Nguyen

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

On Tue, Oct 20, 2020 at 08:46:30AM -0500, Matt Spinler wrote:
> 
> 
> On 10/19/2020 10:23 AM, Thu Ba Nguyen wrote:
> > 
> > I also thought about the solution for that features:
> > In the current hwmon we support GPIOCHIP + GPIO option which used to
> > enable sensors to read. In the hwmon code, we just set that pin and wait
> > before reading.
> > I think we can support a similar option named GPIOENABLE + GPIOV. When
> > the status of Gpio pin defind in GPIOEANBLE match with GPIOV.
> > That sensors will be read and update to Dbus.
> > If not it will be removed from DBus until the GPIO pin math GPIOV.
> > Maybe we can have many different solutions.
...
> > 
> > If you don't mind, can you tell me how IBM supports that features?
> 
> We lucked out out in that the driver was only loaded when power was on.
> 

Hi Thu,

Is this something you could do similarly?  Rather than have the driver
understand the GPIO directly you can trigger a phosphor-gpio-monitor
service that does a 'bind' / 'unbind' to dynamically enable and disable
the hwmon driver?

Matt, is that how you have the driver configured to load / unload (I
assume your case is for the OCC).

-- 
Patrick Williams

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-20 14:18       ` Patrick Williams
@ 2020-10-20 21:26         ` Matt Spinler
  2020-10-20 23:21         ` Thu Ba Nguyen
  2020-10-20 23:39         ` Thu Ba Nguyen
  2 siblings, 0 replies; 24+ messages in thread
From: Matt Spinler @ 2020-10-20 21:26 UTC (permalink / raw)
  To: Patrick Williams; +Cc: openbmc, Thu Ba Nguyen



On 10/20/2020 9:18 AM, Patrick Williams wrote:
> On Tue, Oct 20, 2020 at 08:46:30AM -0500, Matt Spinler wrote:
>>
>> On 10/19/2020 10:23 AM, Thu Ba Nguyen wrote:
>>> I also thought about the solution for that features:
>>> In the current hwmon we support GPIOCHIP + GPIO option which used to
>>> enable sensors to read. In the hwmon code, we just set that pin and wait
>>> before reading.
>>> I think we can support a similar option named GPIOENABLE + GPIOV. When
>>> the status of Gpio pin defind in GPIOEANBLE match with GPIOV.
>>> That sensors will be read and update to Dbus.
>>> If not it will be removed from DBus until the GPIO pin math GPIOV.
>>> Maybe we can have many different solutions.
> ...
>>> If you don't mind, can you tell me how IBM supports that features?
>> We lucked out out in that the driver was only loaded when power was on.
>>
> Hi Thu,
>
> Is this something you could do similarly?  Rather than have the driver
> understand the GPIO directly you can trigger a phosphor-gpio-monitor
> service that does a 'bind' / 'unbind' to dynamically enable and disable
> the hwmon driver?
>
> Matt, is that how you have the driver configured to load / unload (I
> assume your case is for the OCC).

We use a slightly different mechanism since we need to wait for the host
to tell us the device is running (yea it's the OCC), but same general idea.

>


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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-19 18:31     ` Ed Tanous
@ 2020-10-20 23:05       ` Thu Ba Nguyen
  0 siblings, 0 replies; 24+ messages in thread
From: Thu Ba Nguyen @ 2020-10-20 23:05 UTC (permalink / raw)
  To: Ed Tanous; +Cc: OpenBMC Maillist

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

On Tue, Oct 20, 2020 at 1:32 AM Ed Tanous <ed@tanous.net> wrote:

> On Mon, Oct 19, 2020 at 11:22 AM Thu Ba Nguyen <tbnguyen1985@gmail.com>
> wrote:
> >
> > Hi Ed Tanous,
> >
> > Thanks for your info,
> > But in your platform we are using phosphor-hwmon to manage sensors.
> > We don't use entity-manager.
> > As I knew we can't use both entity-manager and phosphor-hwmon for one
> project.
>
> Understood.  i was mostly just pointing out that there might be
> logic/implementation details you can pull over into phosphor-hwmon.
>

 I think adding a "PowerState" configuration in each sensor is a good
solution.
 We can use this configuration to identify the concerning host sensors in
phosphor-hwmon.
 Those sensors will be removed from Dbus when
xyz.openbmc_project.State.Host.HostState is Off.
 And they will be back to Dbus when the host is On.

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-20 13:46     ` Matt Spinler
  2020-10-20 14:18       ` Patrick Williams
@ 2020-10-20 23:16       ` Thu Ba Nguyen
  1 sibling, 0 replies; 24+ messages in thread
From: Thu Ba Nguyen @ 2020-10-20 23:16 UTC (permalink / raw)
  To: Matt Spinler; +Cc: OpenBMC Maillist

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

On Tue, Oct 20, 2020 at 8:46 PM Matt Spinler <mspinler@linux.ibm.com> wrote:

>
>
> On 10/19/2020 10:23 AM, Thu Ba Nguyen wrote:
> > Thanks for your reply Matt Spinler, Can you show me the discussion
> > threads? I also...
> > This Message Is From an External Sender
> > This message came from outside your organization.
> >
> > Thanks for your reply Matt Spinler,
> >
> > Can you show me the discussion threads?
>
> Sure: https://lists.ozlabs.org/pipermail/openbmc/2019-October/018967.html
>
> >
> > I also thought about the solution for that features:
> > In the current hwmon we support GPIOCHIP + GPIO option which used to
> > enable sensors to read. In the hwmon code, we just set that pin and
> > wait before reading.
> > I think we can support a similar option named GPIOENABLE + GPIOV. When
> > the status of Gpio pin defind in GPIOEANBLE match with GPIOV.
> > That sensors will be read and update to Dbus.
> > If not it will be removed from DBus until the GPIO pin math GPIOV.
> > Maybe we can have many different solutions.
>
> As Ed mentioned, I think a good direction to start with is how
> dbus-sensors handles it, so we  can have
> common behavior.  I believe they look at the host state D-Bus property
> and still keep the sensor
> on D-Bus even when power is off.
>

[Thu] Yah, I think  using the host state D-Bus property to verify host
state.
Then handling the host sensors based on this status is a better solution.
Keeping the sensors on Dbus can cause the value or the status of
warning/critical value of sensors
is out update. I expected that the host sensors will be removed from Dbus
when the host is off.

>
> > If you don't mind, can you tell me how IBM supports that features?
>
> We lucked out out in that the driver was only loaded when power was on.
>
[Thu] What will be displayed when you open health --> sensors page in
OpenBmc web?
Are the host sensors still there and value is "na" or some things like that?

>
> >
> > Regards.
> > Thu Nguyen.
> >
> > On Mon, Oct 19, 2020 at 9:16 PM Matt Spinler <mspinler@linux.ibm.com
> > <mailto:mspinler@linux.ibm.com>> wrote:
> >
> >
> >
> >     On 10/18/2020 8:58 AM, Thu Ba Nguyen wrote:
> >     > Dear, I'm supporting the host sensors for Ampere Computing LLC
> >     > platform. We are...
> >     > This Message Is From an External Sender
> >     > This message came from outside your organization.
> >     >
> >     > Dear,
> >     >
> >     > I'm supporting the host sensors for Ampere Computing LLC platform.
> >     > We are using phosphor-hwmon to update values of sensors and
> >     monitoring
> >     > sensors warning/errors base on threshold setting.
> >     >
> >     > There are some sensors which are turned off when host Off. It
> >     can be
> >     > the sensors reported by host or voltage/temperature/power sensors
> >     >  which use the same power source with host.
> >     >
> >     > I researched in openBmc sensor-architecture documents but can't
> >     find
> >     > any option to enable/disable sensors base on one status or GPIO
> >     pins.
> >     > I can't use REMOVERCS.
> >     >
> >     > Research in phosphor-hwmon code, I don't see the answer too.
> >     >
> >     > Do we have any options/solution to Enable/Disable some sensors when
> >     > Host On/Off?
> >
> >     Hi,
> >     The phosphor-hwmon code doesn't support that yet.  It has been
> >     discussed
> >     before but nobody
> >     has implemented it.
> >
> >     >
> >     > Thanks.
> >     > Thu Nguyen.
> >
>
>

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-20 14:18       ` Patrick Williams
  2020-10-20 21:26         ` Matt Spinler
@ 2020-10-20 23:21         ` Thu Ba Nguyen
  2020-10-20 23:39         ` Thu Ba Nguyen
  2 siblings, 0 replies; 24+ messages in thread
From: Thu Ba Nguyen @ 2020-10-20 23:21 UTC (permalink / raw)
  To: Patrick Williams; +Cc: OpenBMC Maillist, Matt Spinler

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

On Tue, Oct 20, 2020 at 9:18 PM Patrick Williams <patrick@stwcx.xyz> wrote:

> On Tue, Oct 20, 2020 at 08:46:30AM -0500, Matt Spinler wrote:
> >
> >
> > On 10/19/2020 10:23 AM, Thu Ba Nguyen wrote:
> > >
> > > I also thought about the solution for that features:
> > > In the current hwmon we support GPIOCHIP + GPIO option which used to
> > > enable sensors to read. In the hwmon code, we just set that pin and
> wait
> > > before reading.
> > > I think we can support a similar option named GPIOENABLE + GPIOV. When
> > > the status of Gpio pin defind in GPIOEANBLE match with GPIOV.
> > > That sensors will be read and update to Dbus.
> > > If not it will be removed from DBus until the GPIO pin math GPIOV.
> > > Maybe we can have many different solutions.
> ...
> > >
> > > If you don't mind, can you tell me how IBM supports that features?
> >
> > We lucked out out in that the driver was only loaded when power was on.
> >
>
> Hi Thu,
>
> Is this something you could do similarly?  Rather than have the driver
> understand the GPIO directly you can trigger a phosphor-gpio-monitor
> service that does a 'bind' / 'unbind' to dynamically enable and disable
> the hwmon driver?
>
> The load/unload OCC will only affect on host sensors which are provided by
OCC.
For sensors which use the same power domain with the host, they still are
read and updated to the value to Dbus.


> Matt, is that how you have the driver configured to load / unload (I
> assume your case is for the OCC).
>
> --
> Patrick Williams
>

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-20 14:18       ` Patrick Williams
  2020-10-20 21:26         ` Matt Spinler
  2020-10-20 23:21         ` Thu Ba Nguyen
@ 2020-10-20 23:39         ` Thu Ba Nguyen
  2 siblings, 0 replies; 24+ messages in thread
From: Thu Ba Nguyen @ 2020-10-20 23:39 UTC (permalink / raw)
  To: Patrick Williams; +Cc: OpenBMC Maillist, Matt Spinler, Ed Tanous

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

I am also concerned about phosphor-hwmon keep reading sensors in Dbus.
Even those sensors are off or not available when the host is off.

The other thing is the value of sensors which are using the same power
domain with the host in the time host changing status.
It can be invalid value and should be ignored.
These sensors should be removed from Dbus when the host starts off/on.


On Tue, Oct 20, 2020 at 9:18 PM Patrick Williams <patrick@stwcx.xyz> wrote:

> On Tue, Oct 20, 2020 at 08:46:30AM -0500, Matt Spinler wrote:
> >
> >
> > On 10/19/2020 10:23 AM, Thu Ba Nguyen wrote:
> > >
> > > I also thought about the solution for that features:
> > > In the current hwmon we support GPIOCHIP + GPIO option which used to
> > > enable sensors to read. In the hwmon code, we just set that pin and
> wait
> > > before reading.
> > > I think we can support a similar option named GPIOENABLE + GPIOV. When
> > > the status of Gpio pin defind in GPIOEANBLE match with GPIOV.
> > > That sensors will be read and update to Dbus.
> > > If not it will be removed from DBus until the GPIO pin math GPIOV.
> > > Maybe we can have many different solutions.
> ...
> > >
> > > If you don't mind, can you tell me how IBM supports that features?
> >
> > We lucked out out in that the driver was only loaded when power was on.
> >
>
> Hi Thu,
>
> Is this something you could do similarly?  Rather than have the driver
> understand the GPIO directly you can trigger a phosphor-gpio-monitor
> service that does a 'bind' / 'unbind' to dynamically enable and disable
> the hwmon driver?
>
> Matt, is that how you have the driver configured to load / unload (I
> assume your case is for the OCC).
>
> --
> Patrick Williams
>

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-19 18:22   ` Thu Ba Nguyen
  2020-10-19 18:31     ` Ed Tanous
@ 2020-10-21  0:15     ` Vijay Khemka
  2020-10-21 16:54       ` Thu Ba Nguyen
  1 sibling, 1 reply; 24+ messages in thread
From: Vijay Khemka @ 2020-10-21  0:15 UTC (permalink / raw)
  To: Thu Ba Nguyen, Ed Tanous; +Cc: OpenBMC Maillist

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



From: openbmc <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org> on behalf of Thu Ba Nguyen <tbnguyen1985@gmail.com>
Date: Monday, October 19, 2020 at 11:23 AM
To: Ed Tanous <ed@tanous.net>
Cc: OpenBMC Maillist <openbmc@lists.ozlabs.org>
Subject: Re: Enable/Disable some sensors when Host On/Off

Hi Ed Tanous,

> Thanks for your info,
> But in your platform we are using phosphor-hwmon to manage sensors.
> We don't use entity-manager.
> As I knew we can't use both entity-manager and phosphor-hwmon for one project.

You can use both but for different sensors. You can decide what sensors to configure
via EM/dbus-sensors and which one for phosphor-hwmon.

Regards
Thu Nguyen.

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-21  0:15     ` Vijay Khemka
@ 2020-10-21 16:54       ` Thu Ba Nguyen
  2020-10-22 14:49         ` Thu Ba Nguyen
  0 siblings, 1 reply; 24+ messages in thread
From: Thu Ba Nguyen @ 2020-10-21 16:54 UTC (permalink / raw)
  To: Vijay Khemka; +Cc: OpenBMC Maillist, Ed Tanous

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

Hi Vijay,

I took a look on entity-manager and openbmc source.
Don't have many companies  using entity-manager model to support sensors.

Regards
Thu Nguyen.


On Wed, Oct 21, 2020 at 7:15 AM Vijay Khemka <vijaykhemka@fb.com> wrote:

>
>
>
>
> *From: *openbmc <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org> on
> behalf of Thu Ba Nguyen <tbnguyen1985@gmail.com>
> *Date: *Monday, October 19, 2020 at 11:23 AM
> *To: *Ed Tanous <ed@tanous.net>
> *Cc: *OpenBMC Maillist <openbmc@lists.ozlabs.org>
> *Subject: *Re: Enable/Disable some sensors when Host On/Off
>
>
>
> Hi Ed Tanous,
>
>
>
> > Thanks for your info,
>
> > But in your platform we are using phosphor-hwmon to manage sensors.
>
> > We don't use entity-manager.
>
> > As I knew we can't use both entity-manager and phosphor-hwmon for one
> project.
>
>
>
> You can use both but for different sensors. You can decide what sensors to
> configure
>
> via EM/dbus-sensors and which one for phosphor-hwmon.
>
>
>
> Regards
>
> Thu Nguyen.
>

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-21 16:54       ` Thu Ba Nguyen
@ 2020-10-22 14:49         ` Thu Ba Nguyen
  2020-10-22 15:51           ` Matt Spinler
  0 siblings, 1 reply; 24+ messages in thread
From: Thu Ba Nguyen @ 2020-10-22 14:49 UTC (permalink / raw)
  To: Vijay Khemka, Matt Spinler, Patrick Williams; +Cc: OpenBMC Maillist

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

I started on supporting enable/disable host sensors.
Everythings is fine until I add code to monitor host status as below.
bool MainLoop::isHostOn(void)
{
char buff[128];

if (!powerMatch)
{
log<level::ERR>("Power Match Not Created");
}
sprintf(buff, "isHostOn powerStatusOn: %d\n",powerStatusOn);
log<level::INFO>(buff);
return powerStatusOn;
}

std::shared_ptr<sdbusplus::bus::match::match>
MainLoop::startHostStateMonitor(void) {
return std::make_shared<sdbusplus::bus::match::match>(
*conn,
"type='signal',interface='org.freedesktop.DBus.Properties',"
"member='PropertiesChanged',arg0='xyz.openbmc_project.State.Host'",
[](sdbusplus::message::message &msg) {
std::string interfaceName;
boost::container::flat_map<std::string, std::variant<std::string>>
propertiesChanged;
try {
msg.read(interfaceName, propertiesChanged);
} catch (std::exception &e) {
log<level::ERR>("Unable to read host state\n");
return;
}
// We only want to check for CurrentHostState
if (propertiesChanged.begin()->first != "CurrentHostState") {
return;
}
auto findState = propertiesChanged.find(powProperty);
if (findState != propertiesChanged.end())
{
powerStatusOn = boost::ends_with(
std::get<std::string>(findState->second), "Running");
}
powerMatch = true;
});
}

void MainLoop::read()
{
// TODO: Issue#3 - Need to make calls to the dbus sensor cache here to
// ensure the objects all exist?

/* Host changed state from On to Off */
if (!isHostOn() && (lastPowerState == HOST_ON ||
lastPowerState == HOST_NA)) {
removeHostSensors();
lastPowerState = HOST_OFF;
}

/* Host changed state from Off to On */
if (isHostOn() && lastPowerState == HOST_OFF) {
addDroppedHostSensors();
lastPowerState = HOST_ON;
}

When build openBMC I got error:
tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
error adding symbols: DSO missing from command line
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1

It seems I need adding the threads lib to defend lib.
Any suggestion to add threads lib to build configuration?

Thanks.
Thu.

On Wed, Oct 21, 2020 at 11:54 PM Thu Ba Nguyen <tbnguyen1985@gmail.com>
wrote:

> Hi Vijay,
>
> I took a look on entity-manager and openbmc source.
> Don't have many companies  using entity-manager model to support sensors.
>
> Regards
> Thu Nguyen.
>
>
> On Wed, Oct 21, 2020 at 7:15 AM Vijay Khemka <vijaykhemka@fb.com> wrote:
>
>>
>>
>>
>>
>> *From: *openbmc <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org> on
>> behalf of Thu Ba Nguyen <tbnguyen1985@gmail.com>
>> *Date: *Monday, October 19, 2020 at 11:23 AM
>> *To: *Ed Tanous <ed@tanous.net>
>> *Cc: *OpenBMC Maillist <openbmc@lists.ozlabs.org>
>> *Subject: *Re: Enable/Disable some sensors when Host On/Off
>>
>>
>>
>> Hi Ed Tanous,
>>
>>
>>
>> > Thanks for your info,
>>
>> > But in your platform we are using phosphor-hwmon to manage sensors.
>>
>> > We don't use entity-manager.
>>
>> > As I knew we can't use both entity-manager and phosphor-hwmon for one
>> project.
>>
>>
>>
>> You can use both but for different sensors. You can decide what sensors
>> to configure
>>
>> via EM/dbus-sensors and which one for phosphor-hwmon.
>>
>>
>>
>> Regards
>>
>> Thu Nguyen.
>>
>

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-22 14:49         ` Thu Ba Nguyen
@ 2020-10-22 15:51           ` Matt Spinler
  2020-10-22 22:45             ` Thu Ba Nguyen
  0 siblings, 1 reply; 24+ messages in thread
From: Matt Spinler @ 2020-10-22 15:51 UTC (permalink / raw)
  To: Thu Ba Nguyen, Vijay Khemka, Patrick Williams; +Cc: OpenBMC Maillist



On 10/22/2020 9:49 AM, Thu Ba Nguyen wrote:
> I started on supporting enable/disable host sensors. Everythings is 
> fine until I...
> This Message Is From an External Sender
> This message came from outside your organization.
>
> I started on supporting enable/disable host sensors.
> Everythings is fine until I add code to monitor host status as below.
> bool MainLoop::isHostOn(void)
> {
> char buff[128];
> if (!powerMatch)
> {
> log<level::ERR>("Power Match Not Created");
> }
> sprintf(buff, "isHostOn powerStatusOn: %d\n",powerStatusOn);
> log<level::INFO>(buff);
> return powerStatusOn;
> }
> std::shared_ptr<sdbusplus::bus::match::match>
> MainLoop::startHostStateMonitor(void) {
> return std::make_shared<sdbusplus::bus::match::match>(
> *conn,
> "type='signal',interface='org.freedesktop.DBus.Properties',"
> "member='PropertiesChanged',arg0='xyz.openbmc_project.State.Host'",
> [](sdbusplus::message::message &msg) {
> std::string interfaceName;
> boost::container::flat_map<std::string, std::variant<std::string>>
> propertiesChanged;
> try {
> msg.read(interfaceName, propertiesChanged);
> } catch (std::exception &e) {
> log<level::ERR>("Unable to read host state\n");
> return;
> }
> // We only want to check for CurrentHostState
> if (propertiesChanged.begin()->first != "CurrentHostState") {
> return;
> }
> auto findState = propertiesChanged.find(powProperty);
> if (findState != propertiesChanged.end())
> {
> powerStatusOn = boost::ends_with(
> std::get<std::string>(findState->second), "Running");
> }
> powerMatch = true;
> });
> }
> void MainLoop::read()
> {
> // TODO: Issue#3 - Need to make calls to the dbus sensor cache here to
> // ensure the objects all exist?
> /* Host changed state from On to Off */
> if (!isHostOn() && (lastPowerState == HOST_ON ||
> lastPowerState == HOST_NA)) {
> removeHostSensors();
> lastPowerState = HOST_OFF;
> }
> /* Host changed state from Off to On */
> if (isHostOn() && lastPowerState == HOST_OFF) {
> addDroppedHostSensors();
> lastPowerState = HOST_ON;
> }
> When build openBMC I got error:
> tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0: 
> error adding symbols: DSO missing from command line
> | collect2: error: ld returned 1 exit status
> | make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1
>
> It seems I need adding the threads lib to defend lib.
> Any suggestion to add threads lib to build configuration?
>

That must be because you're using that single boost function?  While you 
could add the dependency,
the ideal thing to do since this repo already uses 
phosphor-dbus-interfaces is to use the function:

         /** @brief Convert a string to an appropriate enum value.
          *  @param[in] s - The string to convert in the form of
          *                 "xyz.openbmc_project.State.Host.<value name>"
          *  @return - The enum value.
          */
         static HostState convertHostStateFromString(const std::string& s);

to convert it to the actual HostState enum to check against:

         enum class HostState
         {
             Off,
             Running,
             Quiesced,
             DiagnosticMode,
         };

This is all in xyz/openbmc_project/State/Host/server.hpp provided by 
phosphor-dbus-interfaces.

> Thanks.
> Thu.
>
> On Wed, Oct 21, 2020 at 11:54 PM Thu Ba Nguyen <tbnguyen1985@gmail.com 
> <mailto:tbnguyen1985@gmail.com>> wrote:
>
>     Hi Vijay,
>
>     I took a look on entity-manager and openbmc source.
>     Don't have many companies  using entity-manager model to support
>     sensors.
>
>     Regards
>     Thu Nguyen.
>
>
>     On Wed, Oct 21, 2020 at 7:15 AM Vijay Khemka <vijaykhemka@fb.com
>     <mailto:vijaykhemka@fb.com>> wrote:
>
>         *From: *openbmc
>         <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org
>         <mailto:fb.com@lists.ozlabs.org>> on behalf of Thu Ba Nguyen
>         <tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>>
>         *Date: *Monday, October 19, 2020 at 11:23 AM
>         *To: *Ed Tanous <ed@tanous.net <mailto:ed@tanous.net>>
>         *Cc: *OpenBMC Maillist <openbmc@lists.ozlabs.org
>         <mailto:openbmc@lists.ozlabs.org>>
>         *Subject: *Re: Enable/Disable some sensors when Host On/Off
>
>         Hi Ed Tanous,
>
>         > Thanks for your info,
>
>         > But in your platform we are using phosphor-hwmon to manage
>         sensors.
>
>         > We don't use entity-manager.
>
>         > As I knew we can't use both entity-manager and
>         phosphor-hwmon for one project.
>
>         You can use both but for different sensors. You can decide
>         what sensors to configure
>
>         via EM/dbus-sensors and which one for phosphor-hwmon.
>
>         Regards
>
>         Thu Nguyen.
>


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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-22 15:51           ` Matt Spinler
@ 2020-10-22 22:45             ` Thu Ba Nguyen
  2020-11-04  9:15               ` Thu Ba Nguyen
  0 siblings, 1 reply; 24+ messages in thread
From: Thu Ba Nguyen @ 2020-10-22 22:45 UTC (permalink / raw)
  To: Matt Spinler; +Cc: OpenBMC Maillist, Vijay Khemka

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

Just remove all of added code, rebase the phosphor-hwmon source to commit
"5906173 (12 months ago) Brad Bishop: build: add support for building with
meson"

Add the include:
#include <sdbusplus/asio/connection.hpp>
I can see the error
|
/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
phosphor_hwmon_readd-readd.o: undefined reference to symbol
'pthread_key_delete@@GLIBC_2.4'
|
/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
error adding symbols: DSO missing from command line
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1
| make[2]: Leaving directory
'/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
| make[1]: *** [Makefile:801: all-recursive] Error 1
| make[1]: Leaving directory
'/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
| make: *** [Makefile:524: all] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of
'/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/temp/run.do_compile.2045'
failed with exit code 1:
| Makefile:800: target 'check-valgrind-recursive' given more than once in
the same rule
| Makefile:800: target 'check-valgrind-memcheck-recursive' given more than
once in the same rule
| Makefile:800: target 'check-valgrind-helgrind-recursive' given more than
once in the same rule
| Makefile:800: target 'check-valgrind-drd-recursive' given more than once
in the same rule
| Makefile:800: target 'check-valgrind-sgcheck-recursive' given more than
once in the same rule
| make  all-recursive

I think we should add thread lib.

Regards.
Thu Nguyen.


On Thu, Oct 22, 2020 at 10:51 PM Matt Spinler <mspinler@linux.ibm.com>
wrote:

>
>
> On 10/22/2020 9:49 AM, Thu Ba Nguyen wrote:
> > I started on supporting enable/disable host sensors. Everythings is
> > fine until I...
> > This Message Is From an External Sender
> > This message came from outside your organization.
> >
> > I started on supporting enable/disable host sensors.
> > Everythings is fine until I add code to monitor host status as below.
> > bool MainLoop::isHostOn(void)
> > {
> > char buff[128];
> > if (!powerMatch)
> > {
> > log<level::ERR>("Power Match Not Created");
> > }
> > sprintf(buff, "isHostOn powerStatusOn: %d\n",powerStatusOn);
> > log<level::INFO>(buff);
> > return powerStatusOn;
> > }
> > std::shared_ptr<sdbusplus::bus::match::match>
> > MainLoop::startHostStateMonitor(void) {
> > return std::make_shared<sdbusplus::bus::match::match>(
> > *conn,
> > "type='signal',interface='org.freedesktop.DBus.Properties',"
> > "member='PropertiesChanged',arg0='xyz.openbmc_project.State.Host'",
> > [](sdbusplus::message::message &msg) {
> > std::string interfaceName;
> > boost::container::flat_map<std::string, std::variant<std::string>>
> > propertiesChanged;
> > try {
> > msg.read(interfaceName, propertiesChanged);
> > } catch (std::exception &e) {
> > log<level::ERR>("Unable to read host state\n");
> > return;
> > }
> > // We only want to check for CurrentHostState
> > if (propertiesChanged.begin()->first != "CurrentHostState") {
> > return;
> > }
> > auto findState = propertiesChanged.find(powProperty);
> > if (findState != propertiesChanged.end())
> > {
> > powerStatusOn = boost::ends_with(
> > std::get<std::string>(findState->second), "Running");
> > }
> > powerMatch = true;
> > });
> > }
> > void MainLoop::read()
> > {
> > // TODO: Issue#3 - Need to make calls to the dbus sensor cache here to
> > // ensure the objects all exist?
> > /* Host changed state from On to Off */
> > if (!isHostOn() && (lastPowerState == HOST_ON ||
> > lastPowerState == HOST_NA)) {
> > removeHostSensors();
> > lastPowerState = HOST_OFF;
> > }
> > /* Host changed state from Off to On */
> > if (isHostOn() && lastPowerState == HOST_OFF) {
> > addDroppedHostSensors();
> > lastPowerState = HOST_ON;
> > }
> > When build openBMC I got error:
> >
> tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
>
> > error adding symbols: DSO missing from command line
> > | collect2: error: ld returned 1 exit status
> > | make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1
> >
> > It seems I need adding the threads lib to defend lib.
> > Any suggestion to add threads lib to build configuration?
> >
>
> That must be because you're using that single boost function?  While you
> could add the dependency,
> the ideal thing to do since this repo already uses
> phosphor-dbus-interfaces is to use the function:
>
>          /** @brief Convert a string to an appropriate enum value.
>           *  @param[in] s - The string to convert in the form of
>           *                 "xyz.openbmc_project.State.Host.<value name>"
>           *  @return - The enum value.
>           */
>          static HostState convertHostStateFromString(const std::string& s);
>
> to convert it to the actual HostState enum to check against:
>
>          enum class HostState
>          {
>              Off,
>              Running,
>              Quiesced,
>              DiagnosticMode,
>          };
>
> This is all in xyz/openbmc_project/State/Host/server.hpp provided by
> phosphor-dbus-interfaces.
>
> > Thanks.
> > Thu.
> >
> > On Wed, Oct 21, 2020 at 11:54 PM Thu Ba Nguyen <tbnguyen1985@gmail.com
> > <mailto:tbnguyen1985@gmail.com>> wrote:
> >
> >     Hi Vijay,
> >
> >     I took a look on entity-manager and openbmc source.
> >     Don't have many companies  using entity-manager model to support
> >     sensors.
> >
> >     Regards
> >     Thu Nguyen.
> >
> >
> >     On Wed, Oct 21, 2020 at 7:15 AM Vijay Khemka <vijaykhemka@fb.com
> >     <mailto:vijaykhemka@fb.com>> wrote:
> >
> >         *From: *openbmc
> >         <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org
> >         <mailto:fb.com@lists.ozlabs.org>> on behalf of Thu Ba Nguyen
> >         <tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>>
> >         *Date: *Monday, October 19, 2020 at 11:23 AM
> >         *To: *Ed Tanous <ed@tanous.net <mailto:ed@tanous.net>>
> >         *Cc: *OpenBMC Maillist <openbmc@lists.ozlabs.org
> >         <mailto:openbmc@lists.ozlabs.org>>
> >         *Subject: *Re: Enable/Disable some sensors when Host On/Off
> >
> >         Hi Ed Tanous,
> >
> >         > Thanks for your info,
> >
> >         > But in your platform we are using phosphor-hwmon to manage
> >         sensors.
> >
> >         > We don't use entity-manager.
> >
> >         > As I knew we can't use both entity-manager and
> >         phosphor-hwmon for one project.
> >
> >         You can use both but for different sensors. You can decide
> >         what sensors to configure
> >
> >         via EM/dbus-sensors and which one for phosphor-hwmon.
> >
> >         Regards
> >
> >         Thu Nguyen.
> >
>
>

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-10-22 22:45             ` Thu Ba Nguyen
@ 2020-11-04  9:15               ` Thu Ba Nguyen
  2020-11-04 16:31                 ` Matt Spinler
  0 siblings, 1 reply; 24+ messages in thread
From: Thu Ba Nguyen @ 2020-11-04  9:15 UTC (permalink / raw)
  To: Matt Spinler; +Cc: OpenBMC Maillist, Vijay Khemka

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

Hi Matt,

I implemented "Inactive the host sensors" in phosphor-hwmon use below
approaching:
1. Add one option in Sensors configuration, phosphor-hwmon will parse this
option and add host sensors to _hostSensors list.
2. In mainloop::read() before going to loop to read the sensors in the
reading list. Query dbus to get CurrentHostState property.
This property belongs to service "xyz.openbmc_project.State.Host".
Based on the status of this property, identify host status.
If the host is off, remove the host sensors from _state list and dbus. I
expected the users wouldn't see the host sensors on the BMC Web when the
host is off.
If the host is on, add the host sensors back to _state list and also dbus.

The code is working. But I have two issues with this approaching:

1. Too many transactions to get dbus property CurrentHostState.
In my case, I have 6 services to monitor the sensors which concern the host.
With the current interval 1 second of phosphor-hwmon, I have 6 transactions
to get CurrentHostState per seconds.
2. When I call "ipmitool power off" the host, there is a gap between the
time I trigger GPIO to power off the chassis and the time Dbus property
CurrentHostState is updated.
In this gap, the phosphor-hwmon is still reading sensors. And this causes
the threshold warnings or errors. I want to avoid this.

Do you have any suggestions to avoid these issues?

Others question:
I saw that phosphor-hwmon is registering an event to smbus and trigger the
event after each 1 second to read sensors.
Can I change the phosphor-hwmon code to integrate one dbus signal event?
Which will be triggered when there is changing in dbus property.

I knew how to create a service which adds the call back function when there
is change in dbus property.
But don't know how to intergrace it to hwmon.

Regards.
Thu Nguyen.



On Fri, Oct 23, 2020 at 5:45 AM Thu Ba Nguyen <tbnguyen1985@gmail.com>
wrote:

> Just remove all of added code, rebase the phosphor-hwmon source to commit
> "5906173 (12 months ago) Brad Bishop: build: add support for building with
> meson"
>
> Add the include:
> #include <sdbusplus/asio/connection.hpp>
> I can see the error
> |
> /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
> phosphor_hwmon_readd-readd.o: undefined reference to symbol
> 'pthread_key_delete@@GLIBC_2.4'
> |
> /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
> /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
> error adding symbols: DSO missing from command line
> | collect2: error: ld returned 1 exit status
> | make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1
> | make[2]: Leaving directory
> '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
> | make[1]: *** [Makefile:801: all-recursive] Error 1
> | make[1]: Leaving directory
> '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
> | make: *** [Makefile:524: all] Error 2
> | ERROR: oe_runmake failed
> | WARNING: exit code 1 from a shell command.
> | ERROR: Execution of
> '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/temp/run.do_compile.2045'
> failed with exit code 1:
> | Makefile:800: target 'check-valgrind-recursive' given more than once in
> the same rule
> | Makefile:800: target 'check-valgrind-memcheck-recursive' given more than
> once in the same rule
> | Makefile:800: target 'check-valgrind-helgrind-recursive' given more than
> once in the same rule
> | Makefile:800: target 'check-valgrind-drd-recursive' given more than once
> in the same rule
> | Makefile:800: target 'check-valgrind-sgcheck-recursive' given more than
> once in the same rule
> | make  all-recursive
>
> I think we should add thread lib.
>
> Regards.
> Thu Nguyen.
>
>
> On Thu, Oct 22, 2020 at 10:51 PM Matt Spinler <mspinler@linux.ibm.com>
> wrote:
>
>>
>>
>> On 10/22/2020 9:49 AM, Thu Ba Nguyen wrote:
>> > I started on supporting enable/disable host sensors. Everythings is
>> > fine until I...
>> > This Message Is From an External Sender
>> > This message came from outside your organization.
>> >
>> > I started on supporting enable/disable host sensors.
>> > Everythings is fine until I add code to monitor host status as below.
>> > bool MainLoop::isHostOn(void)
>> > {
>> > char buff[128];
>> > if (!powerMatch)
>> > {
>> > log<level::ERR>("Power Match Not Created");
>> > }
>> > sprintf(buff, "isHostOn powerStatusOn: %d\n",powerStatusOn);
>> > log<level::INFO>(buff);
>> > return powerStatusOn;
>> > }
>> > std::shared_ptr<sdbusplus::bus::match::match>
>> > MainLoop::startHostStateMonitor(void) {
>> > return std::make_shared<sdbusplus::bus::match::match>(
>> > *conn,
>> > "type='signal',interface='org.freedesktop.DBus.Properties',"
>> > "member='PropertiesChanged',arg0='xyz.openbmc_project.State.Host'",
>> > [](sdbusplus::message::message &msg) {
>> > std::string interfaceName;
>> > boost::container::flat_map<std::string, std::variant<std::string>>
>> > propertiesChanged;
>> > try {
>> > msg.read(interfaceName, propertiesChanged);
>> > } catch (std::exception &e) {
>> > log<level::ERR>("Unable to read host state\n");
>> > return;
>> > }
>> > // We only want to check for CurrentHostState
>> > if (propertiesChanged.begin()->first != "CurrentHostState") {
>> > return;
>> > }
>> > auto findState = propertiesChanged.find(powProperty);
>> > if (findState != propertiesChanged.end())
>> > {
>> > powerStatusOn = boost::ends_with(
>> > std::get<std::string>(findState->second), "Running");
>> > }
>> > powerMatch = true;
>> > });
>> > }
>> > void MainLoop::read()
>> > {
>> > // TODO: Issue#3 - Need to make calls to the dbus sensor cache here to
>> > // ensure the objects all exist?
>> > /* Host changed state from On to Off */
>> > if (!isHostOn() && (lastPowerState == HOST_ON ||
>> > lastPowerState == HOST_NA)) {
>> > removeHostSensors();
>> > lastPowerState = HOST_OFF;
>> > }
>> > /* Host changed state from Off to On */
>> > if (isHostOn() && lastPowerState == HOST_OFF) {
>> > addDroppedHostSensors();
>> > lastPowerState = HOST_ON;
>> > }
>> > When build openBMC I got error:
>> >
>> tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
>>
>> > error adding symbols: DSO missing from command line
>> > | collect2: error: ld returned 1 exit status
>> > | make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1
>> >
>> > It seems I need adding the threads lib to defend lib.
>> > Any suggestion to add threads lib to build configuration?
>> >
>>
>> That must be because you're using that single boost function?  While you
>> could add the dependency,
>> the ideal thing to do since this repo already uses
>> phosphor-dbus-interfaces is to use the function:
>>
>>          /** @brief Convert a string to an appropriate enum value.
>>           *  @param[in] s - The string to convert in the form of
>>           *                 "xyz.openbmc_project.State.Host.<value name>"
>>           *  @return - The enum value.
>>           */
>>          static HostState convertHostStateFromString(const std::string&
>> s);
>>
>> to convert it to the actual HostState enum to check against:
>>
>>          enum class HostState
>>          {
>>              Off,
>>              Running,
>>              Quiesced,
>>              DiagnosticMode,
>>          };
>>
>> This is all in xyz/openbmc_project/State/Host/server.hpp provided by
>> phosphor-dbus-interfaces.
>>
>> > Thanks.
>> > Thu.
>> >
>> > On Wed, Oct 21, 2020 at 11:54 PM Thu Ba Nguyen <tbnguyen1985@gmail.com
>> > <mailto:tbnguyen1985@gmail.com>> wrote:
>> >
>> >     Hi Vijay,
>> >
>> >     I took a look on entity-manager and openbmc source.
>> >     Don't have many companies  using entity-manager model to support
>> >     sensors.
>> >
>> >     Regards
>> >     Thu Nguyen.
>> >
>> >
>> >     On Wed, Oct 21, 2020 at 7:15 AM Vijay Khemka <vijaykhemka@fb.com
>> >     <mailto:vijaykhemka@fb.com>> wrote:
>> >
>> >         *From: *openbmc
>> >         <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org
>> >         <mailto:fb.com@lists.ozlabs.org>> on behalf of Thu Ba Nguyen
>> >         <tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>>
>> >         *Date: *Monday, October 19, 2020 at 11:23 AM
>> >         *To: *Ed Tanous <ed@tanous.net <mailto:ed@tanous.net>>
>> >         *Cc: *OpenBMC Maillist <openbmc@lists.ozlabs.org
>> >         <mailto:openbmc@lists.ozlabs.org>>
>> >         *Subject: *Re: Enable/Disable some sensors when Host On/Off
>> >
>> >         Hi Ed Tanous,
>> >
>> >         > Thanks for your info,
>> >
>> >         > But in your platform we are using phosphor-hwmon to manage
>> >         sensors.
>> >
>> >         > We don't use entity-manager.
>> >
>> >         > As I knew we can't use both entity-manager and
>> >         phosphor-hwmon for one project.
>> >
>> >         You can use both but for different sensors. You can decide
>> >         what sensors to configure
>> >
>> >         via EM/dbus-sensors and which one for phosphor-hwmon.
>> >
>> >         Regards
>> >
>> >         Thu Nguyen.
>> >
>>
>>

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-11-04  9:15               ` Thu Ba Nguyen
@ 2020-11-04 16:31                 ` Matt Spinler
  2020-11-04 22:18                   ` Thu Ba Nguyen
  0 siblings, 1 reply; 24+ messages in thread
From: Matt Spinler @ 2020-11-04 16:31 UTC (permalink / raw)
  To: Thu Ba Nguyen; +Cc: OpenBMC Maillist, Vijay Khemka



On 11/4/2020 3:15 AM, Thu Ba Nguyen wrote:
> Hi Matt, I implemented "Inactive the host sensors" in phosphor-hwmon 
> use below...
> This Message Is From an External Sender
> This message came from outside your organization.
>
> Hi Matt,
>
> I implemented "Inactive the host sensors" in phosphor-hwmon use below 
> approaching:
> 1. Add one option in Sensors configuration, phosphor-hwmon will parse 
> this option and add host sensors to _hostSensors list.
> 2. In mainloop::read() before going to loop to read the sensors in the 
> reading list. Query dbus to get CurrentHostState property.
> This property belongs to service "xyz.openbmc_project.State.Host".
> Based on the status of this property, identify host status.
> If the host is off, remove the host sensors from _state list and dbus. 
> I expected the users wouldn't see the host sensors on the BMC Web when 
> the host is off.
> If the host is on, add the host sensors back to _state list and also dbus.
>
> The code is working. But I have two issues with this approaching:
>
> 1. Too many transactions to get dbus property CurrentHostState.
> In my case, I have 6 services to monitor the sensors which concern the 
> host.
> With the current interval 1 second of phosphor-hwmon, I have 6 
> transactions to get CurrentHostState per seconds.

The better way to implement this would be to read CurrentHostState once 
on startup, and then register for
propertiesChanged signals for it and provide a callback to update an 
internal host state variable.

> 2. When I call "ipmitool power off" the host, there is a gap between 
> the time I trigger GPIO to power off the chassis and the time Dbus 
> property CurrentHostState is updated.
> In this gap, the phosphor-hwmon is still reading sensors. And this 
> causes the threshold warnings or errors. I want to avoid this.
>
> Do you have any suggestions to avoid these issues?
>

I can't think of anything at the moment.  Maybe someone else has an idea 
here.

> Others question:
> I saw that phosphor-hwmon is registering an event to smbus and trigger 
> the event after each 1 second to read sensors.
> Can I change the phosphor-hwmon code to integrate one dbus signal event?
> Which will be triggered when there is changing in dbus property.

I'm not sure I understand what you're asking for here.  Right now it 
will do 1 second reads (the period is
configurable) and send a properties changed signal for each sensor on 
D-Bus only when the value changes.

>
> I knew how to create a service which adds the call back function when 
> there is change in dbus property.
> But don't know how to intergrace it to hwmon.
>
> Regards.
> Thu Nguyen.
>
>
>
> On Fri, Oct 23, 2020 at 5:45 AM Thu Ba Nguyen <tbnguyen1985@gmail.com 
> <mailto:tbnguyen1985@gmail.com>> wrote:
>
>     Just remove all of added code, rebase the phosphor-hwmon source to
>     commit
>     "5906173 (12 months ago) Brad Bishop: build: add support for
>     building with meson"
>
>     Add the include:
>     #include<sdbusplus/asio/connection.hpp>
>     I can see the error
>     |
>     /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
>     phosphor_hwmon_readd-readd.o: undefined reference to symbol
>     'pthread_key_delete@@GLIBC_2.4'
>     |
>     /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
>     /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
>     error adding symbols: DSO missing from command line
>     | collect2: error: ld returned 1 exit status
>     | make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1
>     | make[2]: Leaving directory
>     '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
>     | make[1]: *** [Makefile:801: all-recursive] Error 1
>     | make[1]: Leaving directory
>     '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
>     | make: *** [Makefile:524: all] Error 2
>     | ERROR: oe_runmake failed
>     | WARNING: exit code 1 from a shell command.
>     | ERROR: Execution of
>     '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/temp/run.do_compile.2045'
>     failed with exit code 1:
>     | Makefile:800: target 'check-valgrind-recursive' given more than
>     once in the same rule
>     | Makefile:800: target 'check-valgrind-memcheck-recursive' given
>     more than once in the same rule
>     | Makefile:800: target 'check-valgrind-helgrind-recursive' given
>     more than once in the same rule
>     | Makefile:800: target 'check-valgrind-drd-recursive' given more
>     than once in the same rule
>     | Makefile:800: target 'check-valgrind-sgcheck-recursive' given
>     more than once in the same rule
>     | make  all-recursive
>
>     I think we should add thread lib.
>
>     Regards.
>     Thu Nguyen.
>
>     On Thu, Oct 22, 2020 at 10:51 PM Matt Spinler
>     <mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>> wrote:
>
>
>
>         On 10/22/2020 9:49 AM, Thu Ba Nguyen wrote:
>         > I started on supporting enable/disable host sensors.
>         Everythings is
>         > fine until I...
>         > This Message Is From an External Sender
>         > This message came from outside your organization.
>         >
>         > I started on supporting enable/disable host sensors.
>         > Everythings is fine until I add code to monitor host status
>         as below.
>         > bool MainLoop::isHostOn(void)
>         > {
>         > char buff[128];
>         > if (!powerMatch)
>         > {
>         > log<level::ERR>("Power Match Not Created");
>         > }
>         > sprintf(buff, "isHostOn powerStatusOn: %d\n",powerStatusOn);
>         > log<level::INFO>(buff);
>         > return powerStatusOn;
>         > }
>         > std::shared_ptr<sdbusplus::bus::match::match>
>         > MainLoop::startHostStateMonitor(void) {
>         > return std::make_shared<sdbusplus::bus::match::match>(
>         > *conn,
>         > "type='signal',interface='org.freedesktop.DBus.Properties',"
>         >
>         "member='PropertiesChanged',arg0='xyz.openbmc_project.State.Host'",
>         > [](sdbusplus::message::message &msg) {
>         > std::string interfaceName;
>         > boost::container::flat_map<std::string,
>         std::variant<std::string>>
>         > propertiesChanged;
>         > try {
>         > msg.read(interfaceName, propertiesChanged);
>         > } catch (std::exception &e) {
>         > log<level::ERR>("Unable to read host state\n");
>         > return;
>         > }
>         > // We only want to check for CurrentHostState
>         > if (propertiesChanged.begin()->first != "CurrentHostState") {
>         > return;
>         > }
>         > auto findState = propertiesChanged.find(powProperty);
>         > if (findState != propertiesChanged.end())
>         > {
>         > powerStatusOn = boost::ends_with(
>         > std::get<std::string>(findState->second), "Running");
>         > }
>         > powerMatch = true;
>         > });
>         > }
>         > void MainLoop::read()
>         > {
>         > // TODO: Issue#3 - Need to make calls to the dbus sensor
>         cache here to
>         > // ensure the objects all exist?
>         > /* Host changed state from On to Off */
>         > if (!isHostOn() && (lastPowerState == HOST_ON ||
>         > lastPowerState == HOST_NA)) {
>         > removeHostSensors();
>         > lastPowerState = HOST_OFF;
>         > }
>         > /* Host changed state from Off to On */
>         > if (isHostOn() && lastPowerState == HOST_OFF) {
>         > addDroppedHostSensors();
>         > lastPowerState = HOST_ON;
>         > }
>         > When build openBMC I got error:
>         >
>         tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
>
>         > error adding symbols: DSO missing from command line
>         > | collect2: error: ld returned 1 exit status
>         > | make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1
>         >
>         > It seems I need adding the threads lib to defend lib.
>         > Any suggestion to add threads lib to build configuration?
>         >
>
>         That must be because you're using that single boost function? 
>         While you
>         could add the dependency,
>         the ideal thing to do since this repo already uses
>         phosphor-dbus-interfaces is to use the function:
>
>                  /** @brief Convert a string to an appropriate enum value.
>                   *  @param[in] s - The string to convert in the form of
>                   * "xyz.openbmc_project.State.Host.<value name>"
>                   *  @return - The enum value.
>                   */
>                  static HostState convertHostStateFromString(const
>         std::string& s);
>
>         to convert it to the actual HostState enum to check against:
>
>                  enum class HostState
>                  {
>                      Off,
>                      Running,
>                      Quiesced,
>                      DiagnosticMode,
>                  };
>
>         This is all in xyz/openbmc_project/State/Host/server.hpp
>         provided by
>         phosphor-dbus-interfaces.
>
>         > Thanks.
>         > Thu.
>         >
>         > On Wed, Oct 21, 2020 at 11:54 PM Thu Ba Nguyen
>         <tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>
>         > <mailto:tbnguyen1985@gmail.com
>         <mailto:tbnguyen1985@gmail.com>>> wrote:
>         >
>         >     Hi Vijay,
>         >
>         >     I took a look on entity-manager and openbmc source.
>         >     Don't have many companies  using entity-manager model to
>         support
>         >     sensors.
>         >
>         >     Regards
>         >     Thu Nguyen.
>         >
>         >
>         >     On Wed, Oct 21, 2020 at 7:15 AM Vijay Khemka
>         <vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>
>         >     <mailto:vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>>>
>         wrote:
>         >
>         >         *From: *openbmc
>         >         <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org
>         <mailto:fb.com@lists.ozlabs.org>
>         >         <mailto:fb.com@lists.ozlabs.org
>         <mailto:fb.com@lists.ozlabs.org>>> on behalf of Thu Ba Nguyen
>         >         <tbnguyen1985@gmail.com
>         <mailto:tbnguyen1985@gmail.com> <mailto:tbnguyen1985@gmail.com
>         <mailto:tbnguyen1985@gmail.com>>>
>         >         *Date: *Monday, October 19, 2020 at 11:23 AM
>         >         *To: *Ed Tanous <ed@tanous.net
>         <mailto:ed@tanous.net> <mailto:ed@tanous.net
>         <mailto:ed@tanous.net>>>
>         >         *Cc: *OpenBMC Maillist <openbmc@lists.ozlabs.org
>         <mailto:openbmc@lists.ozlabs.org>
>         >         <mailto:openbmc@lists.ozlabs.org
>         <mailto:openbmc@lists.ozlabs.org>>>
>         >         *Subject: *Re: Enable/Disable some sensors when Host
>         On/Off
>         >
>         >         Hi Ed Tanous,
>         >
>         >         > Thanks for your info,
>         >
>         >         > But in your platform we are using phosphor-hwmon
>         to manage
>         >         sensors.
>         >
>         >         > We don't use entity-manager.
>         >
>         >         > As I knew we can't use both entity-manager and
>         >         phosphor-hwmon for one project.
>         >
>         >         You can use both but for different sensors. You can
>         decide
>         >         what sensors to configure
>         >
>         >         via EM/dbus-sensors and which one for phosphor-hwmon.
>         >
>         >         Regards
>         >
>         >         Thu Nguyen.
>         >
>


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

* Re: Enable/Disable some sensors when Host On/Off
  2020-11-04 16:31                 ` Matt Spinler
@ 2020-11-04 22:18                   ` Thu Ba Nguyen
  2020-11-05 20:52                     ` Matt Spinler
  0 siblings, 1 reply; 24+ messages in thread
From: Thu Ba Nguyen @ 2020-11-04 22:18 UTC (permalink / raw)
  To: Matt Spinler; +Cc: OpenBMC Maillist, Vijay Khemka

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

Please see my comments below.

Thanks.
Thu Nguyen.

On Wed, Nov 4, 2020 at 11:31 PM Matt Spinler <mspinler@linux.ibm.com> wrote:

>
>
> On 11/4/2020 3:15 AM, Thu Ba Nguyen wrote:
> > Hi Matt, I implemented "Inactive the host sensors" in phosphor-hwmon
> > use below...
> > This Message Is From an External Sender
> > This message came from outside your organization.
> >
> > Hi Matt,
> >
> > I implemented "Inactive the host sensors" in phosphor-hwmon use below
> > approaching:
> > 1. Add one option in Sensors configuration, phosphor-hwmon will parse
> > this option and add host sensors to _hostSensors list.
> > 2. In mainloop::read() before going to loop to read the sensors in the
> > reading list. Query dbus to get CurrentHostState property.
> > This property belongs to service "xyz.openbmc_project.State.Host".
> > Based on the status of this property, identify host status.
> > If the host is off, remove the host sensors from _state list and dbus.
> > I expected the users wouldn't see the host sensors on the BMC Web when
> > the host is off.
> > If the host is on, add the host sensors back to _state list and also
> dbus.
> >
> > The code is working. But I have two issues with this approaching:
> >
> > 1. Too many transactions to get dbus property CurrentHostState.
> > In my case, I have 6 services to monitor the sensors which concern the
> > host.
> > With the current interval 1 second of phosphor-hwmon, I have 6
> > transactions to get CurrentHostState per seconds.
>
> The better way to implement this would be to read CurrentHostState once
> on startup, and then register for
> propertiesChanged signals for it and provide a callback to update an
> internal host state variable.
>
[Thu] Yes, This is what I'm planning to do. But don't know how to add a
propertiesChanged signals
to the current phosphor-hwmon framework.

I usually use below code to add a signal to dbus.
    boost::asio::io_service io;
    ampere::host::conn =
      std::make_shared<sdbusplus::asio::connection>(ampere::host::io);

    std::vector<std::unique_ptr<sdbusplus::bus::match::match>> matches;
    //Start tracking power state
    std::unique_ptr<sdbusplus::bus::match::match> hostMonitor =
        ampere::host::startHostStateMonitor();
    matches.emplace_back(std::move(hostMonitor));

    /* wait for the signal */
    ampere::host::io.run();
But when start io.run(), phosphor-hwmon will stop reading sensors.

> 2. When I call "ipmitool power off" the host, there is a gap between
> > the time I trigger GPIO to power off the chassis and the time Dbus
> > property CurrentHostState is updated.
> > In this gap, the phosphor-hwmon is still reading sensors. And this
> > causes the threshold warnings or errors. I want to avoid this.
> >
> > Do you have any suggestions to avoid these issues?
> >
>
> I can't think of anything at the moment.  Maybe someone else has an idea
> here.
>
> > Others question:
> > I saw that phosphor-hwmon is registering an event to smbus and trigger
> > the event after each 1 second to read sensors.
> > Can I change the phosphor-hwmon code to integrate one dbus signal event?
> > Which will be triggered when there is changing in dbus property.
>
> I'm not sure I understand what you're asking for here.  Right now it
> will do 1 second reads (the period is
> configurable) and send a properties changed signal for each sensor on
> D-Bus only when the value changes.
>
[Thu] I'm asking for how to add a signal to current phosphor-hwmon
framework as comment 1.

> >
> > I knew how to create a service which adds the call back function when
> > there is change in dbus property.
> > But don't know how to intergrace it to hwmon.
> >
> > Regards.
> > Thu Nguyen.
> >
> >
> >
> > On Fri, Oct 23, 2020 at 5:45 AM Thu Ba Nguyen <tbnguyen1985@gmail.com
> > <mailto:tbnguyen1985@gmail.com>> wrote:
> >
> >     Just remove all of added code, rebase the phosphor-hwmon source to
> >     commit
> >     "5906173 (12 months ago) Brad Bishop: build: add support for
> >     building with meson"
> >
> >     Add the include:
> >     #include<sdbusplus/asio/connection.hpp>
> >     I can see the error
> >     |
> >
>  /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
> >     phosphor_hwmon_readd-readd.o: undefined reference to symbol
> >     'pthread_key_delete@@GLIBC_2.4'
> >     |
> >
>  /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
> >
>  /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
> >     error adding symbols: DSO missing from command line
> >     | collect2: error: ld returned 1 exit status
> >     | make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1
> >     | make[2]: Leaving directory
> >
>  '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
> >     | make[1]: *** [Makefile:801: all-recursive] Error 1
> >     | make[1]: Leaving directory
> >
>  '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
> >     | make: *** [Makefile:524: all] Error 2
> >     | ERROR: oe_runmake failed
> >     | WARNING: exit code 1 from a shell command.
> >     | ERROR: Execution of
> >
>  '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/temp/run.do_compile.2045'
> >     failed with exit code 1:
> >     | Makefile:800: target 'check-valgrind-recursive' given more than
> >     once in the same rule
> >     | Makefile:800: target 'check-valgrind-memcheck-recursive' given
> >     more than once in the same rule
> >     | Makefile:800: target 'check-valgrind-helgrind-recursive' given
> >     more than once in the same rule
> >     | Makefile:800: target 'check-valgrind-drd-recursive' given more
> >     than once in the same rule
> >     | Makefile:800: target 'check-valgrind-sgcheck-recursive' given
> >     more than once in the same rule
> >     | make  all-recursive
> >
> >     I think we should add thread lib.
> >
> >     Regards.
> >     Thu Nguyen.
> >
> >     On Thu, Oct 22, 2020 at 10:51 PM Matt Spinler
> >     <mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>> wrote:
> >
> >
> >
> >         On 10/22/2020 9:49 AM, Thu Ba Nguyen wrote:
> >         > I started on supporting enable/disable host sensors.
> >         Everythings is
> >         > fine until I...
> >         > This Message Is From an External Sender
> >         > This message came from outside your organization.
> >         >
> >         > I started on supporting enable/disable host sensors.
> >         > Everythings is fine until I add code to monitor host status
> >         as below.
> >         > bool MainLoop::isHostOn(void)
> >         > {
> >         > char buff[128];
> >         > if (!powerMatch)
> >         > {
> >         > log<level::ERR>("Power Match Not Created");
> >         > }
> >         > sprintf(buff, "isHostOn powerStatusOn: %d\n",powerStatusOn);
> >         > log<level::INFO>(buff);
> >         > return powerStatusOn;
> >         > }
> >         > std::shared_ptr<sdbusplus::bus::match::match>
> >         > MainLoop::startHostStateMonitor(void) {
> >         > return std::make_shared<sdbusplus::bus::match::match>(
> >         > *conn,
> >         > "type='signal',interface='org.freedesktop.DBus.Properties',"
> >         >
> >
>  "member='PropertiesChanged',arg0='xyz.openbmc_project.State.Host'",
> >         > [](sdbusplus::message::message &msg) {
> >         > std::string interfaceName;
> >         > boost::container::flat_map<std::string,
> >         std::variant<std::string>>
> >         > propertiesChanged;
> >         > try {
> >         > msg.read(interfaceName, propertiesChanged);
> >         > } catch (std::exception &e) {
> >         > log<level::ERR>("Unable to read host state\n");
> >         > return;
> >         > }
> >         > // We only want to check for CurrentHostState
> >         > if (propertiesChanged.begin()->first != "CurrentHostState") {
> >         > return;
> >         > }
> >         > auto findState = propertiesChanged.find(powProperty);
> >         > if (findState != propertiesChanged.end())
> >         > {
> >         > powerStatusOn = boost::ends_with(
> >         > std::get<std::string>(findState->second), "Running");
> >         > }
> >         > powerMatch = true;
> >         > });
> >         > }
> >         > void MainLoop::read()
> >         > {
> >         > // TODO: Issue#3 - Need to make calls to the dbus sensor
> >         cache here to
> >         > // ensure the objects all exist?
> >         > /* Host changed state from On to Off */
> >         > if (!isHostOn() && (lastPowerState == HOST_ON ||
> >         > lastPowerState == HOST_NA)) {
> >         > removeHostSensors();
> >         > lastPowerState = HOST_OFF;
> >         > }
> >         > /* Host changed state from Off to On */
> >         > if (isHostOn() && lastPowerState == HOST_OFF) {
> >         > addDroppedHostSensors();
> >         > lastPowerState = HOST_ON;
> >         > }
> >         > When build openBMC I got error:
> >         >
> >
>  tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
> >
> >         > error adding symbols: DSO missing from command line
> >         > | collect2: error: ld returned 1 exit status
> >         > | make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1
> >         >
> >         > It seems I need adding the threads lib to defend lib.
> >         > Any suggestion to add threads lib to build configuration?
> >         >
> >
> >         That must be because you're using that single boost function?
> >         While you
> >         could add the dependency,
> >         the ideal thing to do since this repo already uses
> >         phosphor-dbus-interfaces is to use the function:
> >
> >                  /** @brief Convert a string to an appropriate enum
> value.
> >                   *  @param[in] s - The string to convert in the form of
> >                   * "xyz.openbmc_project.State.Host.<value name>"
> >                   *  @return - The enum value.
> >                   */
> >                  static HostState convertHostStateFromString(const
> >         std::string& s);
> >
> >         to convert it to the actual HostState enum to check against:
> >
> >                  enum class HostState
> >                  {
> >                      Off,
> >                      Running,
> >                      Quiesced,
> >                      DiagnosticMode,
> >                  };
> >
> >         This is all in xyz/openbmc_project/State/Host/server.hpp
> >         provided by
> >         phosphor-dbus-interfaces.
> >
> >         > Thanks.
> >         > Thu.
> >         >
> >         > On Wed, Oct 21, 2020 at 11:54 PM Thu Ba Nguyen
> >         <tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>
> >         > <mailto:tbnguyen1985@gmail.com
> >         <mailto:tbnguyen1985@gmail.com>>> wrote:
> >         >
> >         >     Hi Vijay,
> >         >
> >         >     I took a look on entity-manager and openbmc source.
> >         >     Don't have many companies  using entity-manager model to
> >         support
> >         >     sensors.
> >         >
> >         >     Regards
> >         >     Thu Nguyen.
> >         >
> >         >
> >         >     On Wed, Oct 21, 2020 at 7:15 AM Vijay Khemka
> >         <vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>
> >         >     <mailto:vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>>>
> >         wrote:
> >         >
> >         >         *From: *openbmc
> >         >         <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org
> >         <mailto:fb.com@lists.ozlabs.org>
> >         >         <mailto:fb.com@lists.ozlabs.org
> >         <mailto:fb.com@lists.ozlabs.org>>> on behalf of Thu Ba Nguyen
> >         >         <tbnguyen1985@gmail.com
> >         <mailto:tbnguyen1985@gmail.com> <mailto:tbnguyen1985@gmail.com
> >         <mailto:tbnguyen1985@gmail.com>>>
> >         >         *Date: *Monday, October 19, 2020 at 11:23 AM
> >         >         *To: *Ed Tanous <ed@tanous.net
> >         <mailto:ed@tanous.net> <mailto:ed@tanous.net
> >         <mailto:ed@tanous.net>>>
> >         >         *Cc: *OpenBMC Maillist <openbmc@lists.ozlabs.org
> >         <mailto:openbmc@lists.ozlabs.org>
> >         >         <mailto:openbmc@lists.ozlabs.org
> >         <mailto:openbmc@lists.ozlabs.org>>>
> >         >         *Subject: *Re: Enable/Disable some sensors when Host
> >         On/Off
> >         >
> >         >         Hi Ed Tanous,
> >         >
> >         >         > Thanks for your info,
> >         >
> >         >         > But in your platform we are using phosphor-hwmon
> >         to manage
> >         >         sensors.
> >         >
> >         >         > We don't use entity-manager.
> >         >
> >         >         > As I knew we can't use both entity-manager and
> >         >         phosphor-hwmon for one project.
> >         >
> >         >         You can use both but for different sensors. You can
> >         decide
> >         >         what sensors to configure
> >         >
> >         >         via EM/dbus-sensors and which one for phosphor-hwmon.
> >         >
> >         >         Regards
> >         >
> >         >         Thu Nguyen.
> >         >
> >
>
>

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-11-04 22:18                   ` Thu Ba Nguyen
@ 2020-11-05 20:52                     ` Matt Spinler
  2020-11-05 23:16                       ` Thu Ba Nguyen
  0 siblings, 1 reply; 24+ messages in thread
From: Matt Spinler @ 2020-11-05 20:52 UTC (permalink / raw)
  To: Thu Ba Nguyen; +Cc: OpenBMC Maillist, Vijay Khemka



On 11/4/2020 4:18 PM, Thu Ba Nguyen wrote:
> Please see my comments below. Thanks. Thu Nguyen. On Wed, Nov 4, 2020 
> at 11:31 PM...
> This Message Is From an External Sender
> This message came from outside your organization.
>
> Please see my comments below.
>
> Thanks.
> Thu Nguyen.
>
> On Wed, Nov 4, 2020 at 11:31 PM Matt Spinler <mspinler@linux.ibm.com 
> <mailto:mspinler@linux.ibm.com>> wrote:
>
>
>
>     On 11/4/2020 3:15 AM, Thu Ba Nguyen wrote:
>     > Hi Matt, I implemented "Inactive the host sensors" in
>     phosphor-hwmon
>     > use below...
>     > This Message Is From an External Sender
>     > This message came from outside your organization.
>     >
>     > Hi Matt,
>     >
>     > I implemented "Inactive the host sensors" in phosphor-hwmon use
>     below
>     > approaching:
>     > 1. Add one option in Sensors configuration, phosphor-hwmon will
>     parse
>     > this option and add host sensors to _hostSensors list.
>     > 2. In mainloop::read() before going to loop to read the sensors
>     in the
>     > reading list. Query dbus to get CurrentHostState property.
>     > This property belongs to service "xyz.openbmc_project.State.Host".
>     > Based on the status of this property, identify host status.
>     > If the host is off, remove the host sensors from _state list and
>     dbus.
>     > I expected the users wouldn't see the host sensors on the BMC
>     Web when
>     > the host is off.
>     > If the host is on, add the host sensors back to _state list and
>     also dbus.
>     >
>     > The code is working. But I have two issues with this approaching:
>     >
>     > 1. Too many transactions to get dbus property CurrentHostState.
>     > In my case, I have 6 services to monitor the sensors which
>     concern the
>     > host.
>     > With the current interval 1 second of phosphor-hwmon, I have 6
>     > transactions to get CurrentHostState per seconds.
>
>     The better way to implement this would be to read CurrentHostState
>     once
>     on startup, and then register for
>     propertiesChanged signals for it and provide a callback to update an
>     internal host state variable.
>
> [Thu] Yes, This is what I'm planning to do. But don't know how to add 
> a propertiesChanged signals
> to the current phosphor-hwmon framework.
>
> I usually use below code to add a signal to dbus.
>     boost::asio::io_service io;
>     ampere::host::conn =
> std::make_shared<sdbusplus::asio::connection>(ampere::host::io);
>
> std::vector<std::unique_ptr<sdbusplus::bus::match::match>> matches;
>     //Start tracking power state
> std::unique_ptr<sdbusplus::bus::match::match> hostMonitor =
>         ampere::host::startHostStateMonitor();
>     matches.emplace_back(std::move(hostMonitor));
>
>     /* wait for the signal */
>     ampere::host::io.run();
> But when start io.run(), phosphor-hwmon will stop reading sensors.

There is already an sdbusplus loop running, it's in Mainloop::run().

>
>     > 2. When I call "ipmitool power off" the host, there is a gap
>     between
>     > the time I trigger GPIO to power off the chassis and the time Dbus
>     > property CurrentHostState is updated.
>     > In this gap, the phosphor-hwmon is still reading sensors. And this
>     > causes the threshold warnings or errors. I want to avoid this.
>     >
>     > Do you have any suggestions to avoid these issues?
>     >
>
>     I can't think of anything at the moment.  Maybe someone else has
>     an idea
>     here.
>
>     > Others question:
>     > I saw that phosphor-hwmon is registering an event to smbus and
>     trigger
>     > the event after each 1 second to read sensors.
>     > Can I change the phosphor-hwmon code to integrate one dbus
>     signal event?
>     > Which will be triggered when there is changing in dbus property.
>
>     I'm not sure I understand what you're asking for here. Right now it
>     will do 1 second reads (the period is
>     configurable) and send a properties changed signal for each sensor on
>     D-Bus only when the value changes.
>
> [Thu] I'm asking for how to add a signal to current phosphor-hwmon 
> framework as comment 1.
>
>     >
>     > I knew how to create a service which adds the call back function
>     when
>     > there is change in dbus property.
>     > But don't know how to intergrace it to hwmon.
>     >
>     > Regards.
>     > Thu Nguyen.
>     >
>     >
>     >
>     > On Fri, Oct 23, 2020 at 5:45 AM Thu Ba Nguyen
>     <tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>
>     > <mailto:tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>>>
>     wrote:
>     >
>     >     Just remove all of added code, rebase the phosphor-hwmon
>     source to
>     >     commit
>     >     "5906173 (12 months ago) Brad Bishop: build: add support for
>     >     building with meson"
>     >
>     >     Add the include:
>     >     #include<sdbusplus/asio/connection.hpp>
>     >     I can see the error
>     >     |
>     >
>      /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
>     >     phosphor_hwmon_readd-readd.o: undefined reference to symbol
>     >     'pthread_key_delete@@GLIBC_2.4'
>     >     |
>     >
>      /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
>     >
>      /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
>     >     error adding symbols: DSO missing from command line
>     >     | collect2: error: ld returned 1 exit status
>     >     | make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1
>     >     | make[2]: Leaving directory
>     >
>      '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
>     >     | make[1]: *** [Makefile:801: all-recursive] Error 1
>     >     | make[1]: Leaving directory
>     >
>      '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
>     >     | make: *** [Makefile:524: all] Error 2
>     >     | ERROR: oe_runmake failed
>     >     | WARNING: exit code 1 from a shell command.
>     >     | ERROR: Execution of
>     >
>      '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/temp/run.do_compile.2045'
>     >     failed with exit code 1:
>     >     | Makefile:800: target 'check-valgrind-recursive' given more
>     than
>     >     once in the same rule
>     >     | Makefile:800: target 'check-valgrind-memcheck-recursive' given
>     >     more than once in the same rule
>     >     | Makefile:800: target 'check-valgrind-helgrind-recursive' given
>     >     more than once in the same rule
>     >     | Makefile:800: target 'check-valgrind-drd-recursive' given more
>     >     than once in the same rule
>     >     | Makefile:800: target 'check-valgrind-sgcheck-recursive' given
>     >     more than once in the same rule
>     >     | make  all-recursive
>     >
>     >     I think we should add thread lib.
>     >
>     >     Regards.
>     >     Thu Nguyen.
>     >
>     >     On Thu, Oct 22, 2020 at 10:51 PM Matt Spinler
>     >     <mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>
>     <mailto:mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>>>
>     wrote:
>     >
>     >
>     >
>     >         On 10/22/2020 9:49 AM, Thu Ba Nguyen wrote:
>     >         > I started on supporting enable/disable host sensors.
>     >         Everythings is
>     >         > fine until I...
>     >         > This Message Is From an External Sender
>     >         > This message came from outside your organization.
>     >         >
>     >         > I started on supporting enable/disable host sensors.
>     >         > Everythings is fine until I add code to monitor host
>     status
>     >         as below.
>     >         > bool MainLoop::isHostOn(void)
>     >         > {
>     >         > char buff[128];
>     >         > if (!powerMatch)
>     >         > {
>     >         > log<level::ERR>("Power Match Not Created");
>     >         > }
>     >         > sprintf(buff, "isHostOn powerStatusOn:
>     %d\n",powerStatusOn);
>     >         > log<level::INFO>(buff);
>     >         > return powerStatusOn;
>     >         > }
>     >         > std::shared_ptr<sdbusplus::bus::match::match>
>     >         > MainLoop::startHostStateMonitor(void) {
>     >         > return std::make_shared<sdbusplus::bus::match::match>(
>     >         > *conn,
>     >         >
>     "type='signal',interface='org.freedesktop.DBus.Properties',"
>     >         >
>     >  "member='PropertiesChanged',arg0='xyz.openbmc_project.State.Host'",
>     >         > [](sdbusplus::message::message &msg) {
>     >         > std::string interfaceName;
>     >         > boost::container::flat_map<std::string,
>     >         std::variant<std::string>>
>     >         > propertiesChanged;
>     >         > try {
>     >         > msg.read(interfaceName, propertiesChanged);
>     >         > } catch (std::exception &e) {
>     >         > log<level::ERR>("Unable to read host state\n");
>     >         > return;
>     >         > }
>     >         > // We only want to check for CurrentHostState
>     >         > if (propertiesChanged.begin()->first !=
>     "CurrentHostState") {
>     >         > return;
>     >         > }
>     >         > auto findState = propertiesChanged.find(powProperty);
>     >         > if (findState != propertiesChanged.end())
>     >         > {
>     >         > powerStatusOn = boost::ends_with(
>     >         > std::get<std::string>(findState->second), "Running");
>     >         > }
>     >         > powerMatch = true;
>     >         > });
>     >         > }
>     >         > void MainLoop::read()
>     >         > {
>     >         > // TODO: Issue#3 - Need to make calls to the dbus sensor
>     >         cache here to
>     >         > // ensure the objects all exist?
>     >         > /* Host changed state from On to Off */
>     >         > if (!isHostOn() && (lastPowerState == HOST_ON ||
>     >         > lastPowerState == HOST_NA)) {
>     >         > removeHostSensors();
>     >         > lastPowerState = HOST_OFF;
>     >         > }
>     >         > /* Host changed state from Off to On */
>     >         > if (isHostOn() && lastPowerState == HOST_OFF) {
>     >         > addDroppedHostSensors();
>     >         > lastPowerState = HOST_ON;
>     >         > }
>     >         > When build openBMC I got error:
>     >         >
>     >
>      tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
>     >
>     >         > error adding symbols: DSO missing from command line
>     >         > | collect2: error: ld returned 1 exit status
>     >         > | make[2]: *** [Makefile:643: phosphor-hwmon-readd]
>     Error 1
>     >         >
>     >         > It seems I need adding the threads lib to defend lib.
>     >         > Any suggestion to add threads lib to build configuration?
>     >         >
>     >
>     >         That must be because you're using that single boost
>     function?
>     >         While you
>     >         could add the dependency,
>     >         the ideal thing to do since this repo already uses
>     >         phosphor-dbus-interfaces is to use the function:
>     >
>     >                  /** @brief Convert a string to an appropriate
>     enum value.
>     >                   *  @param[in] s - The string to convert in the
>     form of
>     >                   * "xyz.openbmc_project.State.Host.<value name>"
>     >                   *  @return - The enum value.
>     >                   */
>     >                  static HostState convertHostStateFromString(const
>     >         std::string& s);
>     >
>     >         to convert it to the actual HostState enum to check against:
>     >
>     >                  enum class HostState
>     >                  {
>     >                      Off,
>     >                      Running,
>     >                      Quiesced,
>     >                      DiagnosticMode,
>     >                  };
>     >
>     >         This is all in xyz/openbmc_project/State/Host/server.hpp
>     >         provided by
>     >         phosphor-dbus-interfaces.
>     >
>     >         > Thanks.
>     >         > Thu.
>     >         >
>     >         > On Wed, Oct 21, 2020 at 11:54 PM Thu Ba Nguyen
>     >         <tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>
>     <mailto:tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>>
>     >         > <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>
>     >         <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>>>> wrote:
>     >         >
>     >         >     Hi Vijay,
>     >         >
>     >         >     I took a look on entity-manager and openbmc source.
>     >         >     Don't have many companies  using entity-manager
>     model to
>     >         support
>     >         >     sensors.
>     >         >
>     >         >     Regards
>     >         >     Thu Nguyen.
>     >         >
>     >         >
>     >         >     On Wed, Oct 21, 2020 at 7:15 AM Vijay Khemka
>     >         <vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>
>     <mailto:vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>>
>     >         >     <mailto:vijaykhemka@fb.com
>     <mailto:vijaykhemka@fb.com> <mailto:vijaykhemka@fb.com
>     <mailto:vijaykhemka@fb.com>>>>
>     >         wrote:
>     >         >
>     >         >         *From: *openbmc
>     >         >       
>      <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org
>     <mailto:fb.com@lists.ozlabs.org>
>     >         <mailto:fb.com@lists.ozlabs.org
>     <mailto:fb.com@lists.ozlabs.org>>
>     >         >         <mailto:fb.com@lists.ozlabs.org
>     <mailto:fb.com@lists.ozlabs.org>
>     >         <mailto:fb.com@lists.ozlabs.org
>     <mailto:fb.com@lists.ozlabs.org>>>> on behalf of Thu Ba Nguyen
>     >         >         <tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>
>     >         <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>> <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>
>     >         <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>>>>
>     >         >         *Date: *Monday, October 19, 2020 at 11:23 AM
>     >         >         *To: *Ed Tanous <ed@tanous.net
>     <mailto:ed@tanous.net>
>     >         <mailto:ed@tanous.net <mailto:ed@tanous.net>>
>     <mailto:ed@tanous.net <mailto:ed@tanous.net>
>     >         <mailto:ed@tanous.net <mailto:ed@tanous.net>>>>
>     >         >         *Cc: *OpenBMC Maillist
>     <openbmc@lists.ozlabs.org <mailto:openbmc@lists.ozlabs.org>
>     >         <mailto:openbmc@lists.ozlabs.org
>     <mailto:openbmc@lists.ozlabs.org>>
>     >         >         <mailto:openbmc@lists.ozlabs.org
>     <mailto:openbmc@lists.ozlabs.org>
>     >         <mailto:openbmc@lists.ozlabs.org
>     <mailto:openbmc@lists.ozlabs.org>>>>
>     >         >         *Subject: *Re: Enable/Disable some sensors
>     when Host
>     >         On/Off
>     >         >
>     >         >         Hi Ed Tanous,
>     >         >
>     >         >         > Thanks for your info,
>     >         >
>     >         >         > But in your platform we are using phosphor-hwmon
>     >         to manage
>     >         >         sensors.
>     >         >
>     >         >         > We don't use entity-manager.
>     >         >
>     >         >         > As I knew we can't use both entity-manager and
>     >         >         phosphor-hwmon for one project.
>     >         >
>     >         >         You can use both but for different sensors.
>     You can
>     >         decide
>     >         >         what sensors to configure
>     >         >
>     >         >         via EM/dbus-sensors and which one for
>     phosphor-hwmon.
>     >         >
>     >         >         Regards
>     >         >
>     >         >         Thu Nguyen.
>     >         >
>     >
>


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

* Re: Enable/Disable some sensors when Host On/Off
  2020-11-05 20:52                     ` Matt Spinler
@ 2020-11-05 23:16                       ` Thu Ba Nguyen
  2020-11-05 23:24                         ` Matt Spinler
  0 siblings, 1 reply; 24+ messages in thread
From: Thu Ba Nguyen @ 2020-11-05 23:16 UTC (permalink / raw)
  To: Matt Spinler; +Cc: OpenBMC Maillist, Vijay Khemka

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

There is already an sdbusplus loop running, it's in Mainloop::run().
[Thu] I think phosphor-hwmon is using the timer for Mainloop::run() which
triggers each 1 seconds.
Is this right?
To support signal the changing in dbus property, we need a service which
listens the dbus signal, right?
I'm still fresh in C++ and dbus code. So please correct me if I'm wrong.

Thanks.
Thu Nguyen.

On Fri, Nov 6, 2020 at 3:52 AM Matt Spinler <mspinler@linux.ibm.com> wrote:

>
>
> On 11/4/2020 4:18 PM, Thu Ba Nguyen wrote:
> > Please see my comments below. Thanks. Thu Nguyen. On Wed, Nov 4, 2020
> > at 11:31 PM...
> > This Message Is From an External Sender
> > This message came from outside your organization.
> >
> > Please see my comments below.
> >
> > Thanks.
> > Thu Nguyen.
> >
> > On Wed, Nov 4, 2020 at 11:31 PM Matt Spinler <mspinler@linux.ibm.com
> > <mailto:mspinler@linux.ibm.com>> wrote:
> >
> >
> >
> >     On 11/4/2020 3:15 AM, Thu Ba Nguyen wrote:
> >     > Hi Matt, I implemented "Inactive the host sensors" in
> >     phosphor-hwmon
> >     > use below...
> >     > This Message Is From an External Sender
> >     > This message came from outside your organization.
> >     >
> >     > Hi Matt,
> >     >
> >     > I implemented "Inactive the host sensors" in phosphor-hwmon use
> >     below
> >     > approaching:
> >     > 1. Add one option in Sensors configuration, phosphor-hwmon will
> >     parse
> >     > this option and add host sensors to _hostSensors list.
> >     > 2. In mainloop::read() before going to loop to read the sensors
> >     in the
> >     > reading list. Query dbus to get CurrentHostState property.
> >     > This property belongs to service "xyz.openbmc_project.State.Host".
> >     > Based on the status of this property, identify host status.
> >     > If the host is off, remove the host sensors from _state list and
> >     dbus.
> >     > I expected the users wouldn't see the host sensors on the BMC
> >     Web when
> >     > the host is off.
> >     > If the host is on, add the host sensors back to _state list and
> >     also dbus.
> >     >
> >     > The code is working. But I have two issues with this approaching:
> >     >
> >     > 1. Too many transactions to get dbus property CurrentHostState.
> >     > In my case, I have 6 services to monitor the sensors which
> >     concern the
> >     > host.
> >     > With the current interval 1 second of phosphor-hwmon, I have 6
> >     > transactions to get CurrentHostState per seconds.
> >
> >     The better way to implement this would be to read CurrentHostState
> >     once
> >     on startup, and then register for
> >     propertiesChanged signals for it and provide a callback to update an
> >     internal host state variable.
> >
> > [Thu] Yes, This is what I'm planning to do. But don't know how to add
> > a propertiesChanged signals
> > to the current phosphor-hwmon framework.
> >
> > I usually use below code to add a signal to dbus.
> >     boost::asio::io_service io;
> >     ampere::host::conn =
> > std::make_shared<sdbusplus::asio::connection>(ampere::host::io);
> >
> > std::vector<std::unique_ptr<sdbusplus::bus::match::match>> matches;
> >     //Start tracking power state
> > std::unique_ptr<sdbusplus::bus::match::match> hostMonitor =
> >         ampere::host::startHostStateMonitor();
> >     matches.emplace_back(std::move(hostMonitor));
> >
> >     /* wait for the signal */
> >     ampere::host::io.run();
> > But when start io.run(), phosphor-hwmon will stop reading sensors.
>
> There is already an sdbusplus loop running, it's in Mainloop::run().
>
> >
> >     > 2. When I call "ipmitool power off" the host, there is a gap
> >     between
> >     > the time I trigger GPIO to power off the chassis and the time Dbus
> >     > property CurrentHostState is updated.
> >     > In this gap, the phosphor-hwmon is still reading sensors. And this
> >     > causes the threshold warnings or errors. I want to avoid this.
> >     >
> >     > Do you have any suggestions to avoid these issues?
> >     >
> >
> >     I can't think of anything at the moment.  Maybe someone else has
> >     an idea
> >     here.
> >
> >     > Others question:
> >     > I saw that phosphor-hwmon is registering an event to smbus and
> >     trigger
> >     > the event after each 1 second to read sensors.
> >     > Can I change the phosphor-hwmon code to integrate one dbus
> >     signal event?
> >     > Which will be triggered when there is changing in dbus property.
> >
> >     I'm not sure I understand what you're asking for here. Right now it
> >     will do 1 second reads (the period is
> >     configurable) and send a properties changed signal for each sensor on
> >     D-Bus only when the value changes.
> >
> > [Thu] I'm asking for how to add a signal to current phosphor-hwmon
> > framework as comment 1.
> >
> >     >
> >     > I knew how to create a service which adds the call back function
> >     when
> >     > there is change in dbus property.
> >     > But don't know how to intergrace it to hwmon.
> >     >
> >     > Regards.
> >     > Thu Nguyen.
> >     >
> >     >
> >     >
> >     > On Fri, Oct 23, 2020 at 5:45 AM Thu Ba Nguyen
> >     <tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>
> >     > <mailto:tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>>>
> >     wrote:
> >     >
> >     >     Just remove all of added code, rebase the phosphor-hwmon
> >     source to
> >     >     commit
> >     >     "5906173 (12 months ago) Brad Bishop: build: add support for
> >     >     building with meson"
> >     >
> >     >     Add the include:
> >     >     #include<sdbusplus/asio/connection.hpp>
> >     >     I can see the error
> >     >     |
> >     >
> >
>   /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
> >     >     phosphor_hwmon_readd-readd.o: undefined reference to symbol
> >     >     'pthread_key_delete@@GLIBC_2.4'
> >     >     |
> >     >
> >
>   /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
> >     >
> >
>   /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
> >     >     error adding symbols: DSO missing from command line
> >     >     | collect2: error: ld returned 1 exit status
> >     >     | make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1
> >     >     | make[2]: Leaving directory
> >     >
> >
>   '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
> >     >     | make[1]: *** [Makefile:801: all-recursive] Error 1
> >     >     | make[1]: Leaving directory
> >     >
> >
>   '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
> >     >     | make: *** [Makefile:524: all] Error 2
> >     >     | ERROR: oe_runmake failed
> >     >     | WARNING: exit code 1 from a shell command.
> >     >     | ERROR: Execution of
> >     >
> >
>   '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/temp/run.do_compile.2045'
> >     >     failed with exit code 1:
> >     >     | Makefile:800: target 'check-valgrind-recursive' given more
> >     than
> >     >     once in the same rule
> >     >     | Makefile:800: target 'check-valgrind-memcheck-recursive'
> given
> >     >     more than once in the same rule
> >     >     | Makefile:800: target 'check-valgrind-helgrind-recursive'
> given
> >     >     more than once in the same rule
> >     >     | Makefile:800: target 'check-valgrind-drd-recursive' given
> more
> >     >     than once in the same rule
> >     >     | Makefile:800: target 'check-valgrind-sgcheck-recursive' given
> >     >     more than once in the same rule
> >     >     | make  all-recursive
> >     >
> >     >     I think we should add thread lib.
> >     >
> >     >     Regards.
> >     >     Thu Nguyen.
> >     >
> >     >     On Thu, Oct 22, 2020 at 10:51 PM Matt Spinler
> >     >     <mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>
> >     <mailto:mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>>>
> >     wrote:
> >     >
> >     >
> >     >
> >     >         On 10/22/2020 9:49 AM, Thu Ba Nguyen wrote:
> >     >         > I started on supporting enable/disable host sensors.
> >     >         Everythings is
> >     >         > fine until I...
> >     >         > This Message Is From an External Sender
> >     >         > This message came from outside your organization.
> >     >         >
> >     >         > I started on supporting enable/disable host sensors.
> >     >         > Everythings is fine until I add code to monitor host
> >     status
> >     >         as below.
> >     >         > bool MainLoop::isHostOn(void)
> >     >         > {
> >     >         > char buff[128];
> >     >         > if (!powerMatch)
> >     >         > {
> >     >         > log<level::ERR>("Power Match Not Created");
> >     >         > }
> >     >         > sprintf(buff, "isHostOn powerStatusOn:
> >     %d\n",powerStatusOn);
> >     >         > log<level::INFO>(buff);
> >     >         > return powerStatusOn;
> >     >         > }
> >     >         > std::shared_ptr<sdbusplus::bus::match::match>
> >     >         > MainLoop::startHostStateMonitor(void) {
> >     >         > return std::make_shared<sdbusplus::bus::match::match>(
> >     >         > *conn,
> >     >         >
> >     "type='signal',interface='org.freedesktop.DBus.Properties',"
> >     >         >
> >     >
>  "member='PropertiesChanged',arg0='xyz.openbmc_project.State.Host'",
> >     >         > [](sdbusplus::message::message &msg) {
> >     >         > std::string interfaceName;
> >     >         > boost::container::flat_map<std::string,
> >     >         std::variant<std::string>>
> >     >         > propertiesChanged;
> >     >         > try {
> >     >         > msg.read(interfaceName, propertiesChanged);
> >     >         > } catch (std::exception &e) {
> >     >         > log<level::ERR>("Unable to read host state\n");
> >     >         > return;
> >     >         > }
> >     >         > // We only want to check for CurrentHostState
> >     >         > if (propertiesChanged.begin()->first !=
> >     "CurrentHostState") {
> >     >         > return;
> >     >         > }
> >     >         > auto findState = propertiesChanged.find(powProperty);
> >     >         > if (findState != propertiesChanged.end())
> >     >         > {
> >     >         > powerStatusOn = boost::ends_with(
> >     >         > std::get<std::string>(findState->second), "Running");
> >     >         > }
> >     >         > powerMatch = true;
> >     >         > });
> >     >         > }
> >     >         > void MainLoop::read()
> >     >         > {
> >     >         > // TODO: Issue#3 - Need to make calls to the dbus sensor
> >     >         cache here to
> >     >         > // ensure the objects all exist?
> >     >         > /* Host changed state from On to Off */
> >     >         > if (!isHostOn() && (lastPowerState == HOST_ON ||
> >     >         > lastPowerState == HOST_NA)) {
> >     >         > removeHostSensors();
> >     >         > lastPowerState = HOST_OFF;
> >     >         > }
> >     >         > /* Host changed state from Off to On */
> >     >         > if (isHostOn() && lastPowerState == HOST_OFF) {
> >     >         > addDroppedHostSensors();
> >     >         > lastPowerState = HOST_ON;
> >     >         > }
> >     >         > When build openBMC I got error:
> >     >         >
> >     >
> >
>   tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
> >     >
> >     >         > error adding symbols: DSO missing from command line
> >     >         > | collect2: error: ld returned 1 exit status
> >     >         > | make[2]: *** [Makefile:643: phosphor-hwmon-readd]
> >     Error 1
> >     >         >
> >     >         > It seems I need adding the threads lib to defend lib.
> >     >         > Any suggestion to add threads lib to build configuration?
> >     >         >
> >     >
> >     >         That must be because you're using that single boost
> >     function?
> >     >         While you
> >     >         could add the dependency,
> >     >         the ideal thing to do since this repo already uses
> >     >         phosphor-dbus-interfaces is to use the function:
> >     >
> >     >                  /** @brief Convert a string to an appropriate
> >     enum value.
> >     >                   *  @param[in] s - The string to convert in the
> >     form of
> >     >                   * "xyz.openbmc_project.State.Host.<value name>"
> >     >                   *  @return - The enum value.
> >     >                   */
> >     >                  static HostState convertHostStateFromString(const
> >     >         std::string& s);
> >     >
> >     >         to convert it to the actual HostState enum to check
> against:
> >     >
> >     >                  enum class HostState
> >     >                  {
> >     >                      Off,
> >     >                      Running,
> >     >                      Quiesced,
> >     >                      DiagnosticMode,
> >     >                  };
> >     >
> >     >         This is all in xyz/openbmc_project/State/Host/server.hpp
> >     >         provided by
> >     >         phosphor-dbus-interfaces.
> >     >
> >     >         > Thanks.
> >     >         > Thu.
> >     >         >
> >     >         > On Wed, Oct 21, 2020 at 11:54 PM Thu Ba Nguyen
> >     >         <tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>
> >     <mailto:tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>>
> >     >         > <mailto:tbnguyen1985@gmail.com
> >     <mailto:tbnguyen1985@gmail.com>
> >     >         <mailto:tbnguyen1985@gmail.com
> >     <mailto:tbnguyen1985@gmail.com>>>> wrote:
> >     >         >
> >     >         >     Hi Vijay,
> >     >         >
> >     >         >     I took a look on entity-manager and openbmc source.
> >     >         >     Don't have many companies  using entity-manager
> >     model to
> >     >         support
> >     >         >     sensors.
> >     >         >
> >     >         >     Regards
> >     >         >     Thu Nguyen.
> >     >         >
> >     >         >
> >     >         >     On Wed, Oct 21, 2020 at 7:15 AM Vijay Khemka
> >     >         <vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>
> >     <mailto:vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>>
> >     >         >     <mailto:vijaykhemka@fb.com
> >     <mailto:vijaykhemka@fb.com> <mailto:vijaykhemka@fb.com
> >     <mailto:vijaykhemka@fb.com>>>>
> >     >         wrote:
> >     >         >
> >     >         >         *From: *openbmc
> >     >         >
> >      <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org
> >     <mailto:fb.com@lists.ozlabs.org>
> >     >         <mailto:fb.com@lists.ozlabs.org
> >     <mailto:fb.com@lists.ozlabs.org>>
> >     >         >         <mailto:fb.com@lists.ozlabs.org
> >     <mailto:fb.com@lists.ozlabs.org>
> >     >         <mailto:fb.com@lists.ozlabs.org
> >     <mailto:fb.com@lists.ozlabs.org>>>> on behalf of Thu Ba Nguyen
> >     >         >         <tbnguyen1985@gmail.com
> >     <mailto:tbnguyen1985@gmail.com>
> >     >         <mailto:tbnguyen1985@gmail.com
> >     <mailto:tbnguyen1985@gmail.com>> <mailto:tbnguyen1985@gmail.com
> >     <mailto:tbnguyen1985@gmail.com>
> >     >         <mailto:tbnguyen1985@gmail.com
> >     <mailto:tbnguyen1985@gmail.com>>>>
> >     >         >         *Date: *Monday, October 19, 2020 at 11:23 AM
> >     >         >         *To: *Ed Tanous <ed@tanous.net
> >     <mailto:ed@tanous.net>
> >     >         <mailto:ed@tanous.net <mailto:ed@tanous.net>>
> >     <mailto:ed@tanous.net <mailto:ed@tanous.net>
> >     >         <mailto:ed@tanous.net <mailto:ed@tanous.net>>>>
> >     >         >         *Cc: *OpenBMC Maillist
> >     <openbmc@lists.ozlabs.org <mailto:openbmc@lists.ozlabs.org>
> >     >         <mailto:openbmc@lists.ozlabs.org
> >     <mailto:openbmc@lists.ozlabs.org>>
> >     >         >         <mailto:openbmc@lists.ozlabs.org
> >     <mailto:openbmc@lists.ozlabs.org>
> >     >         <mailto:openbmc@lists.ozlabs.org
> >     <mailto:openbmc@lists.ozlabs.org>>>>
> >     >         >         *Subject: *Re: Enable/Disable some sensors
> >     when Host
> >     >         On/Off
> >     >         >
> >     >         >         Hi Ed Tanous,
> >     >         >
> >     >         >         > Thanks for your info,
> >     >         >
> >     >         >         > But in your platform we are using
> phosphor-hwmon
> >     >         to manage
> >     >         >         sensors.
> >     >         >
> >     >         >         > We don't use entity-manager.
> >     >         >
> >     >         >         > As I knew we can't use both entity-manager and
> >     >         >         phosphor-hwmon for one project.
> >     >         >
> >     >         >         You can use both but for different sensors.
> >     You can
> >     >         decide
> >     >         >         what sensors to configure
> >     >         >
> >     >         >         via EM/dbus-sensors and which one for
> >     phosphor-hwmon.
> >     >         >
> >     >         >         Regards
> >     >         >
> >     >         >         Thu Nguyen.
> >     >         >
> >     >
> >
>
>

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

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

* Re: Enable/Disable some sensors when Host On/Off
  2020-11-05 23:16                       ` Thu Ba Nguyen
@ 2020-11-05 23:24                         ` Matt Spinler
  0 siblings, 0 replies; 24+ messages in thread
From: Matt Spinler @ 2020-11-05 23:24 UTC (permalink / raw)
  To: Thu Ba Nguyen; +Cc: OpenBMC Maillist, Vijay Khemka



On 11/5/2020 5:16 PM, Thu Ba Nguyen wrote:
> There is already an sdbusplus loop running, it's in Mainloop::run(). 
> [Thu] I think...
> This Message Is From an External Sender
> This message came from outside your organization.
>
> There is already an sdbusplus loop running, it's in Mainloop::run().
> [Thu] I think phosphor-hwmon is using the timer for Mainloop::run() 
> which triggers each 1 seconds.
> Is this right?
> To support signal the changing in dbus property, we need a service 
> which listens the dbus signal, right?
> I'm still fresh in C++ and dbus code. So please correct me if I'm wrong.
>

The current loop handles both the timer events and the D-Bus callbacks.
So all you'd need to do is make a new function on Mainloop to act as the 
callback, and then
make a new sdbusplus::bus::match::match object owned by Mainloop and pass it
that callback along with the other necessary parameters.

> Thanks.
> Thu Nguyen.
>
> On Fri, Nov 6, 2020 at 3:52 AM Matt Spinler <mspinler@linux.ibm.com 
> <mailto:mspinler@linux.ibm.com>> wrote:
>
>
>
>     On 11/4/2020 4:18 PM, Thu Ba Nguyen wrote:
>     > Please see my comments below. Thanks. Thu Nguyen. On Wed, Nov 4,
>     2020
>     > at 11:31 PM...
>     > This Message Is From an External Sender
>     > This message came from outside your organization.
>     >
>     > Please see my comments below.
>     >
>     > Thanks.
>     > Thu Nguyen.
>     >
>     > On Wed, Nov 4, 2020 at 11:31 PM Matt Spinler
>     <mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>
>     > <mailto:mspinler@linux.ibm.com <mailto:mspinler@linux.ibm.com>>>
>     wrote:
>     >
>     >
>     >
>     >     On 11/4/2020 3:15 AM, Thu Ba Nguyen wrote:
>     >     > Hi Matt, I implemented "Inactive the host sensors" in
>     >     phosphor-hwmon
>     >     > use below...
>     >     > This Message Is From an External Sender
>     >     > This message came from outside your organization.
>     >     >
>     >     > Hi Matt,
>     >     >
>     >     > I implemented "Inactive the host sensors" in
>     phosphor-hwmon use
>     >     below
>     >     > approaching:
>     >     > 1. Add one option in Sensors configuration, phosphor-hwmon
>     will
>     >     parse
>     >     > this option and add host sensors to _hostSensors list.
>     >     > 2. In mainloop::read() before going to loop to read the
>     sensors
>     >     in the
>     >     > reading list. Query dbus to get CurrentHostState property.
>     >     > This property belongs to service
>     "xyz.openbmc_project.State.Host".
>     >     > Based on the status of this property, identify host status.
>     >     > If the host is off, remove the host sensors from _state
>     list and
>     >     dbus.
>     >     > I expected the users wouldn't see the host sensors on the BMC
>     >     Web when
>     >     > the host is off.
>     >     > If the host is on, add the host sensors back to _state
>     list and
>     >     also dbus.
>     >     >
>     >     > The code is working. But I have two issues with this
>     approaching:
>     >     >
>     >     > 1. Too many transactions to get dbus property
>     CurrentHostState.
>     >     > In my case, I have 6 services to monitor the sensors which
>     >     concern the
>     >     > host.
>     >     > With the current interval 1 second of phosphor-hwmon, I have 6
>     >     > transactions to get CurrentHostState per seconds.
>     >
>     >     The better way to implement this would be to read
>     CurrentHostState
>     >     once
>     >     on startup, and then register for
>     >     propertiesChanged signals for it and provide a callback to
>     update an
>     >     internal host state variable.
>     >
>     > [Thu] Yes, This is what I'm planning to do. But don't know how
>     to add
>     > a propertiesChanged signals
>     > to the current phosphor-hwmon framework.
>     >
>     > I usually use below code to add a signal to dbus.
>     >     boost::asio::io_service io;
>     >     ampere::host::conn =
>     > std::make_shared<sdbusplus::asio::connection>(ampere::host::io);
>     >
>     > std::vector<std::unique_ptr<sdbusplus::bus::match::match>> matches;
>     >     //Start tracking power state
>     > std::unique_ptr<sdbusplus::bus::match::match> hostMonitor =
>     >         ampere::host::startHostStateMonitor();
>     >     matches.emplace_back(std::move(hostMonitor));
>     >
>     >     /* wait for the signal */
>     >     ampere::host::io.run();
>     > But when start io.run(), phosphor-hwmon will stop reading sensors.
>
>     There is already an sdbusplus loop running, it's in Mainloop::run().
>
>     >
>     >     > 2. When I call "ipmitool power off" the host, there is a gap
>     >     between
>     >     > the time I trigger GPIO to power off the chassis and the
>     time Dbus
>     >     > property CurrentHostState is updated.
>     >     > In this gap, the phosphor-hwmon is still reading sensors.
>     And this
>     >     > causes the threshold warnings or errors. I want to avoid this.
>     >     >
>     >     > Do you have any suggestions to avoid these issues?
>     >     >
>     >
>     >     I can't think of anything at the moment.  Maybe someone else has
>     >     an idea
>     >     here.
>     >
>     >     > Others question:
>     >     > I saw that phosphor-hwmon is registering an event to smbus and
>     >     trigger
>     >     > the event after each 1 second to read sensors.
>     >     > Can I change the phosphor-hwmon code to integrate one dbus
>     >     signal event?
>     >     > Which will be triggered when there is changing in dbus
>     property.
>     >
>     >     I'm not sure I understand what you're asking for here. Right
>     now it
>     >     will do 1 second reads (the period is
>     >     configurable) and send a properties changed signal for each
>     sensor on
>     >     D-Bus only when the value changes.
>     >
>     > [Thu] I'm asking for how to add a signal to current phosphor-hwmon
>     > framework as comment 1.
>     >
>     >     >
>     >     > I knew how to create a service which adds the call back
>     function
>     >     when
>     >     > there is change in dbus property.
>     >     > But don't know how to intergrace it to hwmon.
>     >     >
>     >     > Regards.
>     >     > Thu Nguyen.
>     >     >
>     >     >
>     >     >
>     >     > On Fri, Oct 23, 2020 at 5:45 AM Thu Ba Nguyen
>     >     <tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>
>     <mailto:tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>>
>     >     > <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com> <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>>>>
>     >     wrote:
>     >     >
>     >     >     Just remove all of added code, rebase the phosphor-hwmon
>     >     source to
>     >     >     commit
>     >     >     "5906173 (12 months ago) Brad Bishop: build: add
>     support for
>     >     >     building with meson"
>     >     >
>     >     >     Add the include:
>     >     >  #include<sdbusplus/asio/connection.hpp>
>     >     >     I can see the error
>     >     >     |
>     >     >
>     >
>       /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
>     >     >     phosphor_hwmon_readd-readd.o: undefined reference to
>     symbol
>     >     >     'pthread_key_delete@@GLIBC_2.4'
>     >     >     |
>     >     >
>     >
>       /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld:
>     >     >
>     >
>       /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
>     >     >     error adding symbols: DSO missing from command line
>     >     >     | collect2: error: ld returned 1 exit status
>     >     >     | make[2]: *** [Makefile:643: phosphor-hwmon-readd]
>     Error 1
>     >     >     | make[2]: Leaving directory
>     >     >
>     >
>       '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
>     >     >     | make[1]: *** [Makefile:801: all-recursive] Error 1
>     >     >     | make[1]: Leaving directory
>     >     >
>     >
>       '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'
>     >     >     | make: *** [Makefile:524: all] Error 2
>     >     >     | ERROR: oe_runmake failed
>     >     >     | WARNING: exit code 1 from a shell command.
>     >     >     | ERROR: Execution of
>     >     >
>     >
>       '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/temp/run.do_compile.2045'
>     >     >     failed with exit code 1:
>     >     >     | Makefile:800: target 'check-valgrind-recursive'
>     given more
>     >     than
>     >     >     once in the same rule
>     >     >     | Makefile:800: target
>     'check-valgrind-memcheck-recursive' given
>     >     >     more than once in the same rule
>     >     >     | Makefile:800: target
>     'check-valgrind-helgrind-recursive' given
>     >     >     more than once in the same rule
>     >     >     | Makefile:800: target 'check-valgrind-drd-recursive'
>     given more
>     >     >     than once in the same rule
>     >     >     | Makefile:800: target
>     'check-valgrind-sgcheck-recursive' given
>     >     >     more than once in the same rule
>     >     >     | make  all-recursive
>     >     >
>     >     >     I think we should add thread lib.
>     >     >
>     >     >     Regards.
>     >     >     Thu Nguyen.
>     >     >
>     >     >     On Thu, Oct 22, 2020 at 10:51 PM Matt Spinler
>     >     >     <mspinler@linux.ibm.com
>     <mailto:mspinler@linux.ibm.com> <mailto:mspinler@linux.ibm.com
>     <mailto:mspinler@linux.ibm.com>>
>     >     <mailto:mspinler@linux.ibm.com
>     <mailto:mspinler@linux.ibm.com> <mailto:mspinler@linux.ibm.com
>     <mailto:mspinler@linux.ibm.com>>>>
>     >     wrote:
>     >     >
>     >     >
>     >     >
>     >     >         On 10/22/2020 9:49 AM, Thu Ba Nguyen wrote:
>     >     >         > I started on supporting enable/disable host sensors.
>     >     >         Everythings is
>     >     >         > fine until I...
>     >     >         > This Message Is From an External Sender
>     >     >         > This message came from outside your organization.
>     >     >         >
>     >     >         > I started on supporting enable/disable host sensors.
>     >     >         > Everythings is fine until I add code to monitor host
>     >     status
>     >     >         as below.
>     >     >         > bool MainLoop::isHostOn(void)
>     >     >         > {
>     >     >         > char buff[128];
>     >     >         > if (!powerMatch)
>     >     >         > {
>     >     >         > log<level::ERR>("Power Match Not Created");
>     >     >         > }
>     >     >         > sprintf(buff, "isHostOn powerStatusOn:
>     >     %d\n",powerStatusOn);
>     >     >         > log<level::INFO>(buff);
>     >     >         > return powerStatusOn;
>     >     >         > }
>     >     >         > std::shared_ptr<sdbusplus::bus::match::match>
>     >     >         > MainLoop::startHostStateMonitor(void) {
>     >     >         > return
>     std::make_shared<sdbusplus::bus::match::match>(
>     >     >         > *conn,
>     >     >         >
>     >  "type='signal',interface='org.freedesktop.DBus.Properties',"
>     >     >         >
>     >     >
>      "member='PropertiesChanged',arg0='xyz.openbmc_project.State.Host'",
>     >     >         > [](sdbusplus::message::message &msg) {
>     >     >         > std::string interfaceName;
>     >     >         > boost::container::flat_map<std::string,
>     >     >  std::variant<std::string>>
>     >     >         > propertiesChanged;
>     >     >         > try {
>     >     >         > msg.read(interfaceName, propertiesChanged);
>     >     >         > } catch (std::exception &e) {
>     >     >         > log<level::ERR>("Unable to read host state\n");
>     >     >         > return;
>     >     >         > }
>     >     >         > // We only want to check for CurrentHostState
>     >     >         > if (propertiesChanged.begin()->first !=
>     >     "CurrentHostState") {
>     >     >         > return;
>     >     >         > }
>     >     >         > auto findState =
>     propertiesChanged.find(powProperty);
>     >     >         > if (findState != propertiesChanged.end())
>     >     >         > {
>     >     >         > powerStatusOn = boost::ends_with(
>     >     >         > std::get<std::string>(findState->second),
>     "Running");
>     >     >         > }
>     >     >         > powerMatch = true;
>     >     >         > });
>     >     >         > }
>     >     >         > void MainLoop::read()
>     >     >         > {
>     >     >         > // TODO: Issue#3 - Need to make calls to the
>     dbus sensor
>     >     >         cache here to
>     >     >         > // ensure the objects all exist?
>     >     >         > /* Host changed state from On to Off */
>     >     >         > if (!isHostOn() && (lastPowerState == HOST_ON ||
>     >     >         > lastPowerState == HOST_NA)) {
>     >     >         > removeHostSensors();
>     >     >         > lastPowerState = HOST_OFF;
>     >     >         > }
>     >     >         > /* Host changed state from Off to On */
>     >     >         > if (isHostOn() && lastPowerState == HOST_OFF) {
>     >     >         > addDroppedHostSensors();
>     >     >         > lastPowerState = HOST_ON;
>     >     >         > }
>     >     >         > When build openBMC I got error:
>     >     >         >
>     >     >
>     >
>       tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
>     >     >
>     >     >         > error adding symbols: DSO missing from command line
>     >     >         > | collect2: error: ld returned 1 exit status
>     >     >         > | make[2]: *** [Makefile:643: phosphor-hwmon-readd]
>     >     Error 1
>     >     >         >
>     >     >         > It seems I need adding the threads lib to defend
>     lib.
>     >     >         > Any suggestion to add threads lib to build
>     configuration?
>     >     >         >
>     >     >
>     >     >         That must be because you're using that single boost
>     >     function?
>     >     >         While you
>     >     >         could add the dependency,
>     >     >         the ideal thing to do since this repo already uses
>     >     >         phosphor-dbus-interfaces is to use the function:
>     >     >
>     >     >                  /** @brief Convert a string to an appropriate
>     >     enum value.
>     >     >                   *  @param[in] s - The string to convert
>     in the
>     >     form of
>     >     >                   * "xyz.openbmc_project.State.Host.<value
>     name>"
>     >     >                   *  @return - The enum value.
>     >     >                   */
>     >     >                  static HostState
>     convertHostStateFromString(const
>     >     >         std::string& s);
>     >     >
>     >     >         to convert it to the actual HostState enum to
>     check against:
>     >     >
>     >     >                  enum class HostState
>     >     >                  {
>     >     >                      Off,
>     >     >                      Running,
>     >     >                      Quiesced,
>     >     >                      DiagnosticMode,
>     >     >                  };
>     >     >
>     >     >         This is all in
>     xyz/openbmc_project/State/Host/server.hpp
>     >     >         provided by
>     >     >         phosphor-dbus-interfaces.
>     >     >
>     >     >         > Thanks.
>     >     >         > Thu.
>     >     >         >
>     >     >         > On Wed, Oct 21, 2020 at 11:54 PM Thu Ba Nguyen
>     >     >         <tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com> <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>>
>     >     <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com> <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>>>
>     >     >         > <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>
>     >     <mailto:tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>>
>     >     >         <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>
>     >     <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>>>>> wrote:
>     >     >         >
>     >     >         >     Hi Vijay,
>     >     >         >
>     >     >         >     I took a look on entity-manager and openbmc
>     source.
>     >     >         >     Don't have many companies  using entity-manager
>     >     model to
>     >     >         support
>     >     >         >     sensors.
>     >     >         >
>     >     >         >     Regards
>     >     >         >     Thu Nguyen.
>     >     >         >
>     >     >         >
>     >     >         >     On Wed, Oct 21, 2020 at 7:15 AM Vijay Khemka
>     >     >         <vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>
>     <mailto:vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>>
>     >     <mailto:vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>
>     <mailto:vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>>>
>     >     >         >     <mailto:vijaykhemka@fb.com
>     <mailto:vijaykhemka@fb.com>
>     >     <mailto:vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>>
>     <mailto:vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>
>     >     <mailto:vijaykhemka@fb.com <mailto:vijaykhemka@fb.com>>>>>
>     >     >         wrote:
>     >     >         >
>     >     >         >         *From: *openbmc
>     >     >         >
>     >      <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org
>     <mailto:fb.com@lists.ozlabs.org>
>     >     <mailto:fb.com@lists.ozlabs.org
>     <mailto:fb.com@lists.ozlabs.org>>
>     >     >         <mailto:fb.com@lists.ozlabs.org
>     <mailto:fb.com@lists.ozlabs.org>
>     >     <mailto:fb.com@lists.ozlabs.org
>     <mailto:fb.com@lists.ozlabs.org>>>
>     >     >         >         <mailto:fb.com@lists.ozlabs.org
>     <mailto:fb.com@lists.ozlabs.org>
>     >     <mailto:fb.com@lists.ozlabs.org
>     <mailto:fb.com@lists.ozlabs.org>>
>     >     >         <mailto:fb.com@lists.ozlabs.org
>     <mailto:fb.com@lists.ozlabs.org>
>     >     <mailto:fb.com@lists.ozlabs.org
>     <mailto:fb.com@lists.ozlabs.org>>>>> on behalf of Thu Ba Nguyen
>     >     >         >         <tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>
>     >     <mailto:tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>>
>     >     >         <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>
>     >     <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>>> <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>
>     >     <mailto:tbnguyen1985@gmail.com <mailto:tbnguyen1985@gmail.com>>
>     >     >         <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>
>     >     <mailto:tbnguyen1985@gmail.com
>     <mailto:tbnguyen1985@gmail.com>>>>>
>     >     >         >         *Date: *Monday, October 19, 2020 at 11:23 AM
>     >     >         >         *To: *Ed Tanous <ed@tanous.net
>     <mailto:ed@tanous.net>
>     >     <mailto:ed@tanous.net <mailto:ed@tanous.net>>
>     >     >         <mailto:ed@tanous.net <mailto:ed@tanous.net>
>     <mailto:ed@tanous.net <mailto:ed@tanous.net>>>
>     >     <mailto:ed@tanous.net <mailto:ed@tanous.net>
>     <mailto:ed@tanous.net <mailto:ed@tanous.net>>
>     >     >         <mailto:ed@tanous.net <mailto:ed@tanous.net>
>     <mailto:ed@tanous.net <mailto:ed@tanous.net>>>>>
>     >     >         >         *Cc: *OpenBMC Maillist
>     >     <openbmc@lists.ozlabs.org <mailto:openbmc@lists.ozlabs.org>
>     <mailto:openbmc@lists.ozlabs.org <mailto:openbmc@lists.ozlabs.org>>
>     >     >         <mailto:openbmc@lists.ozlabs.org
>     <mailto:openbmc@lists.ozlabs.org>
>     >     <mailto:openbmc@lists.ozlabs.org
>     <mailto:openbmc@lists.ozlabs.org>>>
>     >     >         >         <mailto:openbmc@lists.ozlabs.org
>     <mailto:openbmc@lists.ozlabs.org>
>     >     <mailto:openbmc@lists.ozlabs.org
>     <mailto:openbmc@lists.ozlabs.org>>
>     >     >         <mailto:openbmc@lists.ozlabs.org
>     <mailto:openbmc@lists.ozlabs.org>
>     >     <mailto:openbmc@lists.ozlabs.org
>     <mailto:openbmc@lists.ozlabs.org>>>>>
>     >     >         >         *Subject: *Re: Enable/Disable some sensors
>     >     when Host
>     >     >         On/Off
>     >     >         >
>     >     >         >         Hi Ed Tanous,
>     >     >         >
>     >     >         >         > Thanks for your info,
>     >     >         >
>     >     >         >         > But in your platform we are using
>     phosphor-hwmon
>     >     >         to manage
>     >     >         >         sensors.
>     >     >         >
>     >     >         >         > We don't use entity-manager.
>     >     >         >
>     >     >         >         > As I knew we can't use both
>     entity-manager and
>     >     >         >         phosphor-hwmon for one project.
>     >     >         >
>     >     >         >         You can use both but for different sensors.
>     >     You can
>     >     >         decide
>     >     >         >         what sensors to configure
>     >     >         >
>     >     >         >         via EM/dbus-sensors and which one for
>     >     phosphor-hwmon.
>     >     >         >
>     >     >         >         Regards
>     >     >         >
>     >     >         >         Thu Nguyen.
>     >     >         >
>     >     >
>     >
>


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

end of thread, other threads:[~2020-11-05 23:26 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-18 13:58 Enable/Disable some sensors when Host On/Off Thu Ba Nguyen
2020-10-19 14:16 ` Matt Spinler
2020-10-19 15:23   ` Thu Ba Nguyen
2020-10-20 13:46     ` Matt Spinler
2020-10-20 14:18       ` Patrick Williams
2020-10-20 21:26         ` Matt Spinler
2020-10-20 23:21         ` Thu Ba Nguyen
2020-10-20 23:39         ` Thu Ba Nguyen
2020-10-20 23:16       ` Thu Ba Nguyen
2020-10-19 17:31 ` Ed Tanous
2020-10-19 18:22   ` Thu Ba Nguyen
2020-10-19 18:31     ` Ed Tanous
2020-10-20 23:05       ` Thu Ba Nguyen
2020-10-21  0:15     ` Vijay Khemka
2020-10-21 16:54       ` Thu Ba Nguyen
2020-10-22 14:49         ` Thu Ba Nguyen
2020-10-22 15:51           ` Matt Spinler
2020-10-22 22:45             ` Thu Ba Nguyen
2020-11-04  9:15               ` Thu Ba Nguyen
2020-11-04 16:31                 ` Matt Spinler
2020-11-04 22:18                   ` Thu Ba Nguyen
2020-11-05 20:52                     ` Matt Spinler
2020-11-05 23:16                       ` Thu Ba Nguyen
2020-11-05 23:24                         ` Matt Spinler

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).