lkml.org 
[lkml]   [2008]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
DateWed, 16 Jan 2008 21:47:16 -0800
FromJohn Hubbard <>
SubjectRe: Bitops source problem
Pravin Nanaware wrote:
> Hi,
>
> I was just going through the include file in the /usr/include/asm/bitops.h
>
> The function description describes it as non-atomic but it seems it is not.
>
> static __inline__ void __change_bit(int nr, volatile void * addr)
> {
> __asm__ __volatile__(
> "btcl %1,%0"
> :"=m" (ADDR)
> :"Ir" (nr));
> }
>
> The kernel version I am using is 2.6.9-42. Is it right or am I missing something ?
>
> Thanks,
> Pravin
>

The bitops.h comments are correct: the btc IA-32 instruction is only
atomic if used with the lock prefix. The function above does not use the
lock prefix, so it is not atomic.

thanks,
John Hubbard



\
 
 \ /
  Last update: 2008-01-17 07:15    [from the cache]
©2003-2010