correct locking primitive?

Nicholas Murphy halcyonic at gmail.com
Tue Aug 11 22:58:06 EDT 2015


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

> On Aug 11, 2015, at 7:10 PM, nick <xerofoify at gmail.com> wrote:
> 
> 
> 
>> On 2015-08-11 10:01 PM, Nicholas Murphy wrote:
>> So reading this:
>> 
>> https://www.kernel.org/pub/linux/kernel/people/rusty/kernel-locking/x137.html
>> 
>> …led me to believe that spin_lock_bh() was the correct primitive to use within a callback from a high resolution timer, but that didn’t work.  Instead using spin_lock_irqsave() did work, however.  Can someone explain why?
>> 
>> Thanks,
>> Nick
> Think about where a timer's execution is handled when the timer's timeout is
> executed.
> Nick 
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> 



More information about the Kernelnewbies mailing list