lkml.org 
[lkml]   [1996]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: PROBLEM --> Atomic operations in mmap attached address space...
Date
From


> Thats potentially just luck. Especially if you are using a sparc ;)
>
> > asm volatile ("
> > lock ;
> > btsl %2,%1\n\tsbbl %0,%0"
> > :"=r" (oldbit),"=m" (ADDR)
> > :"ir" (nr));
>
> Not atomic if it takes a page fault I suspect

This is taken directly from the kernel code at include/asm-i386/bitops.h

Previously I was using :

#define swap_il(adr,reg) \
({ \
char _ret; \
asm volatile ("xchgb %0,%1" \
: "=q" (_ret), "=m" (*(adr)) \
: "m" (*(adr)), "0" (reg)); \
_ret; \
})

This works well in the Sequent !! Unfortunately it was not working
with Linux in "mmap" mapped address space... So I tried to use what was
being done at the kernel level with no avail... But I am pretty confident
that the problem really lies in the way mmap is implemented !! 8-(...

> Normally you should use the semop() syscalls. If you want to play
> dangerously (and non portably) you can do stuff directly. On the intel
> it will probably work as the Intel processors are fully cache coherent
> and Linux has nothing to do with them. Even then I'd really recommend you
> never do certain things like share FPU values and the FPU's are sometimes
> a bit asynchronous to the CPU.

For performance sake i do not want to do a syscall !!! Specially if this works
with "shmat" mapped address space !!! ;-)...

mcc

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