-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
sched_processtimer: use small lock to protect g_timer_interval and g_timer_tick #15129
base: master
Are you sure you want to change the base?
Conversation
[Experimental Bot, please feedback here] No, this PR does not fully meet the NuttX requirements. While it provides a summary of the what, it lacks sufficient detail on the why and how. The Impact and Testing sections are also severely lacking. Here's a breakdown of what's missing:
In short, the PR needs significantly more detail to be considered complete. It needs to clearly explain the motivation, implementation, and testing of the change. |
|
||
/* Process the timer ticks and set up the next interval (or not) */ | ||
|
||
nexttime = nxsched_timer_process(ticks, elapsed, false); | ||
|
||
flags = enter_critical_section(); | ||
flags = spin_lock_irqsave_wo_note(&g_lock); | ||
g_timer_interval = nxsched_timer_start(ticks, nexttime); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nxsched_timer_start()
will access the global variables in lower harlf driver, using local spinlock cannot guarantee the same effect as csection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nxsched_timer_start will call up_timer_start or up_alarm_start
I believe that these two functions should be responsible for adding their own critical sections. In fact, this is probably how it's done in most cases.
However, there may be some overlooked scenarios. Currently, we can add an additional critical section in this function. Once all the timer driver codes have been replaced with small locks in the future, this critical section can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…timer_tick reason: We would like to replace the critical section with a small lock. Signed-off-by: hujun5 <[email protected]>
@@ -388,6 +391,8 @@ static clock_t nxsched_timer_start(clock_t ticks, clock_t interval) | |||
} | |||
#endif | |||
|
|||
flags = enter_critical_section(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why mix the critical section and spinlock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we need to protect up_timer_tick_start.
Summary
sched_processtimer: use small lock to protect g_timer_interval and g_timer_tick
reason:
We would like to replace the critical section with a small lock.
Impact
sched_processtimer
Testing
ci ostest