[openib-general] Re: [PATCH] opensm: make cl_atomic functions atomic
Michael S. Tsirkin
mst at mellanox.co.il
Mon Mar 6 09:17:30 PST 2006
Quoting r. Fabian Tillier <ftillier at silverstorm.com>:
> Subject: Re: [PATCH] opensm: make cl_atomic functions atomic
>
> On 3/2/06, Sasha Khapyorsky <sashak at voltaire.com> wrote:
> > Hello,
> >
> > complib's cl_atomic_() functions are not atomic in current implementation,
> > they use static per function locks so race is possible between different
> > functions (for example between _inc() and _dec()). Such races are pretty
> > reproducible in practice - for example it is used to inc/decrement mad
> > counters in opensm.
>
> Why aren't we using atomic operations here? Does Linux not support
> atomic increment/decrement in user-mode?
>
> - Fab
You don't actually need operating-system support for user-mode atomics.
But there is no way that I know of to do atomic operations portably
across all architectures that Linux supports.
So I guess complib chose the easy way out and just implemented them with
a lock which is portable.
--
Michael S. Tsirkin
Staff Engineer, Mellanox Technologies
More information about the general
mailing list