Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@vivek1-j
Copy link
Contributor

@vivek1-j vivek1-j commented Nov 20, 2025

In this PR we have moved PM Idle function from os/pm to os/kernel power directories.
At present we have moved the code as it is.

int sched_cpuoff(int cpu, bool migrate)
{
if(spin_trylock(&g_cpuhp_lock[cpu]) == SP_LOCKED) {
slldbg("CPU state change is already in progress\n");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Check if there is a race condition between spin_trylock() and spin_lock()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The locks are taken in same order and released in same order from both the APIs. We don't think there can be race condition.

ret = up_cpu_off(cpu);
} else {
slldbg("CPU is already off\n");
ret = -EBUSY;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Returns -EBUSY when CPU is already off, but in sched_cpuon() it returns -EBUSY when CPU is already on. This is inconsistent - should probably return -EINVAL or a more appropriate error code for "already in desired state".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

EBUSY is changed to ENOTSUP to signify that the CPU is already in desired state and therefore operation is not supported.

@vivek1-j vivek1-j force-pushed the scheduler_cpu_on_off branch 3 times, most recently from 0390857 to 9ea8e01 Compare November 21, 2025 07:51
@@ -0,0 +1,30 @@
###########################################################################
#
# Copyright 2019 Samsung Electronics All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

2025

@@ -0,0 +1,30 @@
###########################################################################
Copy link
Contributor

Choose a reason for hiding this comment

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

Please seperate this commit to new PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am modifying this PR to include only pm_idle move changes, will raise another PR for the scheduler modifications

@vivek1-j vivek1-j force-pushed the scheduler_cpu_on_off branch from 9ea8e01 to fecd8a3 Compare November 25, 2025 05:59
Copy link
Contributor

@sunghan-chang sunghan-chang left a comment

Choose a reason for hiding this comment

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

@vivek1-j @singh-aditya-04
Is this a valid PR? Please follow our commit rules. The title for commit and PR is not matched. I don't get what this is.

@sunghan-chang
Copy link
Contributor

In this PR we have moved PM Idle function from os/pm to os/kernel power directories. At present we have moved the code as it is.

Could you let me know why?

#include <tinyara/clock.h>
#include <tinyara/irq.h>
#include <tinyara/arch.h>
#include "../kernel/sched/sched.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to check here

@vivek1-j vivek1-j changed the title CPU ON/OFF functionality added to Scheduler. Moving pm_idle to kernel Nov 27, 2025
@vivek1-j vivek1-j force-pushed the scheduler_cpu_on_off branch from fecd8a3 to d7734d9 Compare December 5, 2025 05:30
@sunghan-chang
Copy link
Contributor

@vivek1-j There is no update on my queries. Could you let me get replies for them?

@vivek1-j vivek1-j force-pushed the scheduler_cpu_on_off branch from d7734d9 to 84dbdc5 Compare December 29, 2025 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants