From: Jack O'Quin (joq_at_io.com)
Date: 08/08/03 12:08 EDT
Subject: Re: [ardour-dev] a little problem with atomic.h
From: "Jack O'Quin" <joq@io.com>
Message-ID: <87oez08741.fsf@sulphur.joq.us>
Date: 08 Aug 2003 11:08:30 -0500
Paul Davis <paul@linuxaudiosystems.com> writes:
> i just noticed that the atomic.h file requires CONFIG_SMP to be
> defined for an SMP system, and that its not defined anywhere. this
> means that the atomic ops are not atomic.
I hate it when that happens. ;-)
> i believe that this affects JACK too.
Actually, JACK does not use atomic.h. Perhaps it should.
Technically, my new transport code needs some kind of atomic
operation. This is from jackd/transengine.c...
/* Handle latest asynchronous requests from the last cycle.
*
* This should ideally use an atomic swap, since commands can
* arrive at any time. There is a small timing window during
* which a request could be ignored inadvertently. Since
* another could have arrived in the previous moment and
* replaced it anyway, we won't bother with <asm/atomic.h>.
*/
cmd = ectl->transport_cmd;
ectl->transport_cmd = TransportCommandNone;
I would prefer some kind of compare-and-swap or exchange operation for
this, but atomic.h does not provide one. The comment about "not
"bothering with" atomic.h was prompted by exactly the problems we are
discussing.
> not sure of the right solution at this point.
As I see it, there are several options, all bad:
1) use the system's <asm/atomic.h>
This will (probably) work correctly on the machine for which you
are compiling. But, distributions vary considerably in their
handling of machine-dependent headers like this one. On my
Debian system it's included in the libc6-dev package. Other
systems may package it with the kernel headers or even the kernel
source. It will be hard to explain to users where to find it.
2) distribute your own copy
This will never cover all possible machine architectures, SMP,
NUMA, etc. But, it makes your package more self-contained.
3) distribute your own copy, but use the system one, if available
This has some of the advantages of 1) and 2), but adds
maintenance uncertainty about which version is being used.
Personally, I dislike option 1) less than the others.
--
Jack O'Quin
Austin, Texas, USA
"Ya pays yer money and ya takes yer choice."
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
ardour-dev mailing list
ardour-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ardour-dev
This archive was generated by hypermail 2.1.7 : 08/08/03 12:14 EDT