Skip to content

[nrf fromtree] Device runtime PM fixes#4096

Merged
rlubos merged 2 commits into
nrfconnect:mainfrom
nordic-krch:ncs/pm_device_stress
Jun 3, 2026
Merged

[nrf fromtree] Device runtime PM fixes#4096
rlubos merged 2 commits into
nrfconnect:mainfrom
nordic-krch:ncs/pm_device_stress

Conversation

@nordic-krch
Copy link
Copy Markdown
Contributor

PR fixes a potential race condition if PM device runtime is called from multiple preemptable contexts.

@nordic-krch nordic-krch force-pushed the ncs/pm_device_stress branch from 8043695 to be669d8 Compare May 28, 2026 06:11
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request May 28, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-zephyr#4096

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
@nordic-krch nordic-krch force-pushed the ncs/pm_device_stress branch from be669d8 to 6277f44 Compare May 28, 2026 11:24
@nordic-krch nordic-krch changed the title Device runtime PM fixes [nrf fromtree] Device runtime PM fixes May 28, 2026
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request May 28, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-zephyr#4096

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
@nordic-krch nordic-krch force-pushed the ncs/pm_device_stress branch from 6277f44 to c030e51 Compare June 1, 2026 06:28
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Jun 1, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-zephyr#4096

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
Add test that will check if PM device runtime can handle safely a
case where user is calling put and get API from the thread context
and device is self-managing itself calling PM device runtime API
from an interrupt context.

Test is failing and scenario is fixed by the following commit.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
(cherry picked from commit 488165deadd8f52723cf475ea1439fde74ab70b1)
…ple contexts

Add early exist to the suspend function if suspending client is
not the last one. It fixes the case where user calls put function
from the thread context and it gets interrupted by the device
interrupt where another asynchronous put is called. In that case,
in the interrupt context the call will return error as semaphore
cannot be taken and reference counting gets broken. By adding
an early exit if context is not the last one, we ensure that only
last client executes suspending procedure.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
(cherry picked from commit 46e5ba3732f48ee9a903239a854079fc04f7b3fa)
@nordic-krch nordic-krch force-pushed the ncs/pm_device_stress branch from c030e51 to 685a58d Compare June 2, 2026 06:08
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Jun 2, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-zephyr#4096

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
@rlubos rlubos merged commit 1db328d into nrfconnect:main Jun 3, 2026
11 checks passed
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Jun 3, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-zephyr#4096

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants