smbios-mdr: Add patch to detect motherboard object creation
In some rare cases, it is observed that the smbios table is
received by smbiosmdr daemon way before Entity Manager creates
the motherboard object path. When that happens, smbios daemon
creates dbus objects for the cpus but fails to associate them with
the chassis. This causes missing "Processors" and "Memory" sections
under "Links" in the chassis response.
The issue can be easily reproduced by rebooting just the BMC without
rebooting the host node.
The fix is to setup a dbus matcher when the motherboard path
is not found. The matcher shall look for the event when
xyz.openbmc_project.Inventory.Item.System interface is added
to the dbus object.
Tested:
Tried rebooting the bmc multiple times and verified
that post reboot, the "Processors" and "Memory" sections
are visible under "Links" section in the Chassis response
```
{
"@odata.id": "/redfish/v1/Chassis/<Chassis Name>",
"@odata.type": "#Chassis.v1_17_0.Chassis",
"Actions": {
"#Chassis.Reset": {
"@Redfish.ActionInfo": "/redfish/v1/Chassis/<Chassis Name>/ResetActionInfo",
"target": "/redfish/v1/Chassis/<Chassis Name>/Actions/Chassis.Reset"
}
},
"Assembly": {
"@odata.id": "/redfish/v1/Chassis/<Chassis Name>/Assembly"
},
"ChassisType": ".....",
"Id": "<Chassis Name>",
"Links": {
"Cables": [
{
....
}
],
"Cables@odata.count": ..,
"ComputerSystems": [
{
"@odata.id": "/redfish/v1/Systems/system"
}
],
"Contains": [
.......
],
"Contains@odata.count": ..,
"ManagedBy": [
{
"@odata.id": "/redfish/v1/Managers/bmc"
}
],
"Processors": [ <<==== Processor section is present
{
"@odata.id": "/redfish/v1/Systems/system/Processors/cpu0"
},
{
"@odata.id": "/redfish/v1/Systems/system/Processors/cpu1"
},
{
"@odata.id": "/redfish/v1/Systems/system/Processors/cpu2"
},
.....
],
"Processors@odata.count": ..
},
"LogServices": {
"@odata.id": "/redfish/v1/Chassis/<Chassis Name>/LogServices"
},
"Manufacturer": ".....",
"Memory": { <<==== Memory section is present
"@odata.id": "/redfish/v1/Systems/system/Memory"
},
"Model": ".....",
"Name": "<Chassis Name>",
"PCIeDevices": {
"@odata.id": "/redfish/v1/Systems/system/PCIeDevices"
},
"PartNumber": ".....",
"Power": {
"@odata.id": "/redfish/v1/Chassis/<Chassis Name>/Power"
},
"PowerState": "On",
"PowerSubsystem": {
"@odata.id": "/redfish/v1/Chassis/<Chassis Name>/PowerSubsystem"
},
"Sensors": {
"@odata.id": "/redfish/v1/Chassis/<Chassis Name>/Sensors"
},
"SerialNumber": ".....",
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Enabled"
},
"Thermal": {
"@odata.id": "/redfish/v1/Chassis/<Chassis Name>/Thermal"
},
"ThermalSubsystem": {
"@odata.id": "/redfish/v1/Chassis/<Chassis Name>/ThermalSubsystem"
}
}
```
Google-Bug-Id: 273605964
Google-Bug-Id: 272581442
Change-Id: I4899a7f77538e8f1d1cc2636d52e9419d4caac5c
Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
(cherry picked from commit 0ea4a537f129c4bd158432eab78ac0ca6e1fee19)
diff --git a/recipes-phosphor/smbios/smbios-mdr/0001-Add-dbus-match-rule-to-detect-motherboard-object-cre.patch b/recipes-phosphor/smbios/smbios-mdr/0001-Add-dbus-match-rule-to-detect-motherboard-object-cre.patch
new file mode 100644
index 0000000..6b14f2d
--- /dev/null
+++ b/recipes-phosphor/smbios/smbios-mdr/0001-Add-dbus-match-rule-to-detect-motherboard-object-cre.patch
@@ -0,0 +1,174 @@
+From 5d317afd523f8cb7fabd1444f0321bab93080252 Mon Sep 17 00:00:00 2001
+From: Nikhil Namjoshi <nikhilnamjoshi@google.com>
+Date: Tue, 14 Mar 2023 22:51:48 +0000
+Subject: [PATCH] Add dbus match rule to detect motherboard object creation
+
+In some rare cases, it is observed that the smbios table is
+received by smbiosmdr daemon way before Entity Manager creates
+the motherboard object path. When that happens, smbios daemon
+creates dbus objects for the cpus but fails to associate them with
+the chassis. This causes missing "Processors" and "Memory" sections
+under "Links" in the chassis response.
+
+The issue can be easily reproduced by rebooting just the BMC without
+rebooting the host node.
+
+The fix is to setup a dbus matcher when the motherboard path
+is not found. The matcher shall look for the event when
+xyz.openbmc_project.Inventory.Item.System interface is added
+to the dbus object.
+
+Tested:
+
+Tried rebooting the bmc multiple times and verified
+that post reboot, the "Processors" and "Memory" sections
+are visible under "Links" section in the Chassis response
+
+```
+{
+ "@odata.id": "/redfish/v1/Chassis/<Chassis Name>",
+ "@odata.type": "#Chassis.v1_17_0.Chassis",
+ "Actions": {
+ "#Chassis.Reset": {
+ "@Redfish.ActionInfo": "/redfish/v1/Chassis/<Chassis Name>/ResetActionInfo",
+ "target": "/redfish/v1/Chassis/<Chassis Name>/Actions/Chassis.Reset"
+ }
+ },
+ "Assembly": {
+ "@odata.id": "/redfish/v1/Chassis/<Chassis Name>/Assembly"
+ },
+ "ChassisType": ".....",
+ "Id": "<Chassis Name>",
+ "Links": {
+ "Cables": [
+ {
+ ....
+ }
+ ],
+ "Cables@odata.count": ..,
+ "ComputerSystems": [
+ {
+ "@odata.id": "/redfish/v1/Systems/system"
+ }
+ ],
+ "Contains": [
+ .......
+ ],
+ "Contains@odata.count": ..,
+ "ManagedBy": [
+ {
+ "@odata.id": "/redfish/v1/Managers/bmc"
+ }
+ ],
+ "Processors": [ <<==== Processor section is present
+ {
+ "@odata.id": "/redfish/v1/Systems/system/Processors/cpu0"
+ },
+ {
+ "@odata.id": "/redfish/v1/Systems/system/Processors/cpu1"
+ },
+ {
+ "@odata.id": "/redfish/v1/Systems/system/Processors/cpu2"
+ },
+ .....
+ ],
+ "Processors@odata.count": ..
+ },
+ "LogServices": {
+ "@odata.id": "/redfish/v1/Chassis/<Chassis Name>/LogServices"
+ },
+ "Manufacturer": ".....",
+ "Memory": { <<==== Memory section is present
+ "@odata.id": "/redfish/v1/Systems/system/Memory"
+ },
+ "Model": ".....",
+ "Name": "<Chassis Name>",
+ "PCIeDevices": {
+ "@odata.id": "/redfish/v1/Systems/system/PCIeDevices"
+ },
+ "PartNumber": ".....",
+ "Power": {
+ "@odata.id": "/redfish/v1/Chassis/<Chassis Name>/Power"
+ },
+ "PowerState": "On",
+ "PowerSubsystem": {
+ "@odata.id": "/redfish/v1/Chassis/<Chassis Name>/PowerSubsystem"
+ },
+ "Sensors": {
+ "@odata.id": "/redfish/v1/Chassis/<Chassis Name>/Sensors"
+ },
+ "SerialNumber": ".....",
+ "Status": {
+ "Health": "OK",
+ "HealthRollup": "OK",
+ "State": "Enabled"
+ },
+ "Thermal": {
+ "@odata.id": "/redfish/v1/Chassis/<Chassis Name>/Thermal"
+ },
+ "ThermalSubsystem": {
+ "@odata.id": "/redfish/v1/Chassis/<Chassis Name>/ThermalSubsystem"
+ }
+}
+```
+
+Patch Tracking Bug: b/273605964
+Upstream info / review: go/gbmccl/61656
+Upstream-Status: Submitted
+Justification: Waiting for review and approval
+
+Change-Id: I58b514c9e845d64770fa6f946493222a011a2018
+Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
+---
+ src/mdrv2.cpp | 28 +++++++++++++++++++++++++++-
+ 1 file changed, 27 insertions(+), 1 deletion(-)
+
+diff --git a/src/mdrv2.cpp b/src/mdrv2.cpp
+index f8e2654..173b34f 100644
+--- a/src/mdrv2.cpp
++++ b/src/mdrv2.cpp
+@@ -400,6 +400,7 @@ void MDR_V2::systemInfoUpdate()
+ method.append(systemInterfacePath);
+ method.append(0);
+ method.append(std::vector<std::string>({systemInterface}));
++
+ try
+ {
+ std::vector<std::string> paths;
+@@ -408,7 +409,32 @@ void MDR_V2::systemInfoUpdate()
+ if (paths.size() < 1)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+- "Failed to get system motherboard dbus path.");
++ "Failed to get system motherboard dbus path. Setting up a "
++ "match rule");
++ // Add match rule if motherboard dbus path is not yet created
++ static std::unique_ptr<sdbusplus::bus::match_t>
++ motherboardConfigMatch =
++ std::make_unique<sdbusplus::bus::match_t>(
++ bus,
++ sdbusplus::bus::match::rules::interfacesAdded() +
++ sdbusplus::bus::match::rules::argNpath(
++ 0,
++ "/xyz/openbmc_project/inventory/system/board/"),
++ [this,
++ systemInterface](sdbusplus::message::message& msg) {
++ sdbusplus::message::object_path objectName;
++ boost::container::flat_map<
++ std::string,
++ boost::container::flat_map<
++ std::string,
++ std::variant<std::string, uint64_t>>>
++ msgData;
++ msg.read(objectName, msgData);
++ if (msgData.contains(systemInterface))
++ {
++ this->systemInfoUpdate();
++ }
++ });
+ }
+ else
+ {
+--
+2.40.0.rc1.284.g88254d51c5-goog
+
diff --git a/recipes-phosphor/smbios/smbios-mdr_%.bbappend b/recipes-phosphor/smbios/smbios-mdr_%.bbappend
index 0422ffe..713ec62 100644
--- a/recipes-phosphor/smbios/smbios-mdr_%.bbappend
+++ b/recipes-phosphor/smbios/smbios-mdr_%.bbappend
@@ -1 +1,6 @@
+FILESEXTRAPATHS:prepend:gbmc := "${THISDIR}/${PN}:"
EXTRA_OECMAKE:append:gbmc = " -DDIMM_ONLY_LOCATOR=ON"
+
+SRC_URI:append:gbmc = " \
+ file://0001-Add-dbus-match-rule-to-detect-motherboard-object-cre.patch \
+"