Bug #94121 Enable hardware CRC32 under Valgrind
Submitted: 29 Jan 2019 15:54 Modified: 4 Aug 2021 9:58
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:5.6,5.7,8.0 OS:Linux
Assigned to: Jakub Lopuszanski CPU Architecture:Any
Tags: crc32, sse4.2, valgrind

[29 Jan 2019 15:54] Laurynas Biveinis
Description:
Under Valgrind, hardware CRC32 checksums are disabled because:

static bool ut_crc32_check_cpu() {
...
  /* Valgrind does not understand the CRC32 instructions:

  vex amd64->IR: unhandled instruction bytes: 0xF2 0x48 0xF 0x38 0xF0 0xA
  valgrind: Unrecognised instruction at address 0xad3db5.
...

This comes right from original implementation in 2011. But Valgrind 3.6.1, released also in 2011, added support for the instruction. Eight years later, it should be safe to remove, might save a cycle or two, also the patch only deletes code, which is always good. Quick test with new Valgrind shows that it works.

How to repeat:
See above

Suggested fix:
Remove #ifdef UNIV_DEBUG_VALGRIND from ut_crc32_check_cpu
[29 Jan 2019 15:57] Laurynas Biveinis
Bug 94141 fix for 8.0.13

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

Contribution: bug94141-8.0.13.patch (application/octet-stream, text), 1.45 KiB.

[29 Jan 2019 18:03] MySQL Verification Team
Thank you for contribution.
Do you meant: Bug 94121 fix for 8.0.13 instead of Bug 94141 fix for 8.0.13?
[29 Jan 2019 18:37] Laurynas Biveinis
Yes, that's what I meant, sorry for the typo
[29 Jan 2019 20:51] MySQL Verification Team
Thank you for the contribution.
[4 Aug 2021 9:58] Jakub Lopuszanski
This will be fixed in 8.0, together with Bug #32887066 CRC32 PEFORMANCE IS SUBOPTIMAL (a.k.a. bug#103703) which just landed in mysql-trunk