lkml.org 
[lkml]   [2008]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: Bitops source problem
Date
From
Thanks for the reply John. 

Then, I think there is a problem with the function written below which is meant to be atomic.

static __inline__ void change_bit(int nr, volatile void * addr)
{
__asm__ __volatile__(
"btcl %1,%0"
:"=m" (ADDR)
:"Ir" (nr));
}

Regards,
Pravin


-----Original Message-----
From: John Hubbard [mailto:john.hubbard@gmail.com]
Sent: Thursday, January 17, 2008 11:17 AM
To: Pravin Nanaware
Cc: LKML
Subject: Re: 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


-**************Nihilent***************
" *** All information contained in this communication is confidential, proprietary, privileged
and is intended for the addressees only. If youhave received this E-mail in error please notify
mail administrator by telephone on +91-20-39846100 or E-mail the sender by replying to
this message, and then delete this E-mail and other copies of it from your computer system.
Any unauthorized dissemination,publication, transfer or use of the contents of this communication,
with or without modifications is punishable under the relevant law.

Nihilent has scanned this mail with current virus checking technologies. However, Nihilent makes no
representations or warranties to the effect that this communication is virus-free.

Nihilent reserves the right to monitor all E-mail communications through its Corporate Network. *** "

*************************************************************************-


\
 
 \ /
  Last update: 2008-01-17 07:41    [W:2.378 / U:0.700 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site