ichsmb - correct locking strategy?

Hans Petter Selasky hselasky at c2i.net
Fri Feb 18 15:09:53 UTC 2011


On Friday 18 February 2011 15:10:47 Svatopluk Kraus wrote:
> Hi,
> 
>   I try to figure out locking strategy in FreeBSD and found 'ichsmb'
> device. There is a mutex which protects smb bus (ichsmb device). For
> example in ichsmb_readw() in sys/dev/ichsmb/ichsmb.c, the mutex is
> locked and a command is written to bus, then unbounded (but with
> timeout) sleep is done (mutex is unlocked during sleep). After sleep a
> word is read from bus and the mutex is unlocked.
> 
>   1. If an use of the device IS NOT serialized by layers around then
> more calls to this function (or others) can be started or even done
> before the first one is finished. The mutex don't protect sms bus.
> 
>   2. If an use of the device IS serialized by layers around then the
> mutex is useless.
> 
>   Moreover, I don't mension interrupt routine which uses the mutex and
> smb bus too.
> 
>   Am I right? Or did I miss something?

man sx ?

struct sx ?

--HPS


More information about the freebsd-hackers mailing list