[RFC] Rework mem_barrier() definitions in compiler.h

Michael macallan at netbsd.org
Tue Aug 4 06:37:29 PDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

On Aug 4, 2009, at 2:14 AM, Matt Turner wrote:

> Attached is a patch to begin cleaning compiler.h by better organizing
> the mem_barrier()/write_mem_barrier() definitions.
>
> I've moved them to a common section, clearly showing the various
> architecture implementations, as suggested more or less here [0]. I've
> checked the Linux kernel for appropriate barrier instructions and made
> a few changes, such as {s,m}fence on AMD64.
>
> As noted by the numerous XXX markers, there are quite a few issues,
> outlined here.
>
> o no Open/NetBSD for x86/64?

There sure is at least NetBSD/amd64

> o why no NetBSD check on SPARC?

Good question - SBus stuff is usually mapped uncached and with strong  
ordering anyway.

> o is the defined(sun) checking for solaris?

I think so.

> o what is the appropriate SPARC barrier instruction? Surely we can
> write it better than ".word 0x8143e00a"

it's stbar ( as in STore BARrier ) on 32bit, V9 has a more flexible  
membar instruction.

> o no BSD checks on MIPS?

We only grew accelerated X support on NetBSD/sgimips recently and at  
least my crime driver issues syncs on its own, didn't check newport  
but I suspect something similar. I didn't get around to dig through  
this particular mess yet so thanks for starting.

> o as with {s,m}fence, how to check for MIPS III 'sync' instruction?

If we're building with -march=mips3 or newer it's available, otherwise  
gas will complain. IIRC the equivalent on older MIPS archs is a dummy  
read. If you want to check at runtime - only a handful archaic CPUs  
don't have sync ( like MIPS R2x and R3k families ) as far as I remember.

have fun
Michael

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iQEVAwUBSng5mspnzkX8Yg2nAQJb0wgAhHm3YXd+m2VgDtPznanoKKWR6a3DFCnL
Dt+HTfj8W2UDLDqIkTRjWaqUoVChIZI78aYgS2162jpcQinZYtONSpMbqOlyA/ms
l7esz1VhTb2iY7Uon33wjfYf4AKA6YMqrDA86E7GpNAQBJ2h+zGZ4Q5sm0NNX9e5
bW7h3B2ttC6d4MNruK5KuSBeCMcwzxSgB5T1Q35pP2qlR1j5R9qRasmr/FOofAz6
gczLGT1qEbQX9AzlTKNOd1BEVOMgCoR90mlPkzA9CBzboaXpfz+3U/MSlKomst2+
P7UHjwyBMorj+mn0mf9FRjI/dHQAD9lUxuqwgUseKE6RR7Sl2o6pOA==
=ssrG
-----END PGP SIGNATURE-----


More information about the xorg-devel mailing list