Bug 230066 - sysutils/turbostat coredump on ivy bridge
Summary: sysutils/turbostat coredump on ivy bridge
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Kurt Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-26 18:10 UTC by Kevin Bowling
Modified: 2018-08-03 20:07 UTC (History)
3 users (show)

See Also:
pi: maintainer-feedback+


Attachments
[PATCH] sysutils/turbostat: Fix reading topology with multiple packages (8.06 KB, patch)
2018-07-31 21:19 UTC, D Scott Phillips
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Bowling freebsd_committer freebsd_triage 2018-07-26 18:10:28 UTC
(gdb) run
Starting program: /usr/local/sbin/turbostat 
turbostat version 17.06.23 - Len Brown <lenb@kernel.org>
CPUID(0): GenuineIntel 13 CPUID levels; family:model:stepping 0x6:3e:4 (6:62:4)
CPUID(1): SSE3 MONITOR SMX EIST TM2 TSC MSR ACPI-TM TM
CPUID(6): APERF, TURBO, DTS, PTM, No-HWP, No-HWPnotify, No-HWPwindow, No-HWPepp, No-HWPpkg, EPB
cpu25: MSR_IA32_MISC_ENABLE: 0x00850089 (TCC EIST No-MWAIT PREFETCH TURBO)
CPUID(7): No-SGX
cpu25: MSR_MISC_PWR_MGMT: 0x00400000 (ENable-EIST_Coordination DISable-EPB DISable-OOB)
RAPL: 570 sec. Joule Counter Range, at 115 Watts
cpu25: MSR_PLATFORM_INFO: 0xc10e4811800
12 * 100.0 = 1200.0 MHz max efficiency frequency
24 * 100.0 = 2400.0 MHz base frequency
cpu25: MSR_IA32_POWER_CTL: 0x2104005b (C1E auto-promotion: ENabled)
cpu25: MSR_TURBO_RATIO_LIMIT1: 0x1c1c1c1c1c1c1c1c
28 * 100.0 = 2800.0 MHz max turbo 16 active cores
28 * 100.0 = 2800.0 MHz max turbo 15 active cores
28 * 100.0 = 2800.0 MHz max turbo 14 active cores
28 * 100.0 = 2800.0 MHz max turbo 13 active cores
28 * 100.0 = 2800.0 MHz max turbo 12 active cores
28 * 100.0 = 2800.0 MHz max turbo 11 active cores
28 * 100.0 = 2800.0 MHz max turbo 10 active cores
28 * 100.0 = 2800.0 MHz max turbo 9 active cores
cpu25: MSR_TURBO_RATIO_LIMIT: 0x1c1c1c1c1d1e1f20
28 * 100.0 = 2800.0 MHz max turbo 8 active cores
28 * 100.0 = 2800.0 MHz max turbo 7 active cores
28 * 100.0 = 2800.0 MHz max turbo 6 active cores
28 * 100.0 = 2800.0 MHz max turbo 5 active cores
29 * 100.0 = 2900.0 MHz max turbo 4 active cores
30 * 100.0 = 3000.0 MHz max turbo 3 active cores
31 * 100.0 = 3100.0 MHz max turbo 2 active cores
32 * 100.0 = 3200.0 MHz max turbo 1 active cores
cpu25: MSR_PKG_CST_CONFIG_CONTROL: 0x00008403 (locked: pkg-cstate-limit=3: pc6r)
NSFOD /sys/devices/system/cpu/cpu25/cpufreq/scaling_driver
cpu25: MSR_MISC_FEATURE_CONTROL: 0x00000000 (L2-Prefetch L2-Prefetch-pair L1-Prefetch L1-IP-Prefetch)

Program received signal SIGBUS, Bus error.
0x00000000002062f4 in cpu_is_not_present (cpu=-1) at turbostat.c:291
291     turbostat.c: No such file or directory.
(gdb) bt
#0  0x00000000002062f4 in cpu_is_not_present (cpu=-1) at turbostat.c:291
#1  0x00000000002063e7 in for_all_cpus (func=0x2116d0 <print_hwp>, thread_base=0x8006a04c0, core_base=0x800689000, 
    pkg_base=0x80069b280) at turbostat.c:313
#2  0x0000000000216bb1 in turbostat_init () at turbostat.c:4865
#3  0x000000000021829f in main (argc=1, argv=0x7fffffffeb88) at turbostat.c:5416



kern.sched.topology_spec: <groups>
 <group level="1" cache-level="0">
  <cpu count="48" mask="ffffffffffff,0,0,0">0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47</cpu>
  <children>
   <group level="2" cache-level="3">
    <cpu count="24" mask="ffffff,0,0,0">0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23</cpu>
    <children>
     <group level="3" cache-level="2">
      <cpu count="2" mask="3,0,0,0">0, 1</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c,0,0,0">2, 3</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="30,0,0,0">4, 5</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c0,0,0,0">6, 7</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="300,0,0,0">8, 9</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c00,0,0,0">10, 11</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="3000,0,0,0">12, 13</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c000,0,0,0">14, 15</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="30000,0,0,0">16, 17</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c0000,0,0,0">18, 19</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="300000,0,0,0">20, 21</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c00000,0,0,0">22, 23</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
    </children>
   </group>
   <group level="2" cache-level="3">
    <cpu count="24" mask="ffffff000000,0,0,0">24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47</cpu>
    <children>
     <group level="3" cache-level="2">
      <cpu count="2" mask="3000000,0,0,0">24, 25</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c000000,0,0,0">26, 27</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="30000000,0,0,0">28, 29</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c0000000,0,0,0">30, 31</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="300000000,0,0,0">32, 33</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c00000000,0,0,0">34, 35</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="3000000000,0,0,0">36, 37</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c000000000,0,0,0">38, 39</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="30000000000,0,0,0">40, 41</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c0000000000,0,0,0">42, 43</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="300000000000,0,0,0">44, 45</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
     <group level="3" cache-level="2">
      <cpu count="2" mask="c00000000000,0,0,0">46, 47</cpu>
      <flags><flag name="THREAD">THREAD group</flag><flag name="SMT">SMT group</flag></flags>
     </group>
    </children>
   </group>
  </children>
 </group>
</groups>
Comment 1 D Scott Phillips 2018-07-31 21:19:00 UTC
Created attachment 195703 [details]
[PATCH] sysutils/turbostat: Fix reading topology with multiple packages

Fixed a bug where core identifiers within a package would not
count from zero. This caused a out-of-bounds array access when
multiple packages were present.

Also gracefully handle the absence of the kern.intrs sysctl (added
in 12.0), and don't use reallocarray (added in 11.0).

PR:             230066
Submitted by:   D Scott Phillips <d.scott.phillips@intel.com>
Comment 2 Kurt Jaeger freebsd_committer freebsd_triage 2018-08-03 20:06:41 UTC
Committed, thanks!
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-08-03 20:07:20 UTC
A commit references this bug:

Author: pi
Date: Fri Aug  3 20:06:27 UTC 2018
New revision: 476320
URL: https://svnweb.freebsd.org/changeset/ports/476320

Log:
  sysutils/turbostat: Fix reading topology with multiple packages

  Fixed a bug where core identifiers within a package would not
  count from zero. This caused a out-of-bounds array access when
  multiple packages were present.

  Also gracefully handle the absence of the kern.intrs sysctl (added
  in 12.0), and don't use reallocarray (added in 11.0).

  PR:		230066
  Reported by:	kbowling
  Submitted by:	D Scott Phillips <d.scott.phillips@intel.com> (maintainer)

Changes:
  head/sysutils/turbostat/Makefile
  head/sysutils/turbostat/files/patch-turbostat.c