-
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_adjtime: use small lock to protect g_adjtime_ppb g_adjtime_wdog #15138
base: master
Are you sure you want to change the base?
Conversation
@@ -108,7 +109,7 @@ static int adjtime_start(long long adjust_usec) | |||
ppb = -ppb_limit; | |||
} | |||
|
|||
flags = enter_critical_section(); | |||
flags = spin_lock_irqsave(&g_adjtime_lock); |
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.
line 119/123
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.
up_adjtime up_rtc_adjtime are only called in this file and all have been protected by g_adjtime_lock
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.
What I mean is, you're not entirely sure how each lower half will implement these interfaces, right? If the up_xxx API has access to global variables, local spinlock may not guarantee that the underlying implementation has exclusive access to variables
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.
Addressing widely-used critical sections is not an easy task. now, we can analyze the issue case by case, considering that there is a limited number of up_xxx interfaces. We can examine the specific modifications or read operations of the up_xxx interfaces, as well as check whether the files they are located in use critical sections, to determine whether the modifications are safe.
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.
We must ensure that each branch is safe. If all codes and variables are within the visible range, such modification is acceptable. Otherwise, please cautious.
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.
yes, If we remove the critical section protection for up_xxx, we should examine all the logic related to up_xxx to ensure there are no issues.
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 likely does not fully meet the NuttX requirements. While it provides some information, it's severely lacking in detail and completeness. Here's a breakdown of the missing pieces:
In short, the PR needs significantly more information to be considered complete. It needs to clearly explain the motivation, the implementation details, the potential impact on various aspects of the system, and provide concrete evidence that the change works as intended. |
Summary
clock_adjtime: use small lock to protect g_adjtime_ppb g_adjtime_wdog
reason:
We would like to replace the critical section with a small lock.
Impact
clock_adjtime
Testing
ci ostest