[GLIBC] Fix glibc AVX frequency problems

Bug #1727136 reported by quanxian
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Linux
Triaged
Medium
Canonical Kernel Team
linux (Ubuntu)
Triaged
Medium
Canonical Kernel Team

Bug Description

Various glibc versions use AVX512 or AVX incorrectly in memcpy/memset or use AVX unintentionally due to branch mispredictions. On SKX using AVX can lower the frequency by several bins.
There was a decision to not use AVX in memcpy/memset to avoid these problems for legacy code.
glibc mainline has been fixed. The actual state per version depends on the version, and what backports it has applied.
See the attachment for the fix status for several glibc versions. Need to figure out for each supported glibc release if they are affected, and submit backports of the fixes.

How to test:
Non AVX test code like compiles should not report any LVL1,2 AVX licenses with
perf stat -e cpu/event=0x28,umask=0x18,name=core_power_lvl1_turbo_license/,cpu/event=0x28,umask=0x20,name=core_power_lvl2_turbo_license/,cpu/event=0x28,umask=0x40,name=core_power_throttle/,cycles -a -I 1000 sleep 10

17.10 also hit this issue, when testing, need run some others application. For example, building kernel.
16.04 hit the issue.

Target Release: 16.04

quanxian (quanxian-wang)
description: updated
Revision history for this message
Adam Conrad (adconrad) wrote :

The only way to really make this sort of update "low key" is to backport the fixes on the upstream branches and include it in an "update to latest stable branch" sort of SRU. If we backport just these bits, not calling it out in the changelog wouldn't look good.

Revision history for this message
Alice Liu (dxliu) wrote :
Download full text (4.5 KiB)

Tested on Ubuntu 17.10 on Purley-4S. It has this issue.

root@ubuntu:/home/test# perf stat -e cpu/event=0x28,umask=0x18,name=core_power_lvl1_turbo_license/,cpu/event=0x28,umask=0x20,name=core_power_lvl2_turbo_license/,cpu/event=0x28,umask=0x40,name=core_power_throttle/,cycles -a -I 1000 sleep 10
# time counts unit events
     1.095335844 0 core_power_lvl1_turbo_license
     1.095335844 0 core_power_lvl2_turbo_license
     1.095335844 0 core_power_throttle
     1.095335844 147,184,144 cycles
     2.139554427 0 core_power_lvl1_turbo_license
     2.139554427 0 core_power_lvl2_turbo_license
     2.139554427 35,560 core_power_throttle
     2.139554427 170,364,636 cycles
     3.183743147 0 core_power_lvl1_turbo_license
     3.183743147 0 core_power_lvl2_turbo_license
     3.183743147 20,538 core_power_throttle
     3.183743147 110,499,586 cycles
     4.228109748 0 core_power_lvl1_turbo_license
     4.228109748 0 core_power_lvl2_turbo_license
     4.228109748 21,482 core_power_throttle
     4.228109748 121,552,440 cycles
     5.272593234 0 core_power_lvl1_turbo_license
     5.272593234 0 core_power_lvl2_turbo_license
     5.272593234 21,484 core_power_throttle
     5.272593234 135,378,982 cycles
     6.316954225 0 core_power_lvl1_turbo_license
     6.316954225 0 core_power_lvl2_turbo_license
     6.316954225 27,796 core_power_throttle
     6.316954225 132,060,197 cycles
     7.361153943 0 core_power_lvl1_turbo_license
     7.361153943 0 core_power_lvl2_turbo_license
     7.361153943 21,158 core_power_throttle
     7.361153943 123,277,306 cycl...

Read more...

Revision history for this message
pragyansri.pathi@intel.com (pragyan) wrote :

Adam Point taken - following up with H.J code owner.

Revision history for this message
pragyansri.pathi@intel.com (pragyan) wrote :
Revision history for this message
Alice Liu (dxliu) wrote :

Clarify that the counts of lvl1 and lvl2 are zero. So Ubuntu 17.10 doesn't hit this issue.
Change this bug to "invalid".

Changed in intel:
status: New → Invalid
Revision history for this message
Alice Liu (dxliu) wrote :

Ubuntu 16.04.3 LTS hits this issue. The glibc version is 2.23.

quanxian (quanxian-wang)
description: updated
Changed in intel:
status: Invalid → Incomplete
Revision history for this message
Patricia Gaughen (gaughen) wrote :

Although the bug is marked incomplete, I hear you may want the fix made available in 16.04. Is this correct? Please confirm what you are hoping for so I can confirm the feasibility and plan the work.

Revision history for this message
quanxian (quanxian-wang) wrote :

yes. we need fix in 16.04. for 17.10, there is no issue.

for 16.04, Pragyan has list the fixes for every version of glibc in comment#4.

Canonical can take the fixes from that based on 16.04 release.

tags: added: id-5a3075247a0164a9b9f16cba
Revision history for this message
pragyansri.pathi@intel.com (pragyan) wrote :

Canonical Team any update on this?

Revision history for this message
pragyansri.pathi@intel.com (pragyan) wrote :

Canonical any update: Skylake server requires the up-to-date glibc to get the turbo frequency

Revision history for this message
quanxian (quanxian-wang) wrote :

17.10 also came across the issue when building the kernel and at the same time run the testing.

Is there any action for 16.04 and 17.10?

description: updated
Revision history for this message
Joseph Salisbury (jsalisbury) wrote :

Can we move this bug to the "Linux" package and make it public?

tags: added: kernel0-da-key
tags: added: kernel-da-key
removed: kernel0-da-key
Changed in intel:
importance: Undecided → Medium
status: Incomplete → Triaged
assignee: nobody → Canonical Kernel Team (canonical-kernel-team)
Revision history for this message
quanxian (quanxian-wang) wrote :

yes, can be public.

quanxian (quanxian-wang)
information type: Proprietary → Public
affects: intel → linux
Changed in linux (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Canonical Kernel Team (canonical-kernel-team)
Brad Figg (brad-figg)
tags: added: cscc
Revision history for this message
roots (roots) wrote :
Download full text (4.4 KiB)

I'm having the same issue with Ubuntu 20.04, linux 5.4.0-31-generic:

user@linux:~$ sudo perf stat -e cpu/event=0x28,umask=0x18,name=core_power_lvl1_turbo_license/,cpu/event=0x28,umask=0x20,name=core_power_lvl2_turbo_license/,cpu/event=0x28,umask=0x40,name=core_power_throttle/,cycles -a -I 1000 sleep 10
# time counts unit events
     1.000170047 1.861 core_power_lvl1_turbo_license
     1.000170047 284 core_power_lvl2_turbo_license
     1.000170047 103.012 core_power_throttle
     1.000170047 26.525.939 cycles
     2.000358208 2.873 core_power_lvl1_turbo_license
     2.000358208 411 core_power_lvl2_turbo_license
     2.000358208 120.125 core_power_throttle
     2.000358208 35.270.662 cycles
     3.000529648 2.995 core_power_lvl1_turbo_license
     3.000529648 325 core_power_lvl2_turbo_license
     3.000529648 103.505 core_power_throttle
     3.000529648 49.564.376 cycles
     4.000701689 2.519 core_power_lvl1_turbo_license
     4.000701689 354 core_power_lvl2_turbo_license
     4.000701689 107.696 core_power_throttle
     4.000701689 32.302.985 cycles
     5.000874532 2.758 core_power_lvl1_turbo_license
     5.000874532 366 core_power_lvl2_turbo_license
     5.000874532 141.070 core_power_throttle
     5.000874532 36.180.579 cycles
     6.001046915 2.626 core_power_lvl1_turbo_license
     6.001046915 370 core_power_lvl2_turbo_license
     6.001046915 116.084 core_power_throttle
     6.001046915 38.366.890 cycles
     7.001218040 26.266 core_power_lvl1_turbo_license
     7.001218040 418 core_power_lvl2_turbo_license
     7.001218040 128.776 core_power_throttle
     7.001218040 1.201.403.076 ...

Read more...

Revision history for this message
roots (roots) wrote :

Addendum to the previous comment: glibc version is 2.31-0ubuntu9.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.