Mauro Sacchetto <mauro.sacchetto@stripped> writes:
> I communicate it to bugzilla. The kernel team replied:
>> Additionally, last I checked MySQL abused atomic.h in a way it was never meant
>> to be used (for using the inline functions in userspace).
> I compiled from myself the headers for the most recent kernel.
> With 2.6.13 mysql compilation worls fine, with 2.6.14 no.
> Please, consider if the problem is not of mysql itself...
The Red Hat distribution of mysql ran into this problem quite some time
ago: the "atomic add/sub" assembly code doesn't work on any of RH's
64-bit platforms. Fortunately there is a configure-driven option to not
use that code. We fix it by hacking configure.in (see attached patch,
which presumes that you run autoconf afterwards) but I suppose you could
also do it by modifying configure's output files. The patch was
generated against 4.1.x, as you can see, but it still applies to 5.0.x.
regards, tom lane
The idea of userland using <asm/atomic.h> has our kernel hackers all bent
out of shape, so don't do it. Suppressing this has another benefit too,
which is we avoid the 4-vs-8-byte problem in BDB that formerly required
mysql-threads.patch.
diff -Naur mysql-4.1.12.orig/configure.in mysql-4.1.12/configure.in
--- mysql-4.1.12.orig/configure.in 2005-05-13 07:32:33.000000000 -0400
+++ mysql-4.1.12/configure.in 2005-07-11 12:16:28.000000000 -0400
@@ -862,43 +862,6 @@
AC_SUBST(WRAPLIBS)
if test "$TARGET_LINUX" = "true"; then
- AC_MSG_CHECKING([for atomic operations])
-
- atom_ops=
- AC_TRY_RUN([
-#include <asm/atomic.h>
-int main()
-{
- atomic_t v;
-
- atomic_set(&v, 23);
- atomic_add(5, &v);
- return atomic_read(&v) == 28 ? 0 : -1;
-}
- ],
- [AC_DEFINE([HAVE_ATOMIC_ADD], [1],
- [atomic_add() from <asm/atomic.h> (Linux only)])
- atom_ops="${atom_ops}atomic_add "],
- )
- AC_TRY_RUN([
-#include <asm/atomic.h>
-int main()
-{
- atomic_t v;
-
- atomic_set(&v, 23);
- atomic_sub(5, &v);
- return atomic_read(&v) == 18 ? 0 : -1;
-}
- ],
- [AC_DEFINE([HAVE_ATOMIC_SUB], [1],
- [atomic_sub() from <asm/atomic.h> (Linux only)])
- atom_ops="${atom_ops}atomic_sub "],
- )
-
- if test -z "$atom_ops"; then atom_ops="no"; fi
- AC_MSG_RESULT($atom_ops)
-
AC_ARG_WITH(pstack,
[ --with-pstack Use the pstack backtrace library],
[ USE_PSTACK=$withval ],