lkml.org 
[lkml]   [1998]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: test_and_set_bit() not atomic forever? [cli/sti in char/vt.c [patch]]
> > > test_and_set is *by* *definition* an atomic operation. However, some
>
> Does everyone agree on this? If so I'm going back to the original patch,
> test_and_set feels so much simpler and to the point than these
> atomic_dec_and_test, atomic_..., etc

There seems to be some terminology confusion here. There are two kinds
of atomicicty... many CPUs provide an "atomic" test-and-set instruction
which can not be interrupted (by interrupts, that is). These
instructions usually are not atomic at the bus level, only at the CPU
instruction level. Another bus master (a DMA device or another CPU) can
access the same memory word inbetween the test and the set.

So another kind of atomicity is often provided which is guaranteed
atomic even against other CPUs contending for the same word using the
same mechanism. Some CPUs don't provide such a mechanism in hardware so
it has to be implemented on top of spinlocks or somesuch device.

It looks like somebody needs to define and document which kind of
atomicity is guaranteed by each of these various macros in Linux.

-=] Ford [=-

"Unix was not designed to stop (In Real Life: Mike Ditto)
people from doing stupid things, ford@omnicron.com
because that would also stop them http://www.omnicron.com/~ford/ford.html
from doing clever things." - Doug Gwyn

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:42    [W:0.092 / U:4.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site