NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/57515: sparc32 GCC defaults to SC memory ordering, which is not true on SPARCv8 processors
The following reply was made to PR port-sparc/57515; it has been noted by GNATS.
From: Taylor R Campbell <campbell%mumble.net@localhost>
To: Taylor R Campbell <riastradh%NetBSD.org@localhost>
Cc: Martin Husemann <martin%duskware.de@localhost>, gnats-bugs%NetBSD.org@localhost
Subject: Re: kern/57515: sparc32 GCC defaults to SC memory ordering, which is
not true on SPARCv8 processors
Date: Sun, 9 Jul 2023 12:17:29 +0000
> Date: Sat, 8 Jul 2023 21:40:46 +0000
> From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
>=20
> > Date: Sat, 8 Jul 2023 23:24:50 +0200
> > From: Martin Husemann <martin%duskware.de@localhost>
> >=20
> > On Sat, Jul 08, 2023 at 08:19:37PM +0000, Taylor R Campbell wrote:
> > > If a `NetBSD/sparc' userland is supposed to work on sparcv7 and
> > > sparcv8 CPUs, well, that's a problem, because these are both broken:
> >=20
> > Well, I don't know about v8 and early details, but kinda assumed it
> > would be similar to v9 where it is under (kernel's) software controll
> > (and binaries get run with the memory model they are compiled for).
>=20
> Ah -- it is possible that the v7-targeted compiler will generate
> binaries with memory model SC instead of TSO, in which case there's no
> bug here, but there is a substantial performance impact on MP sparcv8
> by forcing SC for everything.
It appears that:
1. Only SPARCv9 ELF binaries can specify the memory model -- SPARCv8
binaries cannot. SPARCv8 doesn't appear to have a PSTATE register
to set the memory model either.
2. The PSTATE_MM field, and the SPARCv9 ELF header, doesn't even have
an assignment of bits for SC (sequential consistency) -- only for
TSO, PSO, and RMO, with the remaining possible value reserved,
according to the SPARCv9 architecture manual and the Oracle ELF manual.
https://web.archive.org/web/20221221170717/https://docs.oracle.com/en/op=
erating-systems/solaris/oracle-solaris/11.4/linkers-libraries/elf-header.ht=
ml =20
So unfortunately that doesn't work.
But a modest patch to gcc -- in code that's not likely to be changing
much -- to make `-mcpu=3Dv7 -mmemorymodel=3Dtso' work for this purpose
should do it.
Home |
Main Index |
Thread Index |
Old Index