Enable/Disable some sensors when Host On/Off

Thu Ba Nguyen tbnguyen1985 at gmail.com
Fri Oct 23 09:45:59 AEDT 2020


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 at 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 at gmail.com
> > <mailto:tbnguyen1985 at 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 at fb.com
> >     <mailto:vijaykhemka at fb.com>> wrote:
> >
> >         *From: *openbmc
> >         <openbmc-bounces+vijaykhemka=fb.com at lists.ozlabs.org
> >         <mailto:fb.com at lists.ozlabs.org>> on behalf of Thu Ba Nguyen
> >         <tbnguyen1985 at gmail.com <mailto:tbnguyen1985 at gmail.com>>
> >         *Date: *Monday, October 19, 2020 at 11:23 AM
> >         *To: *Ed Tanous <ed at tanous.net <mailto:ed at tanous.net>>
> >         *Cc: *OpenBMC Maillist <openbmc at lists.ozlabs.org
> >         <mailto:openbmc at 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.
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20201023/8a6d307f/attachment-0001.htm>


More information about the openbmc mailing list