[head tinderbox] failure on arm and amd

M. Warner Losh imp at bsdimp.com
Sun Jun 3 18:05:06 UTC 2007


In message: <46623D56.2060805 at FreeBSD.org>
            Doug Barton <dougb at freebsd.org> writes:
: FreeBSD Tinderbox wrote:
: > cc -O2 -pipe  -DVERSION='"9.4.1"' -DHAVE_CONFIG_H -DLIBINTERFACE=30 -DLIBREVISION=3 -DLIBAGE=0 -DWANT_IPV6 -DOPENSSL -DUSE_MD5 -DNS_LOCALSTATEDIR='"/var"' -DNS_SYSCONFDIR='"/etc/namedb"' -DNAMED_CONFFILE='"/etc/namedb/named.conf"' -DRNDC_CONFFILE='"/etc/namedb/rndc.conf"' -DRNDC_KEYFILE='"/etc/namedb/rndc.key"' -I/src/lib/bind/bind9/.. -I/src/lib/bind/bind9/../../../contrib/bind9/lib/bind9/include -I/src/lib/bind/bind9/../../../contrib/bind9/lib/dns/include/dst  -I/src/lib/bind/bind9/../../../contrib/bind9/lib/dns/include  -I/src/lib/bind/bind9/../dns -I/src/lib/bind/bind9/../../../contrib/bind9/lib/isccc/include -I/src/lib/bind/bind9/../../../contrib/bind9/lib/isccfg/include -I/src/lib/bind/bind9/../../../contrib/bind9/lib/isc/unix/include  -I/src/lib/bind/bind9/../../../contrib/bind9/lib/isc/pthreads/include  -I/src/lib/bind/bind9/../../../contrib/bind9/lib/isc/include  -I/src/lib/bind/bind9/../isc -I/src/lib/bind/bind9/../../../contrib/bind9/lib/lwres/unix/include  -I/sr
: c/
: >  lib/bind/bind9/../../../contrib/bind9/lib/lwres/include  -I/src/lib/bind/bind9/../lwres -I/src/lib/bind/bind9/../../../contrib/bind9/lib/bind9/include -I/src/lib/bind/bind9/../../../contrib/bind9/lib/isc/mips/include  -c /src/lib/bind/bind9/../../../contrib/bind9/lib/bind9/getaddresses.c
: > cc -O2 -pipe  -DVERSION='"9.4.1"' -DHAVE_CONFIG_H -DLIBINTERFACE=30 -DLIBREVISION=3 -DLIBAGE=0 -DWANT_IPV6 -DOPENSSL -DUSE_MD5 -DNS_LOCALSTATEDIR='"/var"' -DNS_SYSCONFDIR='"/etc/namedb"' -DNAMED_CONFFILE='"/etc/namedb/named.conf"' -DRNDC_CONFFILE='"/etc/namedb/rndc.conf"' -DRNDC_KEYFILE='"/etc/namedb/rndc.key"' -I/src/lib/bind/bind9/.. -I/src/lib/bind/bind9/../../../contrib/bind9/lib/bind9/include -I/src/lib/bind/bind9/../../../contrib/bind9/lib/dns/include/dst  -I/src/lib/bind/bind9/../../../contrib/bind9/lib/dns/include  -I/src/lib/bind/bind9/../dns -I/src/lib/bind/bind9/../../../contrib/bind9/lib/isccc/include -I/src/lib/bind/bind9/../../../contrib/bind9/lib/isccfg/include -I/src/lib/bind/bind9/../../../contrib/bind9/lib/isc/unix/include  -I/src/lib/bind/bind9/../../../contrib/bind9/lib/isc/pthreads/include  -I/src/lib/bind/bind9/../../../contrib/bind9/lib/isc/include  -I/src/lib/bind/bind9/../isc -I/src/lib/bind/bind9/../../../contrib/bind9/lib/lwres/unix/include  -I/sr
: c/
: >  lib/bind/bind9/../../../contrib/bind9/lib/lwres/include  -I/src/lib/bind/bind9/../lwres -I/src/lib/bind/bind9/../../../contrib/bind9/lib/bind9/include -I/src/lib/bind/bind9/../../../contrib/bind9/lib/isc/mips/include  -c /src/lib/bind/bind9/../../../contrib/bind9/lib/bind9/version.c
: > building static bind9 library
: > ranlib libbind9.a
: > ===> lib/bind/dns (all)
: > cc -O2 -pipe  -DVERSION='"9.4.1"' -DHAVE_CONFIG_H -DLIBINTERFACE=33 -DLIBREVISION=1 -DLIBAGE=1 -DWANT_IPV6 -DOPENSSL -DUSE_MD5 -DNS_LOCALSTATEDIR='"/var"' -DNS_SYSCONFDIR='"/etc/namedb"' -DNAMED_CONFFILE='"/etc/namedb/named.conf"' -DRNDC_CONFFILE='"/etc/namedb/rndc.conf"' -DRNDC_KEYFILE='"/etc/namedb/rndc.key"' -I/src/lib/bind/dns/.. -I/src/lib/bind/dns/../../../contrib/bind9/lib/bind9/include -I/src/lib/bind/dns/../../../contrib/bind9/lib/dns/include/dst  -I/src/lib/bind/dns/../../../contrib/bind9/lib/dns/include  -I/src/lib/bind/dns/../dns -I/src/lib/bind/dns/../../../contrib/bind9/lib/isccc/include -I/src/lib/bind/dns/../../../contrib/bind9/lib/isccfg/include -I/src/lib/bind/dns/../../../contrib/bind9/lib/isc/unix/include  -I/src/lib/bind/dns/../../../contrib/bind9/lib/isc/pthreads/include  -I/src/lib/bind/dns/../../../contrib/bind9/lib/isc/include  -I/src/lib/bind/dns/../isc -I/src/lib/bind/dns/../../../contrib/bind9/lib/lwres/unix/include  -I/src/lib/bind/dns/../../../
: co
: >  ntrib/bind9/lib/lwres/include  -I/src/lib/bind/dns/../lwres -I/src/lib/bind/dns/../../../contrib/bind9/lib/dns/include/dst -I/src/lib/bind/dns/../../../contrib/bind9/lib/dns/include -I/src/lib/bind/dns/../../../contrib/bind9/lib/dns -I/src/lib/bind/dns -I/src/lib/bind/dns/../../../contrib/bind9/lib/isc/mips/include  -c /src/lib/bind/dns/../../../contrib/bind9/lib/dns/acache.c
: > /src/lib/bind/dns/../../../contrib/bind9/lib/isc/mips/include/isc/atomic.h: In function 'isc_atomic_xadd':
: > /src/lib/bind/dns/../../../contrib/bind9/lib/isc/mips/include/isc/atomic.h:35: error: unknown register name '$3' in 'asm'
: 
: I would appreciate it if someone familiar with our arm and/or amd
: platforms and atomic operations would take a look at line 65 of
: src/lib/bind/config.mk and the atomic.h files in the various platform
: directories of src/contrib/bind9/lib/isc and give me a suggestion on
: what you think might be a better option. If necessary I can
: conditionalize out thread support for arm and/or amd easily enough,
: but I was hoping to avoid doing that for obvious reasons. OTOH, if
: they will work with threads, but don't have atomic ops, we can fix
: that much more easily.

There is no bind9/lib/isc/*ARM*/include/isc/atomic.h, which is the
problem.  The mips/include/isc/atomic.h has mips goo in it, and that's
not going to work too well.

Some platforms define their atomic operations in terms of the host's
API.  Maybe we should have generic version based on our atomic.h?
There's only 3 rouinets that are needed (here's the x86 versions:

/*
 * This routine atomically increments the value stored in 'p' by 'val', and
 * returns the previous value.
 *
 * XXXimp: This looks identical to atomic_fetchadd_int()
 */
static inline isc_int32_t
isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
	isc_int32_t prev = val;

	__asm__ volatile(
#ifdef ISC_PLATFORM_USETHREADS
		"lock;"
#endif
		"xadd %0, %1"
		:"=q"(prev)
		:"m"(*p), "0"(prev)
		:"memory", "cc");

	return (prev);
}


/*
 * This routine atomically stores the value 'val' in 'p'.
 *
 * XXXimp: This looks identical to atomic_store_rel_int()
 */
static inline void
isc_atomic_store(isc_int32_t *p, isc_int32_t val) {
	__asm__ volatile(
#ifdef ISC_PLATFORM_USETHREADS
		/*
		 * xchg should automatically lock memory, but we add it
		 * explicitly just in case (it at least doesn't harm)
		 */
		"lock;"		
#endif

		"xchgl %1, %0"
		:
		: "r"(val), "m"(*p)
		: "memory");
}

/*
 * This routine atomically replaces the value in 'p' with 'val', if the
 * original value is equal to 'cmpval'.  The original value is returned in any
 * case.
 *
 * XXXimp: This looks identical to atomic_cmpset_int()
 */
static inline isc_int32_t
isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) {
	__asm__ volatile(
#ifdef ISC_PLATFORM_USETHREADS
		"lock;"
#endif
		"cmpxchgl %1, %2"
		: "=a"(cmpval)
		: "r"(val), "m"(*p), "a"(cmpval)
		: "memory");

	return (cmpval);
}

So at a guess, the FreeBSD/arm implementation (or actually any) would
be:

#ifndef ISC_ATOMIC_H
#define ISC_ATOMIC_H 1

#include <isc/platform.h>
#include <isc/types.h>
#include <machine/atomic.h>

#ifdef __FreeBSD__
static inline isc_int32_t
isc_atomic_xadd(isc_int32_t *p, isc_int32_t val)
{
	return atomic_fetchadd_int(p, val);
}

static inline void
isc_atomic_store(isc_int32_t *p, isc_int32_t val)
{
	atomic_store_rel_int(p, val);
}

static inline isc_int32_t
isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val)
{
	return atomic_cmpset_int(p, cmpval, val);
}
#else /* !FreeBSD */

#error "unsupported compiler.  disable atomic ops by --disable-atomic"

#endif
#endif /* ISC_ATOMIC_H */

Now, why we'd use the 'mips' version in the first place, I can't say.
But this should give you enough to make some progress.

Warner


More information about the freebsd-current mailing list