Hi experts, I am planning to implement a Futex on the upcoming MMU-enabled NIOS architecture.
We did abuse the thread "Shell exits while running a program" to discuss some theoretical details on how a Futex can be done technically (which is quite tricky). Now I do have some questions about how to do the software implementation of a Futex. I do know that the pure user-space part of the Futex is done in gLibC, so that pthread_mutex...() automatically uses Futex, if same is available in the underlying arch, and use some system call it it is not. But for my first tests, I will not recompile gLibC but I do have a working (on x86) Futex user code implementation, inspired by Ulrich Drepper: "Futexes Are Tricky". One of the tasks is to provide the appropriate atomic operations for the Futex implementation. I was able to successfully do this for the x86 user space code and we have been discussing, how to do this with other archs. Now in the Kernel code in "linux-2.6/arch/x86/include/asm/futex.h" there are two different implementations for some atomic operations for the Futex: "futex_atomic_op_inuser()" and "futex_atomic_cmpxhg__inatomic()" "futex_atomic_op_inuser()" seemingly accesses user space data while being run in Kernel space (doing the .section __ex_table trick). Questions: * Is this correct ? * * In a non-SMP environment do we need to use really atomic code here, * * or does futex_atomic_op_inuser() run with interrupt disabled, anyway?* * When we are doing futex_atomic_op_inuser(), is this Kernel code * * running in system mode so that we can disable the interrupt * * do protect the atomic code in a non-SMP System ? * * are all the operations implemented there really necessary * * or just "nice to have" ? * What is "futex_atomic_cmpxhg__inatomic()" used for ? (futex_atomic_op_inuser() does not implement the "compare-and-exchange" paradigm). * futex_atomic_cmpxhg__inatomic() accesses the Futex without * * doing the user-space-access-trick, so here, the MMU * * seems to be in User mode configuration * * So when / how does the Kernel use it ? * Any pointers ? Thanks, -Michael _______________________________________________ uClinux-dev mailing list [email protected] http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by [email protected] To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev
