Skip to contentSkip to conversation

Some questions about "Add option for SEL commands for Journal-based SEL entries"

DISCUSSION Will Liang (梁永鉉) 2 participants 2 messages Mar 29, 2019 6 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Hi Jason,

Sorry to bother you again.

After solving sensor type and event type problem for discrete sensor(memory) , I encountered another issue. From the code, it seems only support getting the sensor number of threshold-based sensors. How do I get the sensor number of discrete sensors?
Would you have any suggestion or plan to get sensor number of discrete sensors?

BRs,
Will

Hi Will,

You are welcome to push changes directly to Gerrit for review. I did a quick check of the code and it looks okay to push with one minor change of THRESHLOD -> THRESHOLD.

Thanks,
-Jason

Quoted 262 lines · Will Liang (梁永鉉)

Hi Jason,

I have seen that the code has been resolved from the conflict and I can bitbake it successfully too. Thanks.

As indicated in my previous Email, I need the "memory" sensor type and "sensor-specific" event type.

Could you please help me to review the following changes.

Andif you don't have any concerns, I will push the code to Gerrit >
sdrutils.hpp | 34 +++++++++++++++++++++-------------

sensorhandler.hpp | 8 ++++++++

2 files changed, 29 insertions(+), 13 deletions(-)
sdrutils.hpp +0 -0

index a91f3ea..bff2896 100644

--- a/sdrutils.hpp

+++ b/sdrutils.hpp

sdrutils.hpp +1 -1
@@ -20,9 +20,10 @@
 
 #include <boost/container/flat_map.hpp>
 
 #include <cstring>
 
 #include <phosphor-logging/log.hpp>
 
-
 
+#include <types.hpp>

#pragma once

+

#ifdef JOURNAL_SEL

struct CmpStrVersion

{

sdrutils.hpp +0 -1
@@ -74,13 +75,14 @@ struct CmpStr
 
      }
 
 };
 
-const static boost::container::flat_map<const char*, ipmi_sensor_types,

CmpStr>

sdrutils.hpp +1 -6
-    sensorTypes{{{"temperature", IPMI_SENSOR_TEMP},
 
-                 {"voltage", IPMI_SENSOR_VOLTAGE},
 
-                 {"current", IPMI_SENSOR_CURRENT},
 
-                 {"fan_tach", IPMI_SENSOR_FAN},
 
-                 {"fan_pwm", IPMI_SENSOR_FAN},
 
-                 {"power", IPMI_SENSOR_OTHER}}};
 
+const static boost::container::flat_map<const char*,

std::pair<ipmi_sensor_types, ipmi_event_types>, CmpStr>

+ sensorAndEventType{{{"temperature",
std::make_pair(IPMI_SENSOR_TEMP, THRESHLOD)},

+ {"voltage", std::make_pair(IPMI_SENSOR_VOLTAGE,
THRESHLOD)},

+ {"current", std::make_pair(IPMI_SENSOR_CURRENT,
THRESHLOD)},

sdrutils.hpp +4 -0
+                 {"fan_tach", std::make_pair(IPMI_SENSOR_FAN, THRESHLOD)},
 
+                 {"fan_pwm", std::make_pair(IPMI_SENSOR_FAN, THRESHLOD)},
 
+                 {"power", std::make_pair(IPMI_SENSOR_OTHER, THRESHLOD)},
 
+                 {"memory", std::make_pair(IPMI_SENSOR_MEMORY,

SENSOR_SPECIFIC)}}};

inline static std::string getSensorTypeStringFromPath(const
std::string& path)

{

sdrutils.hpp +3 -4
@@ -105,12 +107,11 @@ inline static uint8_t getSensorTypeFromPath(const
 std::string& path)
 
 {
 
      uint8_t sensorType = 0;
 
      std::string type = getSensorTypeStringFromPath(path);
 
-    auto findSensor = sensorTypes.find(type.c_str());
 
-    if (findSensor != sensorTypes.end())
 
+    auto findSensor = sensorAndEventType.find(type.c_str());
 
+    if (findSensor != sensorAndEventType.end())
 
      {
 
-        sensorType = findSensor->second;
 
+        sensorType = findSensor->second.first;
 
      } // else default 0x0 RESERVED
 
-
 
      return sensorType;

}

sdrutils.hpp +8 -1
@@ -128,7 +129,14 @@ inline static uint8_t getSensorNumberFromPath(const
 std::string& path)
 
 inline static uint8_t getSensorEventTypeFromPath(const std::string& path)
 
 {
 
      // TODO: Add support for additional reading types as needed
 
-    return 0x1; // reading type = threshold
 
+    uint8_t eventType = 0x00;
 
+    std::string type = getSensorTypeStringFromPath(path);
 
+    auto findSensor = sensorAndEventType.find(type.c_str());
 
+    if (findSensor != sensorAndEventType.end())
 
+    {
 
+        eventType = findSensor->second.second;
 
+    }
 
+    return eventType; // reading type = threshold

}

inline static std::string getPathFromSensorNumber(uint8_t sensorNum)

sensorhandler.hpp +0 -0

index d3b6378..e449076 100644

--- a/sensorhandler.hpp

+++ b/sensorhandler.hpp

sensorhandler.hpp +8 -0
@@ -36,6 +36,14 @@ enum ipmi_sensor_types
 
      IPMI_SENSOR_FAN = 0x04,
 
      IPMI_SENSOR_OTHER = 0x0B,
 
      IPMI_SENSOR_TPM = 0xCC,
 
+    IPMI_SENSOR_MEMORY = 0x0C,
 
+};
 
+
 
+enum ipmi_event_types
 
+{
 
+    UNSPECIFIED = 0x00,
 
+    THRESHLOD = 0x01,
 
+    SENSOR_SPECIFIC = 0x6f,

};

  #define MAX_DBUS_PATH 128

BRs,

Will

Hi Will,

Quoted 8 lines · Will Liang (梁永鉉)

Hi Jason,

Thanks for your response!

I tried to modify the code, but I encountered some problems after pull the code from Gerrit.
After I pull your codes and run "bitbake obmc-phosphor-image " command.
It will shows ERROR: Task (/home/will/openbmc/meta-phosphor/recipes-phosphor/ipmi/phosphor-ipmi-net_git.bb:do_compile) failed with exit code '1' Do you have this error? Or what else do I need to do?

Sorry, it's been a while since I built this patch, and there have been some big changes to ipmid since I pushed it. I'm not able to test it right now, but it may just need to be rebased?

Quoted 3 lines

I'm sorry, maybe this is a dumb question but I don’t understand how you defined this "JOURNAL_SEL" parameter from *.bbappend? I tried it but it still can't run into the #ifdef JOURNAL_SEL part.

There are no dumb questions with Yocto. :) You need to add this line to a phosphor-ipmi-host_%.bbappend:
EXTRA_OECONF = " --with-journal-sel"

That should cause the define to be set by autoconfig during the build.

Thanks,
-Jason

Quoted 37 lines

BRs,
Will

Quoted 33 lines

Hi Will,

Quoted 3 lines · Will Liang (梁永鉉)

Hi Jason,

I've reviewed the code you pushed to

gerrit(https://gerrit.openbmc-project.xyz/#/c/openbmc/phosphor-host-ipmid/+ /12951/).

Quoted 1 line

I'm not sure if the patch will be approved by the maintainers. So you are aware, while it's in review, I have pushed the same code to the intel-ipmi-oem repository.

Quoted 4 lines

In sdrutils.hpp, the getSensorEventTypeFromPath() is set TODO status. If I need other event types and sensor types for my projects, do I have to complete the code and send you the code? Or I just push it myself?

I'd suggest building your changes as a new patch that depends on the existing patch. Then if it's approved, your patch can be merged. If not, you can port the changes as needed.

Thanks,
-Jason

Quoted 2 lines

For example, our project requires a "memory" sensor type and a "sensor-specific" event type, but I am confused about which way is

acceptable.

Quoted 4 lines

BRs,
Will.

#7 lore raw
Quoted 4 lines · Will Liang (梁永鉉)

Hi Jason,

Sorry to bother you again.

It's not a bother. :)

Quoted 6 lines

After solving sensor type and event type problem for discrete sensor(memory) , I encountered another issue.
From the code, it seems only support getting the sensor number of
threshold-based sensors.
How do I get the sensor  number of discrete sensors?
Would you have any suggestion or plan to get sensor number of discrete sensors?

Unfortunately, you have hit the crux of the issue that is preventing the journal-based SEL from being fully adopted, which is that we don't have a flexible, generic way to assign sensor numbers.

If you only need discrete sensors to be assigned numbers dynamically, you might be able to extend the sensor mapping that is used to get the number here: https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-host-ipmid/+/12951/24/sdrutils.hpp#117.
If you can set a path for your discrete sensors so they are included
in the list, it may solve your issue.

We've discussed some options for a flexible, generic solution that would work for everyone, but I don't believe any work has been done, yet. You can view the discussion here: https://lists.ozlabs.org/pipermail/openbmc/2019-January/014873.html and in the comments on the review here: https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-host-ipmid/+/12951.

Thanks,
-Jason