Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const char* kEnvVarDefaultValue = "/opt/internal/launch_manager/etc/ecu-cfg"; /

const uint32_t ConfigurationManager::kDefaultProcessExecutionError = 1U;
uint32_t ConfigurationManager::kDefaultProcessorAffinityMask() {
return (1U << osal::getNumCores()) - 1U;
return static_cast<uint32_t>((1ULL << osal::getNumCores()) - 1ULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there are 64 cores, is there still the issue or ? ;) In general, this affinity in LM supports only up to 32 cores, since later on cpu_mask_ also does not support more. So either we do an assert is there is more than 32 cores, or we do wanirng logs that default affinity is set only to first 32 cores ;)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if there are 64 cores, this issue does not reproduce. Inside the osal::getNumCores() function, there is exception handling, and the maximum value this function can return is 32. Therefore, a similar problem does not occur on a 64-core system.

If this issue is not fixed, CPU affinity cannot be configured in a 32-core system, which causes the lifecycle to not operate correctly. I have explained this in the PR.

Copy link

@daeyoung-jeong-lge daeyoung-jeong-lge Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR addresses the Undefined Behavior on 32-core systems. As chungsky mentioned, getNumCores() already caps the count at 32, so >32 core systems are safe with this default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know what i am saying that we shall probably add at least a warning (since you are already fixing issues around it) that it was capped somehwere, since defult behaviour for ie 32 and 33 cores is completely different. @NicolasFussberger what do you think ?

}
const int32_t ConfigurationManager::kDefaultSchedulingPolicy = SCHED_OTHER;
const int32_t ConfigurationManager::kDefaultRealtimeSchedulingPriority = 99;
Expand Down
Loading