tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Bug in mutex_owned() ?



On Sunday 25 October 2009 15:37:43 Mindaugas Rasiukevicius wrote:
> Hans Petter Selasky <hselasky%c2i.net@localhost> wrote:
> >    39 static __inline int
> >    40 __SIMPLELOCK_LOCKED_P(__cpu_simple_lock_t *__ptr)
> >    41 {
> >    42         return *__ptr == __SIMPLELOCK_LOCKED;
> >    43 }
> >
> >    72 #define __SIMPLELOCK_LOCKED     1
> >    73 #define __SIMPLELOCK_UNLOCKED   0
> >
> > mutex_owned() == 1 for spin locks ???
>
> Yes, it is a comparison.  Which is correct for the purpose.

And what is the purpose of that function? Internal only?

The comparison is right when done by the locking CPU, but if there are two 
CPU's and the non-locking CPU checks this flag at the same time, it gets a 1 
aswell, which is wrong.

--HPS


Home | Main Index | Thread Index | Old Index