Skip to content

[Bug]components/drivers/pm/pm.c rt_pm_device_register API would be hang when RT_USING_SMP is configured #10075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
michael-vinke opened this issue Mar 5, 2025 · 0 comments
Labels
bug This PR/issue is a bug in the current code.

Comments

@michael-vinke
Copy link

RT-Thread Version

5.1.0

Hardware Type/Architectures

riscv

Develop Toolchain

GCC

Describe the bug

  1. define RT_USING_SMP macro
  2. using rt_pm_device_register API at components initialization context
  3. the API would be hang at RT_KERNEL_REALLOC calling
    Solution:
    put the RT_KERNEL_REALLOC calling out of critical region, just like as below:
    device_pm = (struct rt_device_pm *)RT_KERNEL_REALLOC(_pm.device_pm,
    (_pm.device_pm_number + 1) * sizeof(struct rt_device_pm));
    if (device_pm != RT_NULL)
    {
    level = rt_hw_interrupt_disable();
    _pm.device_pm = device_pm;
    _pm.device_pm[_pm.device_pm_number].device = device;
    _pm.device_pm[_pm.device_pm_number].ops = ops;
    _pm.device_pm_number += 1;
    rt_hw_interrupt_enable(level);
    }

Other additional context

No response

@BernardXiong BernardXiong added the bug This PR/issue is a bug in the current code. label Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This PR/issue is a bug in the current code.
Projects
None yet
Development

No branches or pull requests

2 participants