lkml.org 
[lkml]   [2012]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/8] sta2x11-mfd : add apb-soc regs driver and factor out common code
> as far as I know, nested locks are fine provided that you always take them in
> the same order and release them in the opposite order (lock A, lock B,
> unlock B, unlock A). So my conclusion is that nested spinlocks require
> potential regmap users of sta2x11 registers to take the sta2x11-mfd spinlock
> first. The pattern would be (sctl registers for instance):

The release order does not matter. Taking AB and releasing AB or BA is
fine. Taking AB and dropping B and retaking B is fine. Taking AB and
somewhere else taking BA is not. There are performance reasons in some
cases why taking AB releasing A is best with locks, but thats generally
with sleepable locks.

It's a bit more subtle because you often have other interactions. In
particular people often come unstuck on del_timer_sync or waiting for
workqueues and IRQs to finish (even in free_irq) while holding a lock
that the handler needs to take.

Alan


\
 
 \ /
  Last update: 2012-09-27 18:41    [W:0.187 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site