Re: sparc packages?

Romain Dolbeau <[email protected]>
Newsgroups gmane.os.netbsd.ports.sparc
Message-ID <CADuzgbqn5-Zf2Uct89CqX0kK0E9c=rHZ7zDNko_QoHuZw7i2cA@mail.gmail.com>
Le sam. 4 mars 2023 à 17:38, Romain Dolbeau <[email protected]> a écrit :
> I can see a mutex.h in /usr/src/sys/arch/sparc/include, but it doesn't
> seem to fully define the mutex. I suspect the interesting bit is
> wherever the _atomic_cas_ulong() used in that file is defined, as on
> v7/v8 there is no hardware CAS so it has to be emulated somehow. Is
> that indeed the dodgy bit and if so where is it implemented ?

OK, following up on myself for that:

(a) sys/arch/sparc/include/mutex.h pretends that SPARC has
"__HAVE_SIMPLE_MUTEXES" and defines it and MUTEX_CAS, despite not
having hardware CAS
(b) the CAS implementation seems to be in
common/lib/libc/arch/sparc/atomic/atomic_cas.S, which makes it clear
it uses an interlock (as expected to implement CAS reliably in SMP)
(c) sys/sys/mutex.h makes it clear that 'simple mutex' is only for
architecture with "no interlock required in the MP case"

So it seems the SPARC implementation is non-compliant to the actual
definition of the mutex ?

(d) HP-PA, another architecture without hardware CAS, does not define
__HAVE_SIMPLE_MUTEXES and MUTEX_CAS and instead is a lot more complex
with many macros needed

At first glance it seems to me like SPARC should implement a solution
similar (or perhaps identical) to HP-PA ?

Cordially,

-- 
Romain Dolbeau
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.