Comment 22 for bug 2019203

Revision history for this message
Dan Lenski (lenski) wrote :

+1 to what seth-arnold wrote above (https://bugs.launchpad.net/ubuntu/+source/mysql-8.0/+bug/2019203/comments/6)

> There's some special casing in that routine for s390x to read the config from /sys; at least my rpi 3b+ has the same file with reasonable looking data:

Yes. According to the git-blame (https://github.com/mysql/mysql-server/blame/ea7087d885006918ad54458e7aad215b1650312c/sql/memory/aligned_atomic.h#L82), there was a follow-up commit to apply a very similar patch for s390.

https://github.com/mysql/mysql-server/commit/f2d64bfa575700234d5f36418d5ef143b54e2a16

> Perhaps the #if defined(__s390x__) should grow an || defined(__aarch64__) or similar?

Agreed. I would go further and suggest an arch-agnostic change…

```
#elif defined(__linux__)
static inline size_t _cache_line_size() {
Bug #32619199 SYSCONF CALLED WITHOUT ERROR CHECKING
  long size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
  if (size > 0)
    return static_cast<size_t>(size);
  // Known to return 0 on s390x RHEL 7.x, and armhf

  FILE *p = fopen(
      "/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size", "r");
  if (p) {
    fscanf(p, "%ld", &size);
    fclose(p);
  }
  if (size > 0)
    return static_cast<size_t>(size);

  // Default to 64
  return 64;
#endif
```