Skip to content

Commit

Permalink
Remove redundant async call in FRU collection threads (ibm-openbmc#588)
Browse files Browse the repository at this point in the history
This commit removes the redundant std:async call in the detached thread
launched for parsing and publishing the VPD for an individual FRU.
Since we have a dedicated detached thread for each FRU, we can do VPD
parse and publish in a synchronous manner from the detached thread
itself, instead of launching a asynchronous task which adds unnecessary
performance cost.

This commit addresses issue ibm-openbmc#558.

Test:

```
1. Install bitbaked image on Everest (ever6bmc)
2. After initial boot, check:
	- BMC State Ready
	- vpd-manager's CollectionStatus property should be "Completed"
	busctl get-property com.ibm.VPD.Manager
	/com/ibm/VPD/Manager com.ibm.VPD.Manager
	CollectionStatus
	s "Completed"
	- vpd-manager status should be running with no restarts
	- vpd-manager should have only 1 thread running:
	  check "ls -la /proc/<vpd-manager PID>/task"
3. Reboot the BMC several times and repeat Step 2.
```

Change-Id: I603c64dc9b5057429a2288f0edfde6086755b851
Signed-off-by: Souvik Roy <[email protected]>
  • Loading branch information
Souvik Roy committed Jan 15, 2025
1 parent 3e8a372 commit 6a5fc3f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions vpd-manager/src/worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1513,12 +1513,8 @@ void Worker::collectFrusFromJson()
}

std::thread{[vpdFilePath, this]() {
auto l_futureObject = std::async(&Worker::parseAndPublishVPD, this,
vpdFilePath);
const auto& l_parseResult = parseAndPublishVPD(vpdFilePath);

std::tuple<bool, std::string> l_threadInfo = l_futureObject.get();

// thread returned.
m_mutex.lock();
m_activeCollectionThreadCount--;
m_mutex.unlock();
Expand Down

0 comments on commit 6a5fc3f

Please sign in to comment.