Bug #87293 TTASFutex Lock release barrier (aarch64)
Submitted: 3 Aug 2017 5:49 Modified: 10 Oct 2017 16:51
Reporter: Debayan Ghosh (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:5.7, 8.0 OS:Linux
Assigned to: CPU Architecture:ARM
Tags: aarch64, barriers, Contribution

[3 Aug 2017 5:49] Debayan Ghosh
Description:
The TTASFutexMutex implementation for lock release uses a os_rmb() which may not
guarantee the changes to locked data structures are made observable before the unlock becomes observable.

This causes a mysql server hang on aarch64 platforms when tested with sysbench oltp workloads at higher threads (>64T)

How to repeat:

Compile mysql-server with DMUTEXTYPE=futex

Run sysbench 1.1.0 oltp_update_index/oltp_write_only test with 64 threads and more.

Suggested fix:
Suggest to use a ATOMIC_RELEASE in place of ATOMIC_ACQUIRE i.e use os_wmb instead of os_rmb in the code.

This also fixes the runtime issue.
[4 Aug 2017 2:25] Debayan Ghosh
Changed category to InnoDB Storage Engine.
[24 Aug 2017 1:51] Debayan Ghosh
memory barrier change

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: 0001-Fix-barrier-for-FutexMutex-lock-exit-implementation.patch (application/octet-stream, text), 796 bytes.

[29 Aug 2017 5:08] Umesh Shastry
Hello Debayan,

Thank you for the report and contribution.

Thanks,
Umesh
[10 Oct 2017 16:51] Debayan Ghosh
This crash issue is reproduced with mysql-8.0.3 tag as well on Aarch64 platform.
The suggested barrier change fixes it.