-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Spin lock deadlock detection #1670
Conversation
{ | ||
unsigned int retries = 0; | ||
unsigned int reminder = 0; | ||
assert(thread_foreign_intr_disabled()); |
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.
minor: empty line before the assert.
unsigned int retries = 0; | ||
unsigned int reminder = 0; | ||
|
||
while (!cpu_spin_trylock(&pager_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.
!
or not !
?
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.
/* returns 0 on locking success, non zero on failure */
unsigned int __cpu_spin_trylock(unsigned int *lock);
....
static inline bool cpu_spin_trylock(unsigned int *lock)
{
unsigned int rc;
assert(thread_foreign_intr_disabled());
rc = __cpu_spin_trylock(lock);
if (!rc)
spinlock_count_incr();
return !rc;
}
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 don't actually understand why cpu_spin_trylock() == !__cpu_spin_trylock()
, which can throw into confusion
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 agree, it is confusing. It stems from strex
returning 1
in <Rd>
on failure and 0
on success and that __cpu_spin_trylock()
tries to do the bare minimum.
The code here is correct though.
Review comment addressed |
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.
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Attempts to detect and report deadlock on spin locks.. Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Adds more details to deadlock report inside pager. Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org> Tested-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
cd87814
to
413a61f
Compare
Tag applied |
No description provided.