correct locking primitive?

Jeff Haran Jeff.Haran at citrix.com
Wed Aug 12 14:32:42 EDT 2015


>-----Original Message-----
>From: kernelnewbies-bounces at kernelnewbies.org [mailto:kernelnewbies-
>bounces at kernelnewbies.org] On Behalf Of Nicholas Murphy
>Sent: Tuesday, August 11, 2015 7:58 PM
>To: nick
>Cc: kernelnewbies at 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



More information about the Kernelnewbies mailing list