WL#7655: Remove MY_ATOMIC_MODE_RWLOCKS

Status: Complete   —   Priority: Medium

Our atomics functions currently has 4 different implementations:
1) GCC builtins:
   http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html
2) Windows Interlocked operations:
  
http://msdn.microsoft.com/en-
us/library/windows/desktop/ms686360%28v=vs.85%29.aspx#interlocked_functions
3) Solaris atomics:
   http://docs.oracle.com/cd/E23824_01/html/821-1477/atomic-cas-16-9f.html 
(etc.)
4) MY_ATOMIC_MODE_RWLOCKS - implementation using mutexes.

4) is used as a backup if neither 1, 2 or 3 can be used.

This worklog is about removing 4) and relying on that either 1, 2 and 3 can be
used for all supported platforms. By removing MY_ATOMIC_MODE_RWLOCKS we can
simplify our atomics API, remove code that we don't test, and prevent that
MY_ATOMIC_MODE_RWLOCKS masks bugs.

1,2,3 has performance benefits compared to 4. For example, for Windows
http://software.intel.com/en-us/articles/choosing-between-synchronization-
primitives reports a factor 50-100x performance benefit with high contention.

The possible downside is that any platform where 1, 2 or 3 doesn't work, won't
be able to compile MySQL.

Pushbuild testing using mysql-trunk-itch-full has shown one potential problem: 
32 bit RHEL 5 (e.g. loki19 and vitro97). In this case, the problem seems to 
be that GCC 4.1.2 is unable to detect that the processors support native 
atomics. This can be solved by upgrading GCC to 4.4 (which is in the RHEL 5 
repo) or using -march to specify platform explictly.
According to the list of supported platforms and compilers for 5.7 RHEL 5 will
be built using GCC 4.4, which removes this potential problem.

For relevant non-supported platforms, testing has shown that 1) works fine
both on ARM 32/64 bit and PowerPC 64 bit (both using GCC 4.7 or newer).
PowerPC 32 bit won't work, but this is not a supported platform and in
marginal use anyway.

User Documentation
==================

http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-5.html
NF-1: On platforms where native atomics are supported, this worklog will not 
      introduce any changes. On platforms where we don't have native atomics
      support, the server will no longer compile.
I-1: The MY_ATOMIC_MODE_RWLOCKS CMake parameter will be removed.

I-2: The WITH_ATOMIC_LOCKS CMake parameter will be removed. With RWLOCKS gone,
     only the "smp" value (native atomics) parameter value remained, making
     WITH_ATOMIC_LOCKS pointless. 
- Remove all my_atomic_rwlock_* macros (definition and usage)
- Remove my_atomic_rwlock_t (defintion and usage)
- Remove include/atomic/rwlock.h
- Simplify include/lf.h - remove lock/nolock macro wrappers 
- Remove storage/perfschema/pfs_atomic.cc
- Remove mysql_prlock_wrlock_if_atomic_mode_* macros in mdl.cc