-----Original Message----- From: kernelnewbies-bounces@kernelnewbies.org [mailto:kernelnewbies- bounces@kernelnewbies.org] On Behalf Of Nicholas Murphy Sent: Tuesday, August 11, 2015 7:58 PM To: nick Cc: kernelnewbies@kernelnewbies.org Subject: Re: correct locking primitive?
Please don't answer in riddles. This page:
https://www.kernel.org/pub/linux/kernel/people/rusty/kernel- locking/x157.html
...in particular says that timers are basically softirq's, and it therefore seems to imply the use of spin_lock_bh.
Presumably what I didn't understand is that spin_lock_bh should be used in the user context, and a simple spin lock should be used in the timer because it is a softirq?
Thanks, Nick
Disclaimer: I'm no expert on these hi res timers, but this seems to suggest that high res timer execution context could be either top half or bottom half: http://blog.csdn.net/ganggexiongqi/article/details/7013764 "One interesting aspect is the ability to define the execution context of the callback function (such as in softirq or hardiirq context)." If in fact the callbacks can be executed in top half, that would explain your observations. Jeff Haran