]> git.proxmox.com Git - mirror_frr.git/commit - zebra/zserv.c
zebra: do not load/store wider-than-ptr atomics
authorDavid Lamparter <equinox@opensourcerouting.org>
Fri, 6 Jan 2023 15:55:38 +0000 (16:55 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 6 Jan 2023 15:59:02 +0000 (16:59 +0100)
commitccac11096c385d269ecd15ad24ac88d469e7577c
tree7183e2373105941999c1afedbc3b66a8a1ca6ee7
parentb15826e81bfd9cf8325720abb31e2a7c1261a647
zebra: do not load/store wider-than-ptr atomics

Most 32-bit architectures cannot do atomic loads and stores of data
wider than their pointer size, i.e. 32 bit.  Funnily enough they
generally *can* do a CAS2, i.e., 64-bit compare-and-swap, but while a
CAS can emulate atomic add/bitops, loads and stores aren't available.

Replace with a mutex;  since this is 99% used from the zserv thread, the
mutex should take the local-to-thread fast path anyway.  And while one
atomic might be faster than a mutex lock/unlock, we're doing several
here, and at some point a mutex wins on speed anyway.

This fixes build on armel, mipsel, m68k, powerpc, and sh4.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra/zserv.c
zebra/zserv.h