-
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
clock_timekeeping: remove enter_critical_section in sched/clock/clock_timekeeping.c #15136
base: master
Are you sure you want to change the base?
Conversation
…_timekeeping.c reason: We would like to replace the critical section with a small lock. Signed-off-by: hujun5 <[email protected]>
[Experimental Bot, please feedback here] No, this PR does not fully meet the NuttX requirements. While it provides a summary and mentions testing, it lacks crucial details. Here's what's missing:
The PR needs to be significantly expanded to meet the requirements. Provide the missing information to ensure a thorough review. |
@@ -72,7 +73,7 @@ static int clock_get_current_time(FAR struct timespec *ts, | |||
time_t sec; | |||
int ret; | |||
|
|||
flags = enter_critical_section(); | |||
flags = spin_lock_irqsave(&g_clock_lock); | |||
|
|||
ret = up_timer_gettick(&counter); |
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.
ret = up_timer_gettick(&counter); | |
ret = up_timer_gettick(&counter); <--- |
same issue with #15129, how to protect lower half data
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.
I believe there is no clear specification that requires up_timer_gettick to be called within a critical_section. Currently, there are numerous calls to up_timer_gettick that are not within a critical section. For example, clock_systime_ticks calls up_timer_gettick, but clock_systime_ticks itself is not within a critical_section in many places.
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.
The key issue is that the scope of impact of your code before and after modification is different. You cannot guarantee that the modification will not bring side effects within the visible range. If you insist on making changes, please ignore my comments,I will not spend time reviewing similar submissions in the future.
@@ -292,6 +296,7 @@ void clock_inittimekeeping(FAR const struct timespec *tp) | |||
} | |||
|
|||
up_timer_gettick(&g_clock_last_counter); |
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.
ditto
Summary
clock_timekeeping: remove enter_critical_section in sched/clock/clock_timekeeping.c
reason:
We would like to replace the critical section with a small lock.
Impact
clock_timekeeping
Testing
ci