Re: InnoDB mutex atomics implementation incorrect on POWER and ARM
Morgan Tocker <[email protected]> Mon, 5 May 2014 11:12:50 -0700
| Newsgroups | gmane.comp.db.mysql.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Stewart, I=92ve filed this as: http://bugs.mysql.com/bug.php?id=3D72539 Please note that these systems are not officially supported, as per: http://www.mysql.com/support/supportedplatforms/database.html - Morgan --=20 Morgan Tocker MySQL Community Manager Oracle Canada - Hardware and Software, Engineered to Work Together. Office: Toronto, Canada On May 2, 2014, at 3:29 PM, Stewart Smith <[email protected]> = wrote: > Hi all, >=20 > seeing as the page to register an account for filing a MySQL bug = doesn't > work (even from a text based browser) and just times out or gives a = 500 > Internal Server Error.... I'll "file" this one here. >=20 > So, at least for MySQL 5.6 (I haven't looked at previous versions, but = I > strongly suspect the last few have this as well), the code in > sync0sync.ic for manipulating and loocking at mutex->lock_word is > missing a barrier. >=20 > This would affect multi CPU systems of both POWER and ARM (although I > haven't tried on ARM). I could incredibly reliably reproduce on a = POWER8 > system but likely also hit on POWER7. >=20 > I've reproduced *very* reliably with a frest MySQL 5.6.17 build (from > source) on a big endian host (e.g. Fedora) with a simple mysqlslap = run: > mysqlslap --concurrency=3D128 --iterations=3D2 --number-int-cols=3D2 > --number-char-cols=3D3 --auto-generate-sql --number-of-queries=3D10000 >=20 > (this could probably be paired down) >=20 > What's interesting to note is that the test suite passes but a simple > very small stress test like the above makes the server hit an assert = in > the InnoDB list code (in create read view) that's protected by.. yep, > one of these mutexes. Obviously nobody's hammering this too hard on > multicore ARM yet. >=20 > If you disable the use of GCC atomics for these mutexes and instead = fall > back to pthread mutex, it all works fine. >=20 > The fix is fairly simple: > 1) ib_mutex_test_and_set needs a __sync_synchronize() before the call = to > os_atomic_test_and_set_byte() > 2) mutex_reset_lock_word needs a __sync_synchronize() before > os_atomic_test_and_set_byte() call > 3) and __sync_synchronize() is needed after the read in > mutex_get_lock_word(). >=20 > The barriers aren't required on x86. >=20 > MariaDB, Percona Server and Percona XtraBackup are probably also > affected, although I haven't tried these. >=20 >=20 > --=20 > MySQL Internals Mailing List > For list archives: http://lists.mysql.com/internals > To unsubscribe: http://lists.mysql.com/internals >=20 -- MySQL Internals Mailing List For list archives: http://lists.mysql.com/internals To unsubscribe: http://lists.mysql.com/internals